Merged changes in the trunk up to revision 41099.
This commit is contained in:
@@ -774,7 +774,7 @@ elseif(WIN32)
|
||||
set(PLATFORM_LINKFLAGS_DEBUG "/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib")
|
||||
|
||||
else()
|
||||
# keep GCC spesific stuff here
|
||||
# keep GCC specific stuff here
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
set(PLATFORM_LINKLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid -lwsock32")
|
||||
set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
|
||||
|
||||
34
GNUmakefile
34
GNUmakefile
@@ -34,10 +34,13 @@ OS_NCASE:=$(shell uname -s | tr '[A-Z]' '[a-z]')
|
||||
|
||||
# Source and Build DIR's
|
||||
BLENDER_DIR:=$(shell pwd -P)
|
||||
BUILD_DIR:=$(shell dirname $(BLENDER_DIR))/build/$(OS_NCASE)
|
||||
BUILD_TYPE:=Release
|
||||
BUILD_CMAKE_ARGS:=
|
||||
|
||||
ifndef BUILD_DIR
|
||||
BUILD_DIR:=$(shell dirname $(BLENDER_DIR))/build/$(OS_NCASE)
|
||||
endif
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# additional targets for the build configuration
|
||||
@@ -120,6 +123,9 @@ help:
|
||||
@echo " * headless - build without an interface (renderfarm or server automation)"
|
||||
@echo " * bpy - build as a python module which can be loaded from python directly"
|
||||
@echo ""
|
||||
@echo " Note, passing the argument 'BUILD_DIR=path' when calling make will override the default build dir."
|
||||
@echo ""
|
||||
@echo ""
|
||||
@echo "Project Files for IDE's"
|
||||
@echo " * project_qtcreator - QtCreator Project Files"
|
||||
@echo " * project_netbeans - NetBeans Project Files"
|
||||
@@ -130,9 +136,8 @@ help:
|
||||
@echo " * package_pacman - build an arch linux pacmanpackage"
|
||||
@echo " * package_archive - build an archive package"
|
||||
@echo ""
|
||||
@echo "Other Targets"
|
||||
@echo "Other Targets (not assosiated with building blender)"
|
||||
@echo " * translations - update blenders translation files in po/"
|
||||
# TODO, doxygen and sphinx docs
|
||||
@echo ""
|
||||
@echo "Testing Targets (not assosiated with building blender)"
|
||||
@echo " * test - run ctest, currently tests import/export, operator execution and that python modules load"
|
||||
@@ -145,6 +150,11 @@ help:
|
||||
@echo " * check_splint - run blenders source through splint (C only)"
|
||||
@echo " * check_sparse - run blenders source through sparse (C only)"
|
||||
@echo ""
|
||||
@echo "Documentation Targets (not assosiated with building blender)"
|
||||
@echo " * doc_py - generate sphinx python api docs"
|
||||
@echo " * doc_dna - generate blender file format reference"
|
||||
@echo " * doc_man - generate manpage"
|
||||
@echo ""
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Packages
|
||||
@@ -222,6 +232,24 @@ check_sparse:
|
||||
cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Documentation
|
||||
#
|
||||
|
||||
# Simple version of ./doc/python_api/sphinx_doc_gen.sh with no PDF generation.
|
||||
doc_py:
|
||||
$(BUILD_DIR)/bin/blender --background --factory-startup --python doc/python_api/sphinx_doc_gen.py
|
||||
cd doc/python_api ; sphinx-build -n -b html sphinx-in sphinx-out
|
||||
@echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/contents.html'"
|
||||
|
||||
doc_dna:
|
||||
$(BUILD_DIR)/bin/blender --background --factory-startup --python doc/blender_file_format/BlendFileDnaExporter_25.py
|
||||
@echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'"
|
||||
|
||||
doc_man:
|
||||
python3 doc/manpage/blender.1.py $(BUILD_DIR)/bin/blender
|
||||
|
||||
|
||||
clean:
|
||||
$(MAKE) -C $(BUILD_DIR) clean
|
||||
|
||||
|
||||
@@ -51,9 +51,9 @@ ELSE (WIN32)
|
||||
ENDIF (WIN32)
|
||||
|
||||
IF (GLEW_INCLUDE_PATH)
|
||||
SET( GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
|
||||
SET(GLEW_FOUND TRUE)
|
||||
ELSE (GLEW_INCLUDE_PATH)
|
||||
SET( GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
|
||||
SET(GLEW_FOUND FALSE)
|
||||
ENDIF (GLEW_INCLUDE_PATH)
|
||||
|
||||
MARK_AS_ADVANCED( GLEW_FOUND )
|
||||
|
||||
@@ -53,10 +53,11 @@ SET(_opencollada_FIND_COMPONENTS
|
||||
)
|
||||
|
||||
# Fedora openCOLLADA package links these statically
|
||||
# note that order is important here ot it wont link
|
||||
SET(_opencollada_FIND_STATIC_COMPONENTS
|
||||
UTF
|
||||
ftoa
|
||||
buffer
|
||||
ftoa
|
||||
UTF
|
||||
)
|
||||
|
||||
SET(_opencollada_SEARCH_DIRS
|
||||
|
||||
@@ -3,17 +3,24 @@
|
||||
# Authors: Rohit Yadav <rohityadav89@gmail.com>
|
||||
#
|
||||
|
||||
find_program(RPMBUILD
|
||||
NAMES rpmbuild
|
||||
PATHS "/usr/bin")
|
||||
if(NOT DEFINED RPMBUILD)
|
||||
|
||||
mark_as_advanced(RPMBUILD)
|
||||
find_program(RPMBUILD
|
||||
NAMES rpmbuild
|
||||
PATHS "/usr/bin")
|
||||
|
||||
mark_as_advanced(RPMBUILD)
|
||||
|
||||
if(RPMBUILD)
|
||||
message(STATUS "RPM Build Found: ${RPMBUILD}")
|
||||
else(RPMBUILD)
|
||||
message(STATUS "RPM Build Not Found (rpmbuild). RPM generation will not be available")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(RPMBUILD)
|
||||
get_filename_component(RPMBUILD_PATH ${RPMBUILD} ABSOLUTE)
|
||||
message(STATUS "Found rpmbuild : ${RPMBUILD_PATH}")
|
||||
set(RPMBUILD_FOUND "YES")
|
||||
set(RPMBUILD_FOUND TRUE)
|
||||
else(RPMBUILD)
|
||||
message(STATUS "rpmbuild NOT found. RPM generation will not be available")
|
||||
set(RPMBUILD_FOUND "NO")
|
||||
endif()
|
||||
set(RPMBUILD_FOUND FALSE)
|
||||
endif()
|
||||
@@ -27,6 +27,10 @@ IGNORE = (
|
||||
"extern/eltopo/common/openglutils.cpp",
|
||||
"extern/eltopo/eltopo3d/broadphase_blenderbvh.cpp",
|
||||
"source/blender/imbuf/intern/imbuf_cocoa.m",
|
||||
"extern/recastnavigation/Recast/Source/RecastLog.cpp",
|
||||
"extern/recastnavigation/Recast/Source/RecastTimer.cpp",
|
||||
"entern/audaspace/SRC/AUD_SRCResampleFactory.cpp",
|
||||
"entern/audaspace/SRC/AUD_SRCResampleReader.cpp",
|
||||
|
||||
"extern/bullet2/src/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.h",
|
||||
"extern/bullet2/src/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.h",
|
||||
@@ -41,6 +45,10 @@ IGNORE = (
|
||||
"extern/eltopo/common/meshes/TriangleIndex.hpp",
|
||||
"extern/eltopo/common/meshes/meshloader.h",
|
||||
"extern/eltopo/eltopo3d/broadphase_blenderbvh.h"
|
||||
"extern/recastnavigation/Recast/Include/RecastLog.h",
|
||||
"extern/recastnavigation/Recast/Include/RecastTimer.h",
|
||||
"intern/audaspace/SRC/AUD_SRCResampleFactory.h",
|
||||
"intern/audaspace/SRC/AUD_SRCResampleReader.h",
|
||||
)
|
||||
|
||||
UTF8_CHECK = True
|
||||
|
||||
@@ -582,6 +582,20 @@ def AppIt(target=None, source=None, env=None):
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'find %s/%s.app -name __MACOSX -exec rm -rf {} \;'%(installdir, binary)
|
||||
commands.getoutput(cmd)
|
||||
if env['CC'].endswith('4.6.1'): # for correct errorhandling with gcc 4.6.1 we need the gcc.dylib to link, thus distribute in app-bundle
|
||||
cmd = 'mkdir %s/%s.app/Contents/MacOS/lib'%(installdir, binary)
|
||||
commands.getoutput(cmd)
|
||||
instname = env['BF_CXX']
|
||||
cmd = 'cp %s/lib/libgcc_s.1.dylib %s/%s.app/Contents/MacOS/lib/'%(instname, installdir, binary)
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'install_name_tool -id @executable_path/lib/libgcc_s.1.dylib %s/%s.app/Contents/MacOS/lib/libgcc_s.1.dylib'%(installdir, binary)
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'install_name_tool -change %s/lib/libgcc_s.1.dylib @executable_path/lib/libgcc_s.1.dylib %s/%s.app/Contents/MacOS/%s'%(instname, installdir, binary, binary)
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'rm -rf %s/set_simulation_threads.app'%(installdir) # first clear omp_num_threads applescript
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'cp -R %s/source/darwin/set_simulation_threads.app %s/'%(bldroot, installdir) # copy the omp_num_threads applescript
|
||||
commands.getoutput(cmd)
|
||||
|
||||
# extract copy system python, be sure to update other build systems
|
||||
# when making changes to the files that are copied.
|
||||
|
||||
@@ -189,6 +189,6 @@ $Id$
|
||||
need changes elsewhere in the system, as it is handled automatically
|
||||
with the central library repository.
|
||||
|
||||
Enjoy the new system!
|
||||
Enjoy the new system!!
|
||||
|
||||
/Nathan Letwory (jesterKing)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.TH "BLENDER" "1" "September 22, 2011" "Blender Blender 2\&.59 (sub 3)"
|
||||
.TH "BLENDER" "1" "October 17, 2011" "Blender Blender 2\&.60 (sub 0)"
|
||||
|
||||
.SH NAME
|
||||
blender \- a 3D modelling and rendering package
|
||||
@@ -15,7 +15,7 @@ Use Blender to create TV commercials, to make technical visualizations, business
|
||||
http://www.blender.org
|
||||
.SH OPTIONS
|
||||
|
||||
Blender 2.59 (sub 3)
|
||||
Blender 2.59 (sub 4)
|
||||
Usage: blender [args ...] [file] [args ...]
|
||||
.br
|
||||
.SS "Render Options:"
|
||||
@@ -382,6 +382,7 @@ Arguments are executed in the order they are given. eg
|
||||
\fIBLENDER_SYSTEM_DATAFILES\fR Directory for system wide data files.
|
||||
\fIBLENDER_SYSTEM_PYTHON\fR Directory for system python libraries.
|
||||
\fITMP\fR or \fITMPDIR\fR Store temporary files here.
|
||||
\fISDL_AUDIODRIVER\fR LibSDL audio driver \- alsa, esd, dma.
|
||||
\fIPYTHONHOME\fR Path to the python directory, eg. /usr/lib/python.
|
||||
.br
|
||||
.br
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
import subprocess
|
||||
import os
|
||||
import sys
|
||||
|
||||
import time
|
||||
import datetime
|
||||
@@ -43,10 +44,15 @@ def man_format(data):
|
||||
|
||||
return data
|
||||
|
||||
# allow passing blender as argument
|
||||
if sys.argv[-1].endswith(os.sep + "blender"):
|
||||
blender_bin = sys.argv[-1]
|
||||
else:
|
||||
blender_bin = os.path.join(os.path.dirname(__file__), "../../blender.bin")
|
||||
|
||||
blender_bin = os.path.join(os.path.dirname(__file__), "../../blender.bin")
|
||||
|
||||
blender_help = subprocess.Popen([blender_bin, "--help"], stdout=subprocess.PIPE).communicate()[0].decode()
|
||||
cmd = [blender_bin, "--help"]
|
||||
print(" executing:", " ".join(cmd))
|
||||
blender_help = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0].decode()
|
||||
|
||||
blender_version = subprocess.Popen([blender_bin, "--version"], stdout=subprocess.PIPE).communicate()[0].decode().strip()
|
||||
blender_version = blender_version.split("Build")[0]
|
||||
|
||||
30
doc/python_api/examples/mathutils.Color.py
Normal file
30
doc/python_api/examples/mathutils.Color.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import mathutils
|
||||
|
||||
# color values are represented as RGB values from 0 - 1, this is blue
|
||||
col = mathutils.Color((0.0, 0.0, 1.0))
|
||||
|
||||
# as well as r/g/b attribute access you can adjust them by h/s/v
|
||||
col.s *= 0.5
|
||||
|
||||
# you can access its components by attribute or index
|
||||
print("Color R:", col.r)
|
||||
print("Color G:", col[1])
|
||||
print("Color B:", col[-1])
|
||||
print("Color HSV: %.2f, %.2f, %.2f", col[:])
|
||||
|
||||
|
||||
# components of an existing color can be set
|
||||
col[:] = 0.0, 0.5, 1.0
|
||||
|
||||
# components of an existing color can use slice notation to get a tuple
|
||||
print("Values: %f, %f, %f" % col[:])
|
||||
|
||||
# colors can be added and subtracted
|
||||
col += mathutils.Color((0.25, 0.0, 0.0))
|
||||
|
||||
# Color can be multiplied, in this example color is scaled to 0-255
|
||||
# can printed as integers
|
||||
print("Color: %d, %d, %d" % (col * 255.0)[:])
|
||||
|
||||
# This example prints the color as hexidecimal
|
||||
print("Hexidecimal: %.2x%.2x%.2x" % (col * 255.0)[:])
|
||||
@@ -1,3 +1,32 @@
|
||||
import mathutils
|
||||
import math
|
||||
|
||||
# todo
|
||||
# create a new euler with default axis rotation order
|
||||
eul = mathutils.Euler((0.0, math.radians(45.0), 0.0), 'XYZ')
|
||||
|
||||
# rotate the euler
|
||||
eul.rotate_axis(math.radians(10.0), 'Z')
|
||||
|
||||
# you can access its components by attribute or index
|
||||
print("Euler X", eul.x)
|
||||
print("Euler Y", eul[1])
|
||||
print("Euler Z", eul[-1])
|
||||
|
||||
# components of an existing euler can be set
|
||||
eul[:] = 1.0, 2.0, 3.0
|
||||
|
||||
# components of an existing euler can use slice notation to get a tuple
|
||||
print("Values: %f, %f, %f" % eul[:])
|
||||
|
||||
# the order can be set at any time too
|
||||
eul.order = 'ZYX'
|
||||
|
||||
# eulers can be used to rotate vectors
|
||||
vec = mathutils.Vector((0.0, 0.0, 1.0))
|
||||
vec.rotate(eul)
|
||||
|
||||
# often its useful to convert the euler into a matrix so it can be used as
|
||||
# transformations with more flexibility
|
||||
mat_rot = eul.to_matrix()
|
||||
mat_loc = mathutils.Matrix.Translation((2.0, 3.0, 4.0))
|
||||
mat = mat_loc * mat_rot.to_4x4()
|
||||
|
||||
@@ -1,3 +1,28 @@
|
||||
import mathutils
|
||||
import math
|
||||
|
||||
# todo
|
||||
# create a location matrix
|
||||
mat_loc = mathutils.Matrix.Translation((2.0, 3.0, 4.0))
|
||||
|
||||
# create an identitiy matrix
|
||||
mat_sca = mathutils.Matrix.Scale(0.5, 4, (0.0, 0.0, 1.0))
|
||||
|
||||
# create a rotation matrix
|
||||
mat_rot = mathutils.Matrix.Rotation(math.radians(45.0), 4, 'X')
|
||||
|
||||
# combine transformations
|
||||
mat_out = mat_loc * mat_rot * mat_sca
|
||||
print(mat_out)
|
||||
|
||||
# extract components back out of the matrix
|
||||
loc, rot, sca = mat_out.decompose()
|
||||
print(loc, rot, sca)
|
||||
|
||||
# it can also be useful to access components of a matrix directly
|
||||
mat = mathutils.Matrix()
|
||||
mat[0][0], mat[1][0], mat[2][0] = 0.0, 1.0, 2.0
|
||||
|
||||
mat[0][0:3] = 0.0, 1.0, 2.0
|
||||
|
||||
# each item in a matrix is a vector so vector utility functions can be used
|
||||
mat[0].xyz = 0.0, 1.0, 2.0
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
import mathutils
|
||||
import math
|
||||
|
||||
# todo
|
||||
# a new rotation 90 degrees about the Y axis
|
||||
quat_a = mathutils.Quaternion((0.7071068, 0.0, 0.7071068, 0.0))
|
||||
|
||||
# passing values to Quaternion's directly can be confusing so axis, angle
|
||||
# is supported for initializing too
|
||||
quat_b = mathutils.Quaternion((0.0, 1.0, 0.0), math.radians(90.0))
|
||||
|
||||
print("Check quaternions match", quat_a == quat_b)
|
||||
|
||||
# like matrices, quaternions can be multiplied to accumulate rotational values
|
||||
quat_a = mathutils.Quaternion((0.0, 1.0, 0.0), math.radians(90.0))
|
||||
quat_b = mathutils.Quaternion((0.0, 0.0, 1.0), math.radians(45.0))
|
||||
quat_out = quat_a * quat_b
|
||||
|
||||
# print the quat, euler degrees for mear mortals and (axis, angle)
|
||||
print("Final Rotation:")
|
||||
print(quat_out)
|
||||
print("%.2f, %.2f, %.2f" % tuple(math.degrees(a) for a in quat_out.to_euler()))
|
||||
print("(%.2f, %.2f, %.2f), %.2f" % (quat_out.axis[:] +
|
||||
(math.degrees(quat_out.angle), )))
|
||||
|
||||
@@ -106,7 +106,7 @@ There are also methods to access the current :class:`bge.types.KX_Scene`
|
||||
Matricies as used by the game engine are **row major**
|
||||
``matrix[row][col] = float``
|
||||
|
||||
:class:`bge.types.KX_Camera` has some examples using matricies.
|
||||
:class:`bge.types.KX_Camera` has some examples using matrices.
|
||||
|
||||
*********
|
||||
Variables
|
||||
|
||||
@@ -20,7 +20,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
|
||||
See :class:`Image.gl_load` and :class:`Image.gl_load`,
|
||||
for example.
|
||||
`OpenGL.org <http://www.opengl.org>`_
|
||||
`NeHe GameDev <nehe.gamedev.net>`_
|
||||
`NeHe GameDev <http://nehe.gamedev.net>`_
|
||||
|
||||
|
||||
.. function:: glAccum(op, value):
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
|
||||
GPU functions (gpu)
|
||||
===================
|
||||
|
||||
.. module:: gpu
|
||||
|
||||
This module provides access to materials GLSL shaders.
|
||||
|
||||
*****
|
||||
Intro
|
||||
*****
|
||||
@@ -16,7 +19,6 @@ and in the game engine.
|
||||
are are closely related to Blender's internal GLSL code and may change if the GLSL code
|
||||
is modified (e.g. new uniform type).
|
||||
|
||||
.. module:: gpu
|
||||
|
||||
*********
|
||||
Constants
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
Best Practice
|
||||
*************
|
||||
|
||||
When writing you're own scripts python is great for new developers to pick up and become productive, but you can also pick up odd habits or at least write scripts that are not easy for others to understand.
|
||||
|
||||
TODO: Intro text
|
||||
For you're own work this is of course fine, but if you want to collaborate with others or have you're work included with blender there are practices we encourage.
|
||||
|
||||
|
||||
Style Conventions
|
||||
@@ -61,5 +62,233 @@ TODO: Thomas
|
||||
Script Efficiency
|
||||
=================
|
||||
|
||||
TODO: Campbell
|
||||
List Manipulation (General Python Tips)
|
||||
---------------------------------------
|
||||
|
||||
|
||||
Searching for list items
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
In Python there are some handy list functions that save you having to search through the list.
|
||||
|
||||
Even though you're not looping on the list data **python is**, so you need to be aware of functions that will slow down your script by searching the whole list.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
my_list.count(list_item)
|
||||
my_list.index(list_item)
|
||||
my_list.remove(list_item)
|
||||
if list_item in my_list: ...
|
||||
|
||||
|
||||
Modifying Lists
|
||||
^^^^^^^^^^^^^^^
|
||||
In python we can add and remove from a list, This is slower when the list length is modifier, especially at the start of the list, since all the data after the index of modification needs to be moved up or down 1 place.
|
||||
|
||||
The most simple way to add onto the end of the list is to use ``my_list.append(list_item)`` or ``my_list.extend(some_list)`` and the fastest way to remove an item is ``my_list.pop()`` or ``del my_list[-1]``.
|
||||
|
||||
To use an index you can use ``my_list.insert(index, list_item)`` or ``list.pop(index)`` for list removal, but these are slower.
|
||||
|
||||
Sometimes its faster (but more memory hungry) to just rebuild the list.
|
||||
|
||||
|
||||
Say you want to remove all triangle faces in a list.
|
||||
|
||||
Rather than...
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
faces = mesh.faces[:] # make a list copy of the meshes faces
|
||||
f_idx = len(faces) # Loop backwards
|
||||
while f_idx: # while the value is not 0
|
||||
f_idx -= 1
|
||||
|
||||
if len(faces[f_idx].vertices) == 3:
|
||||
faces.pop(f_idx) # remove the triangle
|
||||
|
||||
|
||||
It's faster to build a new list with list comprehension.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
faces = [f for f in mesh.faces if len(f.vertices) != 3]
|
||||
|
||||
|
||||
Adding List Items
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
If you have a list that you want to add onto another list, rather then...
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
for l in some_list:
|
||||
my_list.append(l)
|
||||
|
||||
Use...
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
my_list.extend([a, b, c...])
|
||||
|
||||
|
||||
Note that insert can be used when needed, but it is slower than append especially when inserting at the start of a long list.
|
||||
|
||||
This example shows a very sub-optimal way of making a reversed list.
|
||||
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
reverse_list = []
|
||||
for list_item in some_list:
|
||||
reverse_list.insert(0, list_item)
|
||||
|
||||
|
||||
Removing List Items
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Use ``my_list.pop(index)`` rather than ``my_list.remove(list_item)``
|
||||
|
||||
This requires you to have the index of the list item but is faster since ``remove()`` will search the list.
|
||||
|
||||
Here is an example of how to remove items in 1 loop, removing the last items first, which is faster (as explained above).
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
list_index = len(my_list)
|
||||
|
||||
while list_index:
|
||||
list_index -= 1
|
||||
if my_list[list_index].some_test_attribute == 1:
|
||||
my_list.pop(list_index)
|
||||
|
||||
|
||||
This example shows a fast way of removing items, for use in cases were where you can alter the list order without breaking the scripts functionality. This works by swapping 2 list items, so the item you remove is always last.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
pop_index = 5
|
||||
|
||||
# swap so the pop_index is last.
|
||||
my_list[-1], my_list[pop_index] = my_list[pop_index], my_list[-1]
|
||||
|
||||
# remove last item (pop_index)
|
||||
my_list.pop()
|
||||
|
||||
|
||||
When removing many items in a large list this can provide a good speedup.
|
||||
|
||||
|
||||
Avoid Copying Lists
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
When passing a list/dictionary to a function, it is faster to have the function modify the list rather then returning a new list so python dosn't have tp duplicate the list in memory.
|
||||
|
||||
Functions that modify a list in-place are more efficient then functions that create new lists.
|
||||
|
||||
|
||||
This is generally slower so only use for functions when it makes sense not to modify the list in place.
|
||||
|
||||
>>> my_list = some_list_func(my_list)
|
||||
|
||||
|
||||
This is generally faster since there is no re-assignment and no list duplication.
|
||||
|
||||
>>> some_list_func(vec)
|
||||
|
||||
|
||||
Also note that passing a sliced list makes a copy of the list in python memory
|
||||
|
||||
>>> foobar(my_list[:])
|
||||
|
||||
If my_list was a large array containing 10000's of items, a copy could use a lot of extra memory.
|
||||
|
||||
|
||||
Writing Strings to a File (Python General)
|
||||
------------------------------------------
|
||||
|
||||
Here are 3 ways of joining multiple strings into 1 string for writing
|
||||
|
||||
This really applies to any area of your code that involves a lot of string joining.
|
||||
|
||||
|
||||
Pythons string addition, *don't use if you can help it, especially when writing data in a loop.*
|
||||
|
||||
>>> file.write(str1 + " " + str2 + " " + str3 + "\n")
|
||||
|
||||
|
||||
String formatting. Use this when you're writing string data from floats and int's
|
||||
|
||||
>>> file.write("%s %s %s\n" % (str1, str2, str3))
|
||||
|
||||
|
||||
Pythons string joining function. To join a list of strings
|
||||
|
||||
>>> file.write(" ".join([str1, str2, str3, "\n"]))
|
||||
|
||||
|
||||
join is fastest on many strings, string formatting is quite fast too (better for converting data types). String arithmetic is slowest.
|
||||
|
||||
|
||||
Parsing Strings (Import/Exporting)
|
||||
----------------------------------
|
||||
|
||||
Since many file formats are ASCII, the way you parse/export strings can make a large difference in how fast your script runs.
|
||||
|
||||
When importing strings to make into blender there are a few ways to parse the string.
|
||||
|
||||
Parsing Numbers
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
Use ``float(string)`` rather than ``eval(string)``, if you know the value will be an int then ``int(string)``, float() will work for an int too but its faster to read ints with int().
|
||||
|
||||
Checking String Start/End
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
If your checking the start of a string for a keyword, rather than...
|
||||
|
||||
>>> if line[0:5] == "vert ": ...
|
||||
|
||||
Use...
|
||||
|
||||
>>> if line.startswith("vert "):
|
||||
|
||||
Using ``startswith()`` is slightly faster (approx 5%) and also avoids a possible error with the slice length not matching the string length.
|
||||
|
||||
my_string.endswith("foo_bar") can be used for line endings too.
|
||||
|
||||
if your unsure whether the text is upper or lower case use lower or upper string function.
|
||||
|
||||
>>> if line.lower().startswith("vert ")
|
||||
|
||||
|
||||
Use try/except Sparingly
|
||||
------------------------
|
||||
|
||||
The **try** statement useful to save time writing error checking code.
|
||||
|
||||
However **try** is significantly slower then an **if** since an exception has to be set each time, so avoid using **try** in areas of your code that execute in a loop and runs many times.
|
||||
|
||||
There are cases where using **try** is faster than checking weather the condition will raise an error, so it is worth experimenting.
|
||||
|
||||
|
||||
Value Comparison
|
||||
----------------
|
||||
|
||||
Python has two ways to compare values ``a == b`` and ``a is b``, The difference is that ``==`` may run the objects comparison function ``__cmp__()`` where as ``is`` compares identity, that both variables reference the same item in memory.
|
||||
|
||||
In cases where you know you are checking for the same value which is referenced from multiple places, ``is`` is faster.
|
||||
|
||||
|
||||
Time You're Code
|
||||
----------------
|
||||
|
||||
While developing a script its good to time it to be aware of any changes in performance, this can be done simply.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import time
|
||||
time_start = time.time()
|
||||
|
||||
# do something...
|
||||
|
||||
print("My Script Finished: %.4f sec" % time.time() - time_start)
|
||||
|
||||
@@ -223,6 +223,26 @@ While writing scripts that deal with armatures you may find you have to switch b
|
||||
This is mainly an issue with editmode since pose data can be manipulated without having to be in pose mode, however for operator access you may still need to enter pose mode.
|
||||
|
||||
|
||||
Relative File Paths
|
||||
===================
|
||||
|
||||
Blenders relative file paths are not compatible with standard python modules such as ``sys`` and ``os``.
|
||||
|
||||
Built in python functions don't understand blenders ``//`` prefix which denotes the blend file path.
|
||||
|
||||
A common case where you would run into this problem is when exporting a material with assosiated image paths.
|
||||
|
||||
>>> bpy.path.abspath(image.filepath)
|
||||
|
||||
|
||||
When using blender data from linked libraries there is an unfortunate complication since the path will be relative to the library rather then the open blend file. When the data block may be from an external blend file pass the library argument from the `bpy.types.ID`.
|
||||
|
||||
>>> bpy.path.abspath(image.filepath, library=image.library)
|
||||
|
||||
|
||||
These returns the absolute path which can be used with native python modules.
|
||||
|
||||
|
||||
Unicode Problems
|
||||
================
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ else:
|
||||
"aud",
|
||||
"bgl",
|
||||
"blf",
|
||||
"gpu",
|
||||
"mathutils",
|
||||
"mathutils.geometry",
|
||||
"Freestyle",
|
||||
@@ -1050,7 +1051,9 @@ def rna2sphinx(BASEPATH):
|
||||
fw("html_theme = 'blender-org'\n")
|
||||
fw("html_theme_path = ['../']\n")
|
||||
|
||||
fw("html_favicon = 'favicon.ico'\n")
|
||||
# copied with the theme, exclude else we get an error [#28873]
|
||||
fw("html_favicon = 'favicon.ico'\n")
|
||||
|
||||
# not helpful since the source us generated, adds to upload size.
|
||||
fw("html_copy_source = False\n")
|
||||
fw("\n")
|
||||
@@ -1130,6 +1133,8 @@ def rna2sphinx(BASEPATH):
|
||||
fw(" bgl.rst\n\n")
|
||||
if "blf" not in EXCLUDE_MODULES:
|
||||
fw(" blf.rst\n\n")
|
||||
if "gpu" not in EXCLUDE_MODULES:
|
||||
fw(" gpu.rst\n\n")
|
||||
if "aud" not in EXCLUDE_MODULES:
|
||||
fw(" aud.rst\n\n")
|
||||
if "bpy_extras" not in EXCLUDE_MODULES:
|
||||
@@ -1274,6 +1279,13 @@ def rna2sphinx(BASEPATH):
|
||||
import shutil
|
||||
shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bgl.rst"), BASEPATH)
|
||||
|
||||
if "gpu" not in EXCLUDE_MODULES:
|
||||
#import gpu as module
|
||||
#pymodule2sphinx(BASEPATH, "gpu", module, "GPU Shader Module")
|
||||
#del module
|
||||
import shutil
|
||||
shutil.copy2(os.path.join(BASEPATH, "..", "rst", "gpu.rst"), BASEPATH)
|
||||
|
||||
if "aud" not in EXCLUDE_MODULES:
|
||||
import aud as module
|
||||
pymodule2sphinx(BASEPATH, "aud", module, "Audio System")
|
||||
|
||||
@@ -32,7 +32,8 @@
|
||||
|
||||
AUD_DynamicIIRFilterReader::AUD_DynamicIIRFilterReader(AUD_Reference<AUD_IReader> reader,
|
||||
AUD_Reference<AUD_DynamicIIRFilterFactory> factory) :
|
||||
AUD_IIRFilterReader(reader, std::vector<float>(), std::vector<float>())
|
||||
AUD_IIRFilterReader(reader, std::vector<float>(), std::vector<float>()),
|
||||
m_factory(factory)
|
||||
{
|
||||
sampleRateChanged(reader->getSpecs().rate);
|
||||
}
|
||||
|
||||
@@ -36,11 +36,14 @@ AUD_IIRFilterReader::AUD_IIRFilterReader(AUD_Reference<AUD_IReader> reader,
|
||||
const std::vector<float>& a) :
|
||||
AUD_BaseIIRFilterReader(reader, b.size(), a.size()), m_a(a), m_b(b)
|
||||
{
|
||||
for(int i = 1; i < m_a.size(); i++)
|
||||
m_a[i] /= m_a[0];
|
||||
for(int i = 0; i < m_b.size(); i++)
|
||||
m_b[i] /= m_a[0];
|
||||
m_a[0] = 1;
|
||||
if(m_a.size())
|
||||
{
|
||||
for(int i = 1; i < m_a.size(); i++)
|
||||
m_a[i] /= m_a[0];
|
||||
for(int i = 0; i < m_b.size(); i++)
|
||||
m_b[i] /= m_a[0];
|
||||
m_a[0] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
sample_t AUD_IIRFilterReader::filter()
|
||||
@@ -58,7 +61,7 @@ sample_t AUD_IIRFilterReader::filter()
|
||||
void AUD_IIRFilterReader::setCoefficients(const std::vector<float>& b,
|
||||
const std::vector<float>& a)
|
||||
{
|
||||
setLengths(m_b.size(), m_a.size());
|
||||
setLengths(b.size(), a.size());
|
||||
m_a = a;
|
||||
m_b = b;
|
||||
}
|
||||
|
||||
@@ -826,42 +826,51 @@ float* AUD_readSoundBuffer(const char* filename, float low, float high,
|
||||
|
||||
AUD_Reference<AUD_IFactory> file = new AUD_FileFactory(filename);
|
||||
|
||||
AUD_Reference<AUD_IReader> reader = file->createReader();
|
||||
AUD_SampleRate rate = reader->getSpecs().rate;
|
||||
|
||||
sound = new AUD_ChannelMapperFactory(file, specs);
|
||||
|
||||
if(high < rate)
|
||||
sound = new AUD_LowpassFactory(sound, high);
|
||||
if(low > 0)
|
||||
sound = new AUD_HighpassFactory(sound, low);
|
||||
|
||||
sound = new AUD_EnvelopeFactory(sound, attack, release, threshold, 0.1f);
|
||||
sound = new AUD_LinearResampleFactory(sound, specs);
|
||||
|
||||
if(square)
|
||||
sound = new AUD_SquareFactory(sound, sthreshold);
|
||||
|
||||
if(accumulate)
|
||||
sound = new AUD_AccumulatorFactory(sound, additive);
|
||||
else if(additive)
|
||||
sound = new AUD_SumFactory(sound);
|
||||
|
||||
reader = sound->createReader();
|
||||
|
||||
if(reader.isNull())
|
||||
return NULL;
|
||||
|
||||
int len;
|
||||
int position = 0;
|
||||
bool eos;
|
||||
do
|
||||
|
||||
try
|
||||
{
|
||||
len = samplerate;
|
||||
buffer.resize((position + len) * sizeof(float), true);
|
||||
reader->read(len, eos, buffer.getBuffer() + position);
|
||||
position += len;
|
||||
} while(!eos);
|
||||
AUD_Reference<AUD_IReader> reader = file->createReader();
|
||||
|
||||
AUD_SampleRate rate = reader->getSpecs().rate;
|
||||
|
||||
sound = new AUD_ChannelMapperFactory(file, specs);
|
||||
|
||||
if(high < rate)
|
||||
sound = new AUD_LowpassFactory(sound, high);
|
||||
if(low > 0)
|
||||
sound = new AUD_HighpassFactory(sound, low);
|
||||
|
||||
sound = new AUD_EnvelopeFactory(sound, attack, release, threshold, 0.1f);
|
||||
sound = new AUD_LinearResampleFactory(sound, specs);
|
||||
|
||||
if(square)
|
||||
sound = new AUD_SquareFactory(sound, sthreshold);
|
||||
|
||||
if(accumulate)
|
||||
sound = new AUD_AccumulatorFactory(sound, additive);
|
||||
else if(additive)
|
||||
sound = new AUD_SumFactory(sound);
|
||||
|
||||
reader = sound->createReader();
|
||||
|
||||
if(reader.isNull())
|
||||
return NULL;
|
||||
|
||||
int len;
|
||||
bool eos;
|
||||
do
|
||||
{
|
||||
len = samplerate;
|
||||
buffer.resize((position + len) * sizeof(float), true);
|
||||
reader->read(len, eos, buffer.getBuffer() + position);
|
||||
position += len;
|
||||
} while(!eos);
|
||||
}
|
||||
catch(AUD_Exception&)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
float* result = (float*)malloc(position * sizeof(float));
|
||||
memcpy(result, buffer.getBuffer(), position * sizeof(float));
|
||||
|
||||
@@ -69,7 +69,7 @@ bool AUD_NULLDevice::AUD_NULLHandle::seek(float position)
|
||||
|
||||
float AUD_NULLDevice::AUD_NULLHandle::getPosition()
|
||||
{
|
||||
return 0.0f;
|
||||
return std::numeric_limits<float>::quiet_NaN();
|
||||
}
|
||||
|
||||
AUD_Status AUD_NULLDevice::AUD_NULLHandle::getStatus()
|
||||
@@ -79,7 +79,7 @@ AUD_Status AUD_NULLDevice::AUD_NULLHandle::getStatus()
|
||||
|
||||
float AUD_NULLDevice::AUD_NULLHandle::getVolume()
|
||||
{
|
||||
return 0.0f;
|
||||
return std::numeric_limits<float>::quiet_NaN();
|
||||
}
|
||||
|
||||
bool AUD_NULLDevice::AUD_NULLHandle::setVolume(float volume)
|
||||
@@ -89,7 +89,7 @@ bool AUD_NULLDevice::AUD_NULLHandle::setVolume(float volume)
|
||||
|
||||
float AUD_NULLDevice::AUD_NULLHandle::getPitch()
|
||||
{
|
||||
return 0.0f;
|
||||
return std::numeric_limits<float>::quiet_NaN();
|
||||
}
|
||||
|
||||
bool AUD_NULLDevice::AUD_NULLHandle::setPitch(float pitch)
|
||||
@@ -153,7 +153,7 @@ void AUD_NULLDevice::unlock()
|
||||
|
||||
float AUD_NULLDevice::getVolume() const
|
||||
{
|
||||
return 0;
|
||||
return std::numeric_limits<float>::quiet_NaN();
|
||||
}
|
||||
|
||||
void AUD_NULLDevice::setVolume(float volume)
|
||||
|
||||
@@ -110,7 +110,7 @@ private:
|
||||
const GHOST_TEmbedderWindowID parentWindow
|
||||
);
|
||||
|
||||
/* SDL spesific */
|
||||
/* SDL specific */
|
||||
GHOST_WindowSDL * findGhostWindow(SDL_Window *sdl_win);
|
||||
|
||||
bool
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
|
||||
~GHOST_WindowSDL();
|
||||
|
||||
/* SDL spesific */
|
||||
/* SDL specific */
|
||||
SDL_Window *
|
||||
getSDLWindow()
|
||||
{
|
||||
|
||||
@@ -192,27 +192,7 @@ source/blender/editors/util/undo.c
|
||||
source/blender/editors/uvedit/uvedit_ops.c
|
||||
source/blender/editors/uvedit/uvedit_unwrap_ops.c
|
||||
|
||||
source/blender/makesrna/intern/rna_ID.c
|
||||
source/blender/makesrna/intern/rna_action.c
|
||||
source/blender/makesrna/intern/rna_color.c
|
||||
source/blender/makesrna/intern/rna_constraint.c
|
||||
source/blender/makesrna/intern/rna_curve.c
|
||||
source/blender/makesrna/intern/rna_fcurve.c
|
||||
source/blender/makesrna/intern/rna_material.c
|
||||
source/blender/makesrna/intern/rna_mesh.c
|
||||
source/blender/makesrna/intern/rna_modifier.c
|
||||
source/blender/makesrna/intern/rna_object.c
|
||||
source/blender/makesrna/intern/rna_object_force.c
|
||||
source/blender/makesrna/intern/rna_particle.c
|
||||
source/blender/makesrna/intern/rna_render.c
|
||||
source/blender/makesrna/intern/rna_scene.c
|
||||
source/blender/makesrna/intern/rna_space.c
|
||||
source/blender/makesrna/intern/rna_texture.c
|
||||
source/blender/makesrna/intern/rna_ui_api.c
|
||||
source/blender/makesrna/intern/rna_userdef.c
|
||||
source/blender/makesrna/intern/rna_wm.c
|
||||
source/blender/makesrna/intern/rna_wm_api.c
|
||||
source/blender/makesrna/intern/rna_world.c
|
||||
|
||||
source/blender/windowmanager/intern/wm_files.c
|
||||
source/blender/windowmanager/intern/wm_operators.c
|
||||
|
||||
@@ -6,7 +6,7 @@ I'll try briefly explain how translation works and how to update translation fil
|
||||
1. How it works
|
||||
---------------
|
||||
|
||||
This folder contains source files for translation system. This source files have
|
||||
This folder contains source files for translation system. These source files have
|
||||
got .po extension and they've got pretty simple syntax:
|
||||
|
||||
msgid "some message id"
|
||||
@@ -16,9 +16,9 @@ This means when string "some message id" is used as operator name, tooltip, menu
|
||||
and so it'll be displayed on the screen as "translation for this message".
|
||||
Pretty simple.
|
||||
|
||||
This source files are pre-compiled into ../relese/bin/.blender/locale/<language>/LC_MESSAGES/blender.mo,
|
||||
so they aren't getting compiled every time Blender is compiling to same some time and prevent
|
||||
failure on systems which doesn't have needed tools for compiling .po files.
|
||||
This source files are pre-compiled into ../release/bin/.blender/locale/<language>/LC_MESSAGES/blender.mo,
|
||||
so they aren't getting compiled every time Blender is compiling to save some time and prevent
|
||||
failure on systems which don't have needed tools for compiling .po files.
|
||||
|
||||
2. How to update translations
|
||||
-----------------------------
|
||||
@@ -32,7 +32,7 @@ msgid "some message id"
|
||||
msgstr "translation for this message"
|
||||
|
||||
it means translation used to exist for this message, but message was changed, so translation
|
||||
also have to be updated (it's easier to make new translation based on previos translation).
|
||||
also have to be updated (it's easier to make new translation based on previous translation).
|
||||
When translation was updated, remove line with '#, fuzzy' and it'll work.
|
||||
|
||||
If there's no message in .po file you want to translate, probably .po file should be updated.
|
||||
@@ -46,7 +46,7 @@ Use the following steps for this:
|
||||
- Run update_po.py script to merge all .po files with blender.pot (so all .po files
|
||||
will contain all msgid-s declared in blender.pot) or update_po.py <language> to
|
||||
update only needed .po file(s) to save time when you're busy with translation.
|
||||
But before ocmmit all .po files better be updated.
|
||||
But before commit all .po files better be updated.
|
||||
|
||||
When you've finished with translation, you should re-compile .po file into .mo file.
|
||||
It's also pretty simple: just run update_mo.py script to recompile all languages or
|
||||
@@ -54,7 +54,7 @@ just update_mo.py <language> to re-compile only needed language(s).
|
||||
|
||||
NOTE: msgfmt, msgmerge and xgettext tools should be available in your PATH.
|
||||
|
||||
This steps to update template, translation files and compile them can be made in "batch" mode
|
||||
These steps to update template, translation files and compile them can be made in "batch" mode
|
||||
using GNUMakefile:
|
||||
|
||||
make -f GNUMakefile translations
|
||||
@@ -65,7 +65,7 @@ NOTE: Blender has to be compiled using GNUMakefile first.
|
||||
3. Note for Windows users
|
||||
-------------------------
|
||||
You can find compiled builds of gettext in the lib folder under "binaries\gettext\" for both windows and win64.
|
||||
In order to run the scripts you will need to replace the location of the GETTEXT_..._EXeCUTABLE.
|
||||
In order to run the scripts you will need to replace the location of the GETTEXT_..._EXECUTABLE.
|
||||
|
||||
For example in update_pot.py:
|
||||
-GETTEXT_XGETTEXT_EXECUTABLE = "xgettext"
|
||||
@@ -77,5 +77,5 @@ For example in update_pot.py:
|
||||
- check_po.py: this script checks if all messages declared in blender.pot exists in.po files
|
||||
and that no extra messages are declared in .po files
|
||||
- clean_po.py: this script removes all commented messages which aren't required by .pot file anymore.
|
||||
- merge_po.py: this scripts accepts two files as arguments and copies translations from second file
|
||||
- merge_po.py: this script accepts two files as arguments and copies translations from second file
|
||||
into first file.
|
||||
|
||||
@@ -135,10 +135,12 @@ def dump_messages_rna(messages):
|
||||
item.identifier,
|
||||
)
|
||||
# Here identifier and name can be the same!
|
||||
if item.name: # and item.name != item.identifier:
|
||||
messages.setdefault(item.name, []).append(msgsrc)
|
||||
if item.name: # and item.name != item.identifier:
|
||||
messages.setdefault(item.name,
|
||||
[]).append(msgsrc)
|
||||
if item.description:
|
||||
messages.setdefault(item.description, []).append(msgsrc)
|
||||
messages.setdefault(item.description,
|
||||
[]).append(msgsrc)
|
||||
|
||||
def walkRNA(bl_rna):
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 200 KiB After Width: | Height: | Size: 152 KiB |
@@ -165,7 +165,7 @@ def modules(module_cache):
|
||||
if mod:
|
||||
module_cache[mod_name] = mod
|
||||
|
||||
# just incase we get stale modules, not likely
|
||||
# just in case we get stale modules, not likely
|
||||
for mod_stale in modules_stale:
|
||||
del module_cache[mod_stale]
|
||||
del modules_stale
|
||||
@@ -209,7 +209,7 @@ def enable(module_name, default_set=True):
|
||||
|
||||
:arg module_name: The name of the addon and module.
|
||||
:type module_name: string
|
||||
:return: the loaded module or None on failier.
|
||||
:return: the loaded module or None on failure.
|
||||
:rtype: module
|
||||
"""
|
||||
|
||||
@@ -262,7 +262,7 @@ def enable(module_name, default_set=True):
|
||||
|
||||
# * OK loaded successfully! *
|
||||
if default_set:
|
||||
# just incase its enabled alredy
|
||||
# just in case its enabled already
|
||||
ext = _bpy.context.user_preferences.addons.get(module_name)
|
||||
if not ext:
|
||||
ext = _bpy.context.user_preferences.addons.new()
|
||||
@@ -286,7 +286,7 @@ def disable(module_name, default_set=True):
|
||||
import sys
|
||||
mod = sys.modules.get(module_name)
|
||||
|
||||
# possible this addon is from a previous session and didnt load a
|
||||
# possible this addon is from a previous session and didn't load a
|
||||
# module this time. So even if the module is not found, still disable
|
||||
# the addon in the user prefs.
|
||||
if mod:
|
||||
@@ -300,7 +300,7 @@ def disable(module_name, default_set=True):
|
||||
else:
|
||||
print("addon_utils.disable", module_name, "not loaded")
|
||||
|
||||
# could be in more then once, unlikely but better do this just incase.
|
||||
# could be in more then once, unlikely but better do this just in case.
|
||||
addons = _bpy.context.user_preferences.addons
|
||||
|
||||
if default_set:
|
||||
|
||||
@@ -73,7 +73,7 @@ class DataPathBuilder(object):
|
||||
try:
|
||||
print("base." + item_new)
|
||||
base_new = eval("base." + item_new)
|
||||
break # found, dont keep looking
|
||||
break # found, don't keep looking
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ def read_blend_rend_chunk(path):
|
||||
struct.unpack('>i' if is_big_endian else '<i', blendfile.read(4))[0]
|
||||
sizeof_bhead_left -= 4
|
||||
|
||||
# We dont care about the rest of the bhead struct
|
||||
# We don't care about the rest of the bhead struct
|
||||
blendfile.read(sizeof_bhead_left)
|
||||
|
||||
# Now we want the scene name, start and end frame. this is 32bites long
|
||||
|
||||
@@ -56,7 +56,7 @@ def main():
|
||||
# from bpy.types import Panel
|
||||
sys.modules["bpy.types"] = types
|
||||
|
||||
# if "-d" in sys.argv: # Enable this to measure startup speed
|
||||
#~ if "-d" in sys.argv: # Enable this to measure start up speed
|
||||
if 0:
|
||||
import cProfile
|
||||
cProfile.run('import bpy; bpy.utils.load_scripts()', 'blender.prof')
|
||||
|
||||
@@ -138,7 +138,7 @@ class BPyOpsSubModOp(object):
|
||||
@staticmethod
|
||||
def _scene_update(context):
|
||||
scene = context.scene
|
||||
if scene: # None in backgroud mode
|
||||
if scene: # None in background mode
|
||||
scene.update()
|
||||
else:
|
||||
import bpy
|
||||
|
||||
@@ -40,7 +40,7 @@ import bpy as _bpy
|
||||
import os as _os
|
||||
|
||||
|
||||
def abspath(path, start=None):
|
||||
def abspath(path, start=None, library=None):
|
||||
"""
|
||||
Returns the absolute path relative to the current blend file
|
||||
using the "//" prefix.
|
||||
@@ -48,8 +48,13 @@ def abspath(path, start=None):
|
||||
:arg start: Relative to this path,
|
||||
when not set the current filename is used.
|
||||
:type start: string
|
||||
:arg library: The library this path is from. This is only included for
|
||||
convenience, when the library is not None its path replaces *start*.
|
||||
:type library: :class:`bpy.types.Library`
|
||||
"""
|
||||
if path.startswith("//"):
|
||||
if library:
|
||||
start = abspath(_os.path.dirname(library.filepath))
|
||||
return _os.path.join(_os.path.dirname(_bpy.data.filepath)
|
||||
if start is None else start,
|
||||
path[2:],
|
||||
@@ -263,7 +268,7 @@ def module_names(path, recursive=False):
|
||||
|
||||
def basename(path):
|
||||
"""
|
||||
Equivalent to os.path.basename, but skips a "//" suffix.
|
||||
Equivalent to os.path.basename, but skips a "//" prefix.
|
||||
|
||||
Use for Windows compatibility.
|
||||
"""
|
||||
|
||||
@@ -142,9 +142,9 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
|
||||
if reload_scripts:
|
||||
_bpy_types.TypeMap.clear()
|
||||
|
||||
# just unload, dont change user defaults, this means we can sync
|
||||
# just unload, don't change user defaults, this means we can sync
|
||||
# to reload. note that they will only actually reload of the
|
||||
# modification time changes. This `wont` work for packages so...
|
||||
# modification time changes. This `won't` work for packages so...
|
||||
# its not perfect.
|
||||
for module_name in [ext.module for ext in prefs.addons]:
|
||||
_addon_utils.disable(module_name, default_set=False)
|
||||
@@ -220,7 +220,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
|
||||
if _os.path.isdir(path):
|
||||
_sys_path_ensure(path)
|
||||
|
||||
# only add this to sys.modules, dont run
|
||||
# only add this to sys.modules, don't run
|
||||
if path_subdir == "modules":
|
||||
continue
|
||||
|
||||
@@ -374,7 +374,7 @@ def smpte_from_seconds(time, fps=None):
|
||||
if time >= 3600.0: # hours
|
||||
hours = int(time / 3600.0)
|
||||
time = time % 3600.0
|
||||
if time >= 60.0: # mins
|
||||
if time >= 60.0: # minutes
|
||||
minutes = int(time / 60.0)
|
||||
time = time % 60.0
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ def bake_action(frame_start,
|
||||
# -------------------------------------------------------------------------
|
||||
# Create action
|
||||
|
||||
# incase animation data hassnt been created
|
||||
# in case animation data hassnt been created
|
||||
atd = obj.animation_data_create()
|
||||
if action is None:
|
||||
action = bpy.data.actions.new("Action")
|
||||
|
||||
@@ -43,10 +43,10 @@ def load_image(imagepath,
|
||||
the end will be ignored.
|
||||
:type dirname: string
|
||||
:arg place_holder: if True a new place holder image will be created.
|
||||
this is usefull so later you can relink the image to its original data.
|
||||
this is useful so later you can relink the image to its original data.
|
||||
:type place_holder: bool
|
||||
:arg recursive: If True, directories will be recursivly searched.
|
||||
Be carefull with this if you have files in your root directory because
|
||||
:arg recursive: If True, directories will be recursively searched.
|
||||
Be careful with this if you have files in your root directory because
|
||||
it may take a long time.
|
||||
:type recursive: bool
|
||||
:arg ncase_cmp: on non windows systems, find the correct case for the file.
|
||||
|
||||
@@ -114,7 +114,7 @@ class ImportHelper:
|
||||
|
||||
|
||||
# Axis conversion function, not pretty LUT
|
||||
# use lookup tabes to convert between any axis
|
||||
# use lookup table to convert between any axis
|
||||
_axis_convert_matrix = (
|
||||
((-1.0, 0.0, 0.0), (0.0, -1.0, 0.0), (0.0, 0.0, 1.0)),
|
||||
((-1.0, 0.0, 0.0), (0.0, 0.0, -1.0), (0.0, -1.0, 0.0)),
|
||||
@@ -302,7 +302,7 @@ def free_derived_objects(ob):
|
||||
|
||||
def unpack_list(list_of_tuples):
|
||||
flat_list = []
|
||||
flat_list_extend = flat_list.extend # a tich faster
|
||||
flat_list_extend = flat_list.extend # a tiny bit faster
|
||||
for t in list_of_tuples:
|
||||
flat_list_extend(t)
|
||||
return flat_list
|
||||
@@ -318,7 +318,7 @@ def unpack_face_list(list_of_tuples):
|
||||
if len(t) == 3:
|
||||
if t[2] == 0:
|
||||
t = t[1], t[2], t[0]
|
||||
else: # assuem quad
|
||||
else: # assume quad
|
||||
if t[3] == 0 or t[2] == 0:
|
||||
t = t[2], t[3], t[0], t[1]
|
||||
|
||||
@@ -350,6 +350,7 @@ def path_reference(filepath,
|
||||
mode='AUTO',
|
||||
copy_subdir="",
|
||||
copy_set=None,
|
||||
library=None,
|
||||
):
|
||||
"""
|
||||
Return a filepath relative to a destination directory, for use with
|
||||
@@ -370,14 +371,17 @@ def path_reference(filepath,
|
||||
:arg copy_subdir: the subdirectory of *base_dst* to use when mode='COPY'.
|
||||
:type copy_subdir: string
|
||||
:arg copy_set: collect from/to pairs when mode='COPY',
|
||||
pass to *path_reference_copy* when exportign is done.
|
||||
pass to *path_reference_copy* when exporting is done.
|
||||
:type copy_set: set
|
||||
:arg library: The library this path is relative to.
|
||||
:type library: :class:`bpy.types.Library` or None
|
||||
:return: the new filepath.
|
||||
:rtype: string
|
||||
"""
|
||||
import os
|
||||
is_relative = filepath.startswith("//")
|
||||
filepath_abs = os.path.normpath(bpy.path.abspath(filepath, base_src))
|
||||
filepath_abs = bpy.path.abspath(filepath, base_src, library)
|
||||
filepath_abs = os.path.normpath(filepath_abs)
|
||||
|
||||
if mode in {'ABSOLUTE', 'RELATIVE', 'STRIP'}:
|
||||
pass
|
||||
@@ -385,13 +389,12 @@ def path_reference(filepath,
|
||||
mode = 'RELATIVE' if is_relative else 'ABSOLUTE'
|
||||
elif mode == 'AUTO':
|
||||
mode = ('RELATIVE'
|
||||
if bpy.path.is_subdir(filepath, base_dst)
|
||||
if bpy.path.is_subdir(filepath_abs, base_dst)
|
||||
else 'ABSOLUTE')
|
||||
elif mode == 'COPY':
|
||||
subdir_abs = os.path.normpath(base_dst)
|
||||
if copy_subdir:
|
||||
subdir_abs = os.path.join(os.path.normpath(base_dst), copy_subdir)
|
||||
else:
|
||||
subdir_abs = os.path.normpath(base_dst)
|
||||
subdir_abs = os.path.join(subdir_abs, copy_subdir)
|
||||
|
||||
filepath_cpy = os.path.join(subdir_abs, os.path.basename(filepath))
|
||||
|
||||
@@ -447,7 +450,7 @@ def unique_name(key, name, name_dict, name_max=-1, clean_func=None, sep="."):
|
||||
:arg key: unique item this name belongs to, name_dict[key] will be reused
|
||||
when available.
|
||||
This can be the object, mesh, material, etc instance its self.
|
||||
:type key: any hashable object assosiated with the *name*.
|
||||
:type key: any hashable object associated with the *name*.
|
||||
:arg name: The name used to create a unique value in *name_dict*.
|
||||
:type name: string
|
||||
:arg name_dict: This is used to cache namespace to ensure no collisions
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
KM_HIERARCHY = [
|
||||
('Window', 'EMPTY', 'WINDOW', []), # file save, window change, exit
|
||||
('Screen', 'EMPTY', 'WINDOW', [ # full screen, undo, screenshot
|
||||
('Screen Editing', 'EMPTY', 'WINDOW', []), # resizing, action corners
|
||||
('Screen Editing', 'EMPTY', 'WINDOW', []), # re-sizing, action corners
|
||||
]),
|
||||
|
||||
('View2D', 'EMPTY', 'WINDOW', []), # view 2d navigation (per region)
|
||||
|
||||
@@ -50,7 +50,7 @@ def mesh_linked_faces(mesh):
|
||||
face_groups = [[f] for f in mesh.faces]
|
||||
face_mapping = list(range(len(mesh.faces))) # map old, new face location
|
||||
|
||||
# Now clump faces iterativly
|
||||
# Now clump faces iteratively
|
||||
ok = True
|
||||
while ok:
|
||||
ok = False
|
||||
|
||||
@@ -119,7 +119,7 @@ def object_data_add(context, obdata, operator=None):
|
||||
obj_act = scene.objects.active
|
||||
|
||||
# XXX
|
||||
# caused because entering editmodedoes not add a empty undo slot!
|
||||
# caused because entering edit-mode does not add a empty undo slot!
|
||||
if context.user_preferences.edit.use_enter_edit_mode:
|
||||
if not (obj_act and
|
||||
obj_act.mode == 'EDIT' and
|
||||
|
||||
@@ -27,7 +27,7 @@ __all__ = (
|
||||
|
||||
def region_2d_to_vector_3d(region, rv3d, coord):
|
||||
"""
|
||||
Return a direction vector from the viewport at the spesific 2d region
|
||||
Return a direction vector from the viewport at the specific 2d region
|
||||
coordinate.
|
||||
|
||||
:arg region: region of the 3D viewport, typically bpy.context.region.
|
||||
|
||||
@@ -49,7 +49,7 @@ class Library(bpy_types.ID):
|
||||
|
||||
@property
|
||||
def users_id(self):
|
||||
"""ID datablocks which use this library"""
|
||||
"""ID data blocks which use this library"""
|
||||
import bpy
|
||||
|
||||
# See: readblenentry.c, IDTYPE_FLAGS_ISLINKABLE, we could make this an attribute in rna.
|
||||
@@ -220,9 +220,9 @@ class _GenericBone:
|
||||
@property
|
||||
def children_recursive_basename(self):
|
||||
"""
|
||||
Returns a chain of children with the same base name as this bone
|
||||
Only direct chains are supported, forks caused by multiple children with matching basenames will
|
||||
terminate the function and not be returned.
|
||||
Returns a chain of children with the same base name as this bone.
|
||||
Only direct chains are supported, forks caused by multiple children
|
||||
with matching base names will terminate the function and not be returned.
|
||||
"""
|
||||
basename = self.basename
|
||||
chain = []
|
||||
@@ -256,7 +256,7 @@ class _GenericBone:
|
||||
bones = id_data.pose.bones
|
||||
elif id_data_type == bpy_types.Armature:
|
||||
bones = id_data.edit_bones
|
||||
if not bones: # not in editmode
|
||||
if not bones: # not in edit mode
|
||||
bones = id_data.bones
|
||||
|
||||
return bones
|
||||
@@ -284,11 +284,11 @@ class EditBone(StructRNA, _GenericBone, metaclass=StructMetaPropGroup):
|
||||
|
||||
def transform(self, matrix, scale=True, roll=True):
|
||||
"""
|
||||
Transform the the bones head, tail, roll and envalope (when the matrix has a scale component).
|
||||
Transform the the bones head, tail, roll and envelope (when the matrix has a scale component).
|
||||
|
||||
:arg matrix: 3x3 or 4x4 transformation matrix.
|
||||
:type matrix: :class:`mathutils.Matrix`
|
||||
:arg scale: Scale the bone envalope by the matrix.
|
||||
:arg scale: Scale the bone envelope by the matrix.
|
||||
:type scale: bool
|
||||
:arg roll: Correct the roll to point in the same relative direction to the head and tail.
|
||||
:type roll: bool
|
||||
@@ -318,7 +318,7 @@ class Mesh(bpy_types.ID):
|
||||
|
||||
def from_pydata(self, vertices, edges, faces):
|
||||
"""
|
||||
Make a mesh from a list of verts/edges/faces
|
||||
Make a mesh from a list of vertices/edges/faces
|
||||
Until we have a nicer way to make geometry, use this.
|
||||
|
||||
:arg vertices: float triplets each representing (X, Y, Z) eg: [(0.0, 1.0, 0.5), ...].
|
||||
@@ -553,7 +553,7 @@ class _GenericUI:
|
||||
operator_context_default = self.layout.operator_context
|
||||
|
||||
for func in draw_ls._draw_funcs:
|
||||
# so bad menu functions dont stop the entire menu from drawing.
|
||||
# so bad menu functions don't stop the entire menu from drawing
|
||||
try:
|
||||
func(self, context)
|
||||
except:
|
||||
|
||||
@@ -50,7 +50,7 @@ def replace_help(namespace):
|
||||
def get_console(console_id):
|
||||
'''
|
||||
helper function for console operators
|
||||
currently each text datablock gets its own
|
||||
currently each text data block gets its own
|
||||
console - code.InteractiveConsole()
|
||||
...which is stored in this function.
|
||||
|
||||
@@ -65,7 +65,7 @@ def get_console(console_id):
|
||||
consoles = get_console.consoles = {}
|
||||
get_console.consoles_namespace_hash = hash_next
|
||||
else:
|
||||
# check if clearning the namespace is needed to avoid a memory leak.
|
||||
# check if clearing the namespace is needed to avoid a memory leak.
|
||||
# the window manager is normally loaded with new blend files
|
||||
# so this is a reasonable way to deal with namespace clearing.
|
||||
# bpy.data hashing is reset by undo so cant be used.
|
||||
@@ -135,7 +135,7 @@ def execute(context):
|
||||
sys.stdout = stdout
|
||||
sys.stderr = stderr
|
||||
|
||||
# dont allow the stdin to be used, can lock blender.
|
||||
# don't allow the stdin to be used, can lock blender.
|
||||
stdin_backup = sys.stdin
|
||||
sys.stdin = None
|
||||
|
||||
@@ -143,14 +143,14 @@ def execute(context):
|
||||
main_mod_back = sys.modules["__main__"]
|
||||
sys.modules["__main__"] = console._bpy_main_mod
|
||||
|
||||
# incase exception happens
|
||||
line = "" # incase of encodingf error
|
||||
# in case exception happens
|
||||
line = "" # in case of encoding error
|
||||
is_multiline = False
|
||||
|
||||
try:
|
||||
line = line_object.body
|
||||
|
||||
# run the console, "\n" executes a multiline statement
|
||||
# run the console, "\n" executes a multi line statement
|
||||
line_exec = line if line.strip() else "\n"
|
||||
|
||||
is_multiline = console.push(line_exec)
|
||||
@@ -222,8 +222,8 @@ def autocomplete(context):
|
||||
if not console:
|
||||
return {'CANCELLED'}
|
||||
|
||||
# dont allow the stdin to be used, can lock blender.
|
||||
# note: unlikely stdin would be used for autocomp. but its possible.
|
||||
# don't allow the stdin to be used, can lock blender.
|
||||
# note: unlikely stdin would be used for autocomplete. but its possible.
|
||||
stdin_backup = sys.stdin
|
||||
sys.stdin = None
|
||||
|
||||
@@ -238,8 +238,8 @@ def autocomplete(context):
|
||||
current_line = sc.history[-1]
|
||||
line = current_line.body
|
||||
|
||||
# This function isnt aware of the text editor or being an operator
|
||||
# just does the autocomp then copy its results back
|
||||
# This function isn't aware of the text editor or being an operator
|
||||
# just does the autocomplete then copy its results back
|
||||
result = intellisense.expand(
|
||||
line=line,
|
||||
cursor=current_line.current_character,
|
||||
@@ -250,7 +250,7 @@ def autocomplete(context):
|
||||
current_line.body, current_line.current_character, scrollback = result
|
||||
del result
|
||||
|
||||
# update sel. setting body should really do this!
|
||||
# update selection. setting body should really do this!
|
||||
ofs = len(line_new) - len(line)
|
||||
sc.select_start += ofs
|
||||
sc.select_end += ofs
|
||||
@@ -263,12 +263,12 @@ def autocomplete(context):
|
||||
if _BPY_MAIN_OWN:
|
||||
sys.modules["__main__"] = main_mod_back
|
||||
|
||||
# Separate automplete output by command prompts
|
||||
# Separate autocomplete output by command prompts
|
||||
if scrollback != '':
|
||||
bpy.ops.console.scrollback_append(text=sc.prompt + current_line.body, type='INPUT')
|
||||
|
||||
# Now we need to copy back the line from blender back into the
|
||||
# text editor. This will change when we dont use the text editor
|
||||
# text editor. This will change when we don't use the text editor
|
||||
# anymore
|
||||
if scrollback:
|
||||
add_scrollback(scrollback, 'INFO')
|
||||
|
||||
@@ -64,7 +64,7 @@ def execute(context):
|
||||
|
||||
|
||||
def autocomplete(context):
|
||||
# sc = context.space_data
|
||||
#~ sc = context.space_data
|
||||
# TODO
|
||||
return {'CANCELLED'}
|
||||
|
||||
|
||||
@@ -292,7 +292,7 @@ class InfoPropertyRNA:
|
||||
elif as_arg:
|
||||
if not self.is_required:
|
||||
type_info.append("optional")
|
||||
else: # readonly is only useful for selfs, not args
|
||||
else: # readonly is only useful for self's, not args
|
||||
if self.is_readonly:
|
||||
type_info.append("readonly")
|
||||
|
||||
@@ -519,7 +519,7 @@ def BuildRNAInfo():
|
||||
|
||||
# Done ordering structs
|
||||
|
||||
# precalc vars to avoid a lot of looping
|
||||
# precalculate vars to avoid a lot of looping
|
||||
for (rna_base, identifier, rna_struct) in structs:
|
||||
|
||||
# rna_struct_path = full_rna_struct_path(rna_struct)
|
||||
@@ -634,7 +634,7 @@ if __name__ == "__main__":
|
||||
struct = rna_info.BuildRNAInfo()[0]
|
||||
data = []
|
||||
for struct_id, v in sorted(struct.items()):
|
||||
struct_id_str = v.identifier # "".join(sid for sid in struct_id if struct_id)
|
||||
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
|
||||
|
||||
@@ -87,7 +87,7 @@ class ANIM_OT_keying_set_export(Operator):
|
||||
# --------------------------------------------------------
|
||||
# generate and write set of lookups for id's used in paths
|
||||
|
||||
# cache for syncing ID-blocks to bpy paths + shorthands
|
||||
# cache for syncing ID-blocks to bpy paths + shorthand's
|
||||
id_to_paths_cache = {}
|
||||
|
||||
for ksp in ks.paths:
|
||||
|
||||
@@ -62,7 +62,7 @@ class ConsoleAutocomplete(Operator):
|
||||
|
||||
|
||||
class ConsoleBanner(Operator):
|
||||
'''Print a message whem the terminal initializes'''
|
||||
'''Print a message when the terminal initializes'''
|
||||
bl_idname = "console.banner"
|
||||
bl_label = "Console Banner"
|
||||
|
||||
@@ -97,7 +97,7 @@ class ConsoleLanguage(Operator):
|
||||
def execute(self, context):
|
||||
sc = context.space_data
|
||||
|
||||
# defailt to python
|
||||
# default to python
|
||||
sc.language = self.language
|
||||
|
||||
bpy.ops.console.banner()
|
||||
|
||||
@@ -69,8 +69,6 @@ class EditExternally(Operator):
|
||||
self.report({'ERROR'}, "Image path not set")
|
||||
return {'CANCELLED'}
|
||||
|
||||
filepath = os.path.normpath(bpy.path.abspath(filepath))
|
||||
|
||||
if not os.path.exists(filepath):
|
||||
self.report({'ERROR'},
|
||||
"Image path %r not found, image may be packed or "
|
||||
@@ -93,15 +91,16 @@ class EditExternally(Operator):
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
import os
|
||||
try:
|
||||
filepath = context.space_data.image.filepath
|
||||
except:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
self.report({'ERROR'}, "Image not found on disk")
|
||||
image = context.space_data.image
|
||||
except AttributeError:
|
||||
self.report({'ERROR'}, "Context incorrect, image not found")
|
||||
return {'CANCELLED'}
|
||||
|
||||
self.filepath = filepath
|
||||
filepath = bpy.path.abspath(image.filepath, library=image.library)
|
||||
|
||||
self.filepath = os.path.normpath(filepath)
|
||||
self.execute(context)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
@@ -174,7 +174,7 @@ class SelectHierarchy(Operator):
|
||||
select_new.sort(key=lambda obj_iter: obj_iter.name)
|
||||
act_new = select_new[0]
|
||||
|
||||
# dont edit any object settings above this
|
||||
# don't edit any object settings above this
|
||||
if select_new:
|
||||
if not self.extend:
|
||||
bpy.ops.object.select_all(action='DESELECT')
|
||||
@@ -331,7 +331,7 @@ class ShapeTransfer(Operator):
|
||||
orig_shape_coords = me_cos(ob_act.active_shape_key.data)
|
||||
|
||||
orig_normals = me_nos(me.vertices)
|
||||
# the actual mverts location isnt as relyable as the base shape :S
|
||||
# the actual mverts location isn't as reliable as the base shape :S
|
||||
# orig_coords = me_cos(me.vertices)
|
||||
orig_coords = me_cos(me.shape_keys.key_blocks[0].data)
|
||||
|
||||
@@ -721,8 +721,8 @@ class TransformsToDeltasAnim(Operator):
|
||||
fcu.data_path = "delta_rotation_quaternion"
|
||||
obj.rotation_quaternion.identity()
|
||||
# XXX: currently not implemented
|
||||
# elif fcu.data_path == "rotation_axis_angle":
|
||||
# fcu.data_path = "delta_rotation_axis_angle"
|
||||
#~ elif fcu.data_path == "rotation_axis_angle":
|
||||
#~ fcu.data_path = "delta_rotation_axis_angle"
|
||||
elif fcu.data_path == "scale":
|
||||
fcu.data_path = "delta_scale"
|
||||
obj.scale = 1.0, 1.0, 1.0
|
||||
|
||||
@@ -104,13 +104,13 @@ def extend(obj, operator, EXTEND_MODE):
|
||||
uvs_vhash_target[edgepair_inner_target[1]][:] = uvs_vhash_source[edgepair_inner_source[iB]]
|
||||
|
||||
# Set the 2 UV's on the target face that are not touching
|
||||
# for this we need to do basic expaning on the source faces UV's
|
||||
# for this we need to do basic expanding on the source faces UV's
|
||||
if EXTEND_MODE == 'LENGTH':
|
||||
|
||||
try: # divide by zero is possible
|
||||
'''
|
||||
measure the length of each face from the middle of each edge to the opposite
|
||||
allong the axis we are copying, use this
|
||||
along the axis we are copying, use this
|
||||
'''
|
||||
i1a = edgepair_outer_target[iB]
|
||||
i2a = edgepair_inner_target[iA]
|
||||
@@ -158,11 +158,11 @@ def extend(obj, operator, EXTEND_MODE):
|
||||
# Modes
|
||||
# 0 unsearched
|
||||
# 1:mapped, use search from this face. - removed!!
|
||||
# 2:all siblings have been searched. dont search again.
|
||||
# 2:all siblings have been searched. don't search again.
|
||||
face_modes = [0] * len(face_sel)
|
||||
face_modes[face_act_local_index] = 1 # extend UV's from this face.
|
||||
|
||||
# Edge connectivty
|
||||
# Edge connectivity
|
||||
edge_faces = {}
|
||||
for i, f in enumerate(face_sel):
|
||||
for edkey in f.edge_keys:
|
||||
@@ -181,7 +181,7 @@ def extend(obj, operator, EXTEND_MODE):
|
||||
looplen[0] += (me_verts[ed[0]].co - me_verts[ed[1]].co).length
|
||||
looplen[0] = looplen[0] / len(loop)
|
||||
|
||||
# remove seams, so we dont map accross seams.
|
||||
# remove seams, so we don't map across seams.
|
||||
for ed in me.edges:
|
||||
if ed.use_seam:
|
||||
# remove the edge pair if we can
|
||||
@@ -213,7 +213,7 @@ def extend(obj, operator, EXTEND_MODE):
|
||||
face_modes[i] = 1 # we can map from this one now.
|
||||
ok = True # keep searching
|
||||
|
||||
face_modes[i] = 2 # dont search again
|
||||
face_modes[i] = 2 # don't search again
|
||||
|
||||
if is_editmode:
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
|
||||
@@ -36,7 +36,7 @@ class prettyface(object):
|
||||
|
||||
def __init__(self, data):
|
||||
self.has_parent = False
|
||||
self.rot = False # only used for triables
|
||||
self.rot = False # only used for triangles
|
||||
self.xoff = 0
|
||||
self.yoff = 0
|
||||
|
||||
@@ -157,7 +157,7 @@ class prettyface(object):
|
||||
angles_co.sort()
|
||||
I = [i for a, i in angles_co]
|
||||
|
||||
# fuv = f.uv
|
||||
#~ fuv = f.uv
|
||||
fuv = f.id_data.uv_textures.active.data[f.index].uv # XXX25
|
||||
|
||||
if self.rot:
|
||||
@@ -200,8 +200,8 @@ def lightmap_uvpack(meshes,
|
||||
'''
|
||||
BOX_DIV if the maximum division of the UV map that
|
||||
a box may be consolidated into.
|
||||
Basicly, a lower value will be slower but waist less space
|
||||
and a higher value will have more clumpy boxes but more waisted space
|
||||
Basically, a lower value will be slower but waist less space
|
||||
and a higher value will have more clumpy boxes but more wasted space
|
||||
'''
|
||||
import time
|
||||
from math import sqrt
|
||||
@@ -321,7 +321,7 @@ def lightmap_uvpack(meshes,
|
||||
lengths.append(curr_len)
|
||||
curr_len = curr_len / 2.0
|
||||
|
||||
# Dont allow boxes smaller then the margin
|
||||
# Don't allow boxes smaller then the margin
|
||||
# since we contract on the margin, boxes that are smaller will create errors
|
||||
# print(curr_len, side_len/MARGIN_DIV)
|
||||
if curr_len / 4.0 < side_len / PREF_MARGIN_DIV:
|
||||
@@ -371,9 +371,9 @@ def lightmap_uvpack(meshes,
|
||||
print("...done")
|
||||
|
||||
# Since the boxes are sized in powers of 2, we can neatly group them into bigger squares
|
||||
# this is done hierarchily, so that we may avoid running the pack function
|
||||
# this is done hierarchically, so that we may avoid running the pack function
|
||||
# on many thousands of boxes, (under 1k is best) because it would get slow.
|
||||
# Using an off and even dict us usefull because they are packed differently
|
||||
# Using an off and even dict us useful because they are packed differently
|
||||
# where w/h are the same, their packed in groups of 4
|
||||
# where they are different they are packed in pairs
|
||||
#
|
||||
@@ -393,14 +393,14 @@ def lightmap_uvpack(meshes,
|
||||
# Count the number of boxes consolidated, only used for stats.
|
||||
c = 0
|
||||
|
||||
# This is tricky. the total area of all packed boxes, then squt that to get an estimated size
|
||||
# This is tricky. the total area of all packed boxes, then sqrt() that to get an estimated size
|
||||
# this is used then converted into out INT space so we can compare it with
|
||||
# the ints assigned to the boxes size
|
||||
# and divided by BOX_DIV, basicly if BOX_DIV is 8
|
||||
# ...then the maximum box consolidataion (recursive grouping) will have a max width & height
|
||||
# and divided by BOX_DIV, basically if BOX_DIV is 8
|
||||
# ...then the maximum box consolidation (recursive grouping) will have a max width & height
|
||||
# ...1/8th of the UV size.
|
||||
# ...limiting this is needed or you end up with bug unused texture spaces
|
||||
# ...however if its too high, boxpacking is way too slow for high poly meshes.
|
||||
# ...however if its too high, box-packing is way too slow for high poly meshes.
|
||||
float_to_int_factor = lengths_to_ints[0][0]
|
||||
if float_to_int_factor > 0:
|
||||
max_int_dimension = int(((side_len / float_to_int_factor)) / PREF_BOX_DIV)
|
||||
@@ -409,7 +409,7 @@ def lightmap_uvpack(meshes,
|
||||
max_int_dimension = 0.0 # wont be used
|
||||
ok = False
|
||||
|
||||
# RECURSIVE prettyface grouping
|
||||
# RECURSIVE pretty face grouping
|
||||
while ok:
|
||||
ok = False
|
||||
|
||||
@@ -456,7 +456,7 @@ def lightmap_uvpack(meshes,
|
||||
|
||||
pretty_faces = [pf for pf in pretty_faces if not pf.has_parent]
|
||||
|
||||
# spin every second prettyface
|
||||
# spin every second pretty-face
|
||||
# if there all vertical you get less efficiently used texture space
|
||||
i = len(pretty_faces)
|
||||
d = 0
|
||||
|
||||
@@ -34,7 +34,7 @@ USER_FILL_HOLES_QUALITY = None
|
||||
def pointInTri2D(v, v1, v2, v3):
|
||||
key = v1.x, v1.y, v2.x, v2.y, v3.x, v3.y
|
||||
|
||||
# Commented because its slower to do the bounds check, we should realy cache the bounds info for each face.
|
||||
# Commented because its slower to do the bounds check, we should really cache the bounds info for each face.
|
||||
'''
|
||||
# BOUNDS CHECK
|
||||
xmin= 1000000
|
||||
@@ -119,7 +119,7 @@ def boundsEdgeLoop(edges):
|
||||
"""
|
||||
|
||||
# Turns the islands into a list of unpordered edges (Non internal)
|
||||
# Onlt for UV's
|
||||
# Only for UV's
|
||||
# only returns outline edges for intersection tests. and unique points.
|
||||
|
||||
def island2Edge(island):
|
||||
@@ -141,7 +141,7 @@ def island2Edge(island):
|
||||
else:
|
||||
i1= vIdx; i2= vIdx-1
|
||||
|
||||
try: edges[ f_uvkey[i1], f_uvkey[i2] ] *= 0 # sets eny edge with more then 1 user to 0 are not returned.
|
||||
try: edges[ f_uvkey[i1], f_uvkey[i2] ] *= 0 # sets any edge with more then 1 user to 0 are not returned.
|
||||
except: edges[ f_uvkey[i1], f_uvkey[i2] ] = (f.uv[i1] - f.uv[i2]).length,
|
||||
|
||||
# If 2 are the same then they will be together, but full [a,b] order is not correct.
|
||||
@@ -162,10 +162,10 @@ def island2Edge(island):
|
||||
return length_sorted_edges, [v.to_3d() for v in unique_points.values()]
|
||||
|
||||
# ========================= NOT WORKING????
|
||||
# Find if a points inside an edge loop, un-orderd.
|
||||
# Find if a points inside an edge loop, un-ordered.
|
||||
# pt is and x/y
|
||||
# edges are a non ordered loop of edges.
|
||||
# #offsets are the edge x and y offset.
|
||||
# offsets are the edge x and y offset.
|
||||
"""
|
||||
def pointInEdges(pt, edges):
|
||||
#
|
||||
@@ -223,7 +223,7 @@ def islandIntersectUvIsland(source, target, SourceOffset):
|
||||
if pointInIsland(pv+SourceOffset, target[0]):
|
||||
return 2 # SOURCE INSIDE TARGET
|
||||
|
||||
# 2 test for a part of the target being totaly inside the source.
|
||||
# 2 test for a part of the target being totally inside the source.
|
||||
for pv in target[7]:
|
||||
if pointInIsland(pv-SourceOffset, source[0]):
|
||||
return 3 # PART OF TARGET INSIDE SOURCE.
|
||||
@@ -242,7 +242,7 @@ def testNewVecLs2DRotIsBetter(vecs, mat=-1, bestAreaSoFar = -1):
|
||||
|
||||
for i, v in enumerate(vecs):
|
||||
|
||||
# Do this allong the way
|
||||
# Do this along the way
|
||||
if mat != -1:
|
||||
v = vecs[i] = mat * v
|
||||
x= v.x
|
||||
@@ -252,7 +252,7 @@ def testNewVecLs2DRotIsBetter(vecs, mat=-1, bestAreaSoFar = -1):
|
||||
if x>maxx: maxx= x
|
||||
if y>maxy: maxy= y
|
||||
|
||||
# Spesific to this algo, bail out if we get bigger then the current area
|
||||
# Specific to this algo, bail out if we get bigger then the current area
|
||||
if bestAreaSoFar != -1 and (maxx-minx) * (maxy-miny) > bestAreaSoFar:
|
||||
return (BIG_NUM, None), None
|
||||
w = maxx-minx
|
||||
@@ -262,7 +262,7 @@ def testNewVecLs2DRotIsBetter(vecs, mat=-1, bestAreaSoFar = -1):
|
||||
def optiRotateUvIsland(faces):
|
||||
global currentArea
|
||||
|
||||
# Bestfit Rotation
|
||||
# Best-fit Rotation
|
||||
def best2dRotation(uvVecs, MAT1, MAT2):
|
||||
global currentArea
|
||||
|
||||
@@ -318,7 +318,7 @@ def optiRotateUvIsland(faces):
|
||||
currentArea = newAreaPos
|
||||
# 45d done
|
||||
|
||||
# Testcase different rotations and find the onfe that best fits in a square
|
||||
# Testcase different rotations and find the one that best fits in a square
|
||||
for ROTMAT in RotMatStepRotation:
|
||||
uvVecs = best2dRotation(uvVecs, ROTMAT[0], ROTMAT[1])
|
||||
|
||||
@@ -409,7 +409,7 @@ def mergeUvIslands(islandList):
|
||||
BREAK= False
|
||||
while areaIslandIdx < len(decoratedIslandListAreaSort) and not BREAK:
|
||||
sourceIsland = decoratedIslandListAreaSort[areaIslandIdx]
|
||||
# Alredy packed?
|
||||
# Already packed?
|
||||
if not sourceIsland[0]:
|
||||
areaIslandIdx+=1
|
||||
else:
|
||||
@@ -420,7 +420,7 @@ def mergeUvIslands(islandList):
|
||||
BREAK= True
|
||||
break
|
||||
|
||||
# Now we have 2 islands, is the efficience of the islands lowers theres an
|
||||
# Now we have 2 islands, if the efficiency of the islands lowers theres an
|
||||
# increasing likely hood that we can fit merge into the bigger UV island.
|
||||
# this ensures a tight fit.
|
||||
|
||||
@@ -435,12 +435,12 @@ def mergeUvIslands(islandList):
|
||||
pass
|
||||
else:
|
||||
|
||||
# ([island, totFaceArea, efficiency, islandArea, w,h])
|
||||
# Waisted space on target is greater then UV bounding island area.
|
||||
#~ ([island, totFaceArea, efficiency, islandArea, w,h])
|
||||
# Wasted space on target is greater then UV bounding island area.
|
||||
|
||||
|
||||
# if targetIsland[3] > (sourceIsland[2]) and\ #
|
||||
# print USER_FREE_SPACE_TO_TEST_QUALITY
|
||||
#~ if targetIsland[3] > (sourceIsland[2]) and\ #
|
||||
#~ print USER_FREE_SPACE_TO_TEST_QUALITY
|
||||
if targetIsland[2] > (sourceIsland[1] * USER_FREE_SPACE_TO_TEST_QUALITY) and\
|
||||
targetIsland[4] > sourceIsland[4] and\
|
||||
targetIsland[5] > sourceIsland[5]:
|
||||
@@ -456,7 +456,7 @@ def mergeUvIslands(islandList):
|
||||
boxLeft = 0
|
||||
|
||||
|
||||
# Distllllance we can move between whilst staying inside the targets bounds.
|
||||
# Distance we can move between whilst staying inside the targets bounds.
|
||||
testWidth = targetIsland[4] - sourceIsland[4]
|
||||
testHeight = targetIsland[5] - sourceIsland[5]
|
||||
|
||||
@@ -474,25 +474,25 @@ def mergeUvIslands(islandList):
|
||||
boxLeft = 0 # Start 1 back so we can jump into the loop.
|
||||
boxBottom= 0 #-yIncrement
|
||||
|
||||
##testcount= 0
|
||||
#~ testcount= 0
|
||||
|
||||
while boxBottom <= testHeight:
|
||||
# Should we use this? - not needed for now.
|
||||
#if Window.GetKeyQualifiers() & ctrl:
|
||||
# BREAK= True
|
||||
# break
|
||||
#~ if Window.GetKeyQualifiers() & ctrl:
|
||||
#~ BREAK= True
|
||||
#~ break
|
||||
|
||||
##testcount+=1
|
||||
#print 'Testing intersect'
|
||||
Intersect = islandIntersectUvIsland(sourceIsland, targetIsland, Vector((boxLeft, boxBottom)))
|
||||
#print 'Done', Intersect
|
||||
if Intersect == 1: # Line intersect, dont bother with this any more
|
||||
if Intersect == 1: # Line intersect, don't bother with this any more
|
||||
pass
|
||||
|
||||
if Intersect == 2: # Source inside target
|
||||
'''
|
||||
We have an intersection, if we are inside the target
|
||||
then move us 1 whole width accross,
|
||||
then move us 1 whole width across,
|
||||
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 already tested for it.
|
||||
@@ -500,7 +500,7 @@ def mergeUvIslands(islandList):
|
||||
It gives about 10% speedup with minimal errors.
|
||||
'''
|
||||
#print 'ass'
|
||||
# Move the test allong its width + SMALL_NUM
|
||||
# Move the test along its width + SMALL_NUM
|
||||
#boxLeft += sourceIsland[4] + SMALL_NUM
|
||||
boxLeft += sourceIsland[4]
|
||||
elif Intersect == 0: # No intersection?? Place it.
|
||||
@@ -551,7 +551,7 @@ def mergeUvIslands(islandList):
|
||||
break
|
||||
|
||||
|
||||
# INCREMENR NEXT LOCATION
|
||||
# INCREMENT NEXT LOCATION
|
||||
if boxLeft > testWidth:
|
||||
boxBottom += yIncrement
|
||||
boxLeft = 0.0
|
||||
@@ -572,8 +572,8 @@ def mergeUvIslands(islandList):
|
||||
# Takes groups of faces. assumes face groups are UV groups.
|
||||
def getUvIslands(faceGroups, me):
|
||||
|
||||
# Get seams so we dont cross over seams
|
||||
edge_seams = {} # shoudl be a set
|
||||
# Get seams so we don't cross over seams
|
||||
edge_seams = {} # should be a set
|
||||
for ed in me.edges:
|
||||
if ed.use_seam:
|
||||
edge_seams[ed.key] = None # dummy var- use sets!
|
||||
@@ -609,7 +609,7 @@ def getUvIslands(faceGroups, me):
|
||||
# Modes
|
||||
# 0 - face not yet touched.
|
||||
# 1 - added to island list, and need to search
|
||||
# 2 - touched and searched - dont touch again.
|
||||
# 2 - touched and searched - don't touch again.
|
||||
face_modes = [0] * len(faces) # initialize zero - untested.
|
||||
|
||||
face_modes[0] = 1 # start the search with face 1
|
||||
@@ -633,7 +633,7 @@ def getUvIslands(faceGroups, me):
|
||||
face_modes[ii] = ok = 1 # mark as searched
|
||||
newIsland.append(faces[ii])
|
||||
|
||||
# mark as searched, dont look again.
|
||||
# mark as searched, don't look again.
|
||||
face_modes[i] = 2
|
||||
|
||||
islandList.append(newIsland)
|
||||
@@ -664,8 +664,8 @@ def packIslands(islandList):
|
||||
|
||||
# Now we have UV islands, we need to pack them.
|
||||
|
||||
# Make a synchronised list with the islands
|
||||
# so we can box pak the islands.
|
||||
# Make a synchronized list with the islands
|
||||
# so we can box pack the islands.
|
||||
packBoxes = []
|
||||
|
||||
# Keep a list of X/Y offset so we can save time by writing the
|
||||
@@ -716,14 +716,14 @@ def packIslands(islandList):
|
||||
# print 'Box Packing Time:', time.time() - time1
|
||||
|
||||
#if len(pa ckedLs) != len(islandList):
|
||||
# raise "Error packed boxes differes from original length"
|
||||
# raise "Error packed boxes differs from original length"
|
||||
|
||||
#print '\tWriting Packed Data to faces'
|
||||
#XXX Window.DrawProgressBar(0.8, 'Writing Packed Data to faces')
|
||||
|
||||
# Sort by ID, so there in sync again
|
||||
islandIdx = len(islandList)
|
||||
# Having these here avoids devide by 0
|
||||
# Having these here avoids divide by 0
|
||||
if islandIdx:
|
||||
|
||||
if USER_STRETCH_ASPECT:
|
||||
@@ -845,9 +845,9 @@ def main(context,
|
||||
time.sleep(10)
|
||||
'''
|
||||
|
||||
#XXX if not Draw.PupBlock(ob % len(obList), pup_block):
|
||||
#XXX return
|
||||
#XXX del ob
|
||||
#~ XXX if not Draw.PupBlock(ob % len(obList), pup_block):
|
||||
#~ XXX return
|
||||
#~ XXX del ob
|
||||
|
||||
# Convert from being button types
|
||||
|
||||
@@ -859,10 +859,10 @@ def main(context,
|
||||
is_editmode = (context.active_object.mode == 'EDIT')
|
||||
if is_editmode:
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
# Assume face select mode! an annoying hack to toggle face select mode because Mesh dosent like faceSelectMode.
|
||||
# Assume face select mode! an annoying hack to toggle face select mode because Mesh doesn't like faceSelectMode.
|
||||
|
||||
if USER_SHARE_SPACE:
|
||||
# Sort by data name so we get consistant results
|
||||
# Sort by data name so we get consistent results
|
||||
obList.sort(key = lambda ob: ob.data.name)
|
||||
collected_islandList= []
|
||||
|
||||
@@ -870,7 +870,7 @@ def main(context,
|
||||
|
||||
time1 = time.time()
|
||||
|
||||
# Tag as False se we dont operate on the same mesh twice.
|
||||
# Tag as False so we don't operate on the same mesh twice.
|
||||
#XXX bpy.data.meshes.tag = False
|
||||
for me in bpy.data.meshes:
|
||||
me.tag = False
|
||||
@@ -885,7 +885,7 @@ def main(context,
|
||||
# Tag as used
|
||||
me.tag = True
|
||||
|
||||
if not me.uv_textures: # Mesh has no UV Coords, dont bother.
|
||||
if not me.uv_textures: # Mesh has no UV Coords, don't bother.
|
||||
me.uv_textures.new()
|
||||
|
||||
uv_layer = me.uv_textures.active.data
|
||||
@@ -902,7 +902,7 @@ def main(context,
|
||||
#XXX Window.DrawProgressBar(0.1, 'SmartProj UV Unwrapper, mapping "%s", %i faces.' % (me.name, len(meshFaces)))
|
||||
|
||||
# =======
|
||||
# Generate a projection list from face normals, this is ment to be smart :)
|
||||
# Generate a projection list from face normals, this is meant to be smart :)
|
||||
|
||||
# make a list of face props that are in sync with meshFaces
|
||||
# Make a Face List that is sorted by area.
|
||||
@@ -928,7 +928,7 @@ def main(context,
|
||||
# Initialize projectVecs
|
||||
if USER_VIEW_INIT:
|
||||
# Generate Projection
|
||||
projectVecs = [Vector(Window.GetViewVector()) * ob.matrix_world.inverted().to_3x3()] # We add to this allong the way
|
||||
projectVecs = [Vector(Window.GetViewVector()) * ob.matrix_world.inverted().to_3x3()] # We add to this along the way
|
||||
else:
|
||||
projectVecs = []
|
||||
|
||||
@@ -936,7 +936,7 @@ def main(context,
|
||||
newProjectMeshFaces = [] # Popping stuffs it up.
|
||||
|
||||
|
||||
# Predent that the most unique angke is ages away to start the loop off
|
||||
# Pretend that the most unique angle is ages away to start the loop off
|
||||
mostUniqueAngle = -1.0
|
||||
|
||||
# This is popped
|
||||
@@ -950,7 +950,7 @@ def main(context,
|
||||
|
||||
# add all the faces that are close.
|
||||
for fIdx in range(len(tempMeshFaces)-1, -1, -1):
|
||||
# Use half the angle limit so we dont overweight faces towards this
|
||||
# Use half the angle limit so we don't overweight faces towards this
|
||||
# normal and hog all the faces.
|
||||
if newProjectVec.dot(tempMeshFaces[fIdx].no) > USER_PROJECTION_LIMIT_HALF_CONVERTED:
|
||||
newProjectMeshFaces.append(tempMeshFaces.pop(fIdx))
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# 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 LICENCE BLOCK *****
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
# <pep8 compliant>
|
||||
@@ -69,7 +69,7 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean,
|
||||
|
||||
vec /= tot_con
|
||||
|
||||
# angle is the acos of the dot product between vert and connected verts normals
|
||||
# angle is the acos() of the dot product between vert and connected verts normals
|
||||
ang = acos(no.dot(vec))
|
||||
|
||||
# enforce min/max
|
||||
|
||||
@@ -33,7 +33,7 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(Operator):
|
||||
|
||||
totface = mesh.total_face_sel
|
||||
totedge = mesh.total_edge_sel
|
||||
# totvert = mesh.total_vert_sel
|
||||
#~ totvert = mesh.total_vert_sel
|
||||
|
||||
if select_mode[2] and totface == 1:
|
||||
bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN',
|
||||
@@ -65,7 +65,7 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
|
||||
|
||||
totface = mesh.total_face_sel
|
||||
totedge = mesh.total_edge_sel
|
||||
# totvert = mesh.total_vert_sel
|
||||
#~ totvert = mesh.total_vert_sel
|
||||
|
||||
if totface >= 1:
|
||||
bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN',
|
||||
|
||||
@@ -70,7 +70,7 @@ def context_path_validate(context, data_path):
|
||||
# One of the items in the rna path is None, just ignore this
|
||||
value = Ellipsis
|
||||
else:
|
||||
# We have a real error in the rna path, dont ignore that
|
||||
# We have a real error in the rna path, don't ignore that
|
||||
raise
|
||||
|
||||
return value
|
||||
@@ -103,7 +103,7 @@ def operator_value_is_undo(value):
|
||||
|
||||
def operator_path_is_undo(context, data_path):
|
||||
# note that if we have data paths that use strings this could fail
|
||||
# luckily we dont do this!
|
||||
# luckily we don't do this!
|
||||
#
|
||||
# When we cant find the data owner assume no undo is needed.
|
||||
data_path_head, data_path_sep, data_path_tail = data_path.rpartition(".")
|
||||
@@ -425,7 +425,7 @@ class WM_OT_context_cycle_enum(Operator):
|
||||
rna_struct_str, rna_prop_str = data_path.rsplit('.', 1)
|
||||
i = rna_prop_str.find('[')
|
||||
|
||||
# just incse we get "context.foo.bar[0]"
|
||||
# just in case we get "context.foo.bar[0]"
|
||||
if i != -1:
|
||||
rna_prop_str = rna_prop_str[0:i]
|
||||
|
||||
@@ -820,8 +820,7 @@ class WM_OT_doc_view(Operator):
|
||||
class_name = rna_parent.identifier
|
||||
rna_parent = rna_parent.base
|
||||
|
||||
# It so happens that epydoc nests these, not sphinx
|
||||
# class_name_full = self._nested_class_string(class_name)
|
||||
#~ class_name_full = self._nested_class_string(class_name)
|
||||
url = ("%s/bpy.types.%s.html#bpy.types.%s.%s" %
|
||||
(self._prefix, class_name, class_name, class_prop))
|
||||
|
||||
@@ -1014,7 +1013,7 @@ class WM_OT_properties_edit(Operator):
|
||||
item = eval("context.%s" % data_path)
|
||||
|
||||
# setup defaults
|
||||
prop_ui = rna_idprop_ui_prop_get(item, self.property, False) # dont create
|
||||
prop_ui = rna_idprop_ui_prop_get(item, self.property, False) # don't create
|
||||
if prop_ui:
|
||||
self.min = prop_ui.get("min", -1000000000)
|
||||
self.max = prop_ui.get("max", 1000000000)
|
||||
@@ -1162,7 +1161,7 @@ class WM_OT_copy_prev_settings(Operator):
|
||||
elif not os.path.isdir(path_src):
|
||||
self.report({'ERROR'}, "Source path %r exists" % path_src)
|
||||
else:
|
||||
shutil.copytree(path_src, path_dst)
|
||||
shutil.copytree(path_src, path_dst, symlinks=True)
|
||||
|
||||
# in 2.57 and earlier windows installers, system scripts were copied
|
||||
# into the configuration directory, don't want to copy those
|
||||
@@ -1171,7 +1170,7 @@ class WM_OT_copy_prev_settings(Operator):
|
||||
shutil.rmtree(os.path.join(path_dst, 'scripts'))
|
||||
shutil.rmtree(os.path.join(path_dst, 'plugins'))
|
||||
|
||||
# dont loose users work if they open the splash later.
|
||||
# don't loose users work if they open the splash later.
|
||||
if bpy.data.is_saved is bpy.data.is_dirty is False:
|
||||
bpy.ops.wm.read_homefile()
|
||||
else:
|
||||
@@ -1372,9 +1371,9 @@ class WM_OT_keyitem_add(Operator):
|
||||
km = context.keymap
|
||||
|
||||
if km.is_modal:
|
||||
km.keymap_items.new_modal("", 'A', 'PRESS') # kmi
|
||||
km.keymap_items.new_modal("", 'A', 'PRESS') #~ kmi
|
||||
else:
|
||||
km.keymap_items.new("none", 'A', 'PRESS') # kmi
|
||||
km.keymap_items.new("none", 'A', 'PRESS') #~ kmi
|
||||
|
||||
# clear filter and expand keymap so we can see the newly added item
|
||||
if context.space_data.filter_text != "":
|
||||
@@ -1556,7 +1555,7 @@ class WM_OT_addon_install(Operator):
|
||||
pyfile = self.filepath
|
||||
|
||||
if self.target == 'DEFAULT':
|
||||
# dont use bpy.utils.script_paths("addons") because we may not be able to write to it.
|
||||
# don't use bpy.utils.script_paths("addons") because we may not be able to write to it.
|
||||
path_addons = bpy.utils.user_resource('SCRIPTS', "addons", create=True)
|
||||
else:
|
||||
path_addons = bpy.context.user_preferences.filepaths.script_directory
|
||||
@@ -1637,7 +1636,7 @@ class WM_OT_addon_install(Operator):
|
||||
addons_new.discard("modules")
|
||||
|
||||
# disable any addons we may have enabled previously and removed.
|
||||
# this is unlikely but do just incase. bug [#23978]
|
||||
# this is unlikely but do just in case. bug [#23978]
|
||||
for new_addon in addons_new:
|
||||
addon_utils.disable(new_addon)
|
||||
|
||||
@@ -1652,11 +1651,11 @@ class WM_OT_addon_install(Operator):
|
||||
context.window_manager.addon_search = info["name"]
|
||||
break
|
||||
|
||||
# incase a new module path was created to install this addon.
|
||||
# in case a new module path was created to install this addon.
|
||||
bpy.utils.refresh_script_paths()
|
||||
|
||||
# TODO, should not be a warning.
|
||||
# self.report({'WARNING'}, "File installed to '%s'\n" % path_dest)
|
||||
#~ self.report({'WARNING'}, "File installed to '%s'\n" % path_dest)
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
@@ -1699,7 +1698,7 @@ class WM_OT_addon_remove(Operator):
|
||||
self.report('WARNING', "Addon path %r could not be found" % path)
|
||||
return {'CANCELLED'}
|
||||
|
||||
# incase its enabled
|
||||
# in case its enabled
|
||||
addon_utils.disable(self.module)
|
||||
|
||||
import shutil
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
# Generic Panels (Independent of DataType)
|
||||
|
||||
# NOTE:
|
||||
# The specialised panel types are derived in their respective UI modules
|
||||
# dont register these classes since they are only helpers.
|
||||
# The specialized panel types are derived in their respective UI modules
|
||||
# don't register these classes since they are only helpers.
|
||||
|
||||
|
||||
class MotionPathButtonsPanel():
|
||||
|
||||
@@ -214,7 +214,7 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, Panel):
|
||||
layout.prop(pose_marker_active, "name")
|
||||
|
||||
|
||||
# TODO: this panel will soon be depreceated too
|
||||
# TODO: this panel will soon be deprecated deprecated too
|
||||
class DATA_PT_ghost(ArmatureButtonsPanel, Panel):
|
||||
bl_label = "Ghost"
|
||||
|
||||
@@ -301,7 +301,7 @@ class DATA_PT_motion_paths(MotionPathButtonsPanel, Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
# XXX: include posemode check?
|
||||
# XXX: include pose-mode check?
|
||||
return (context.object) and (context.armature)
|
||||
|
||||
def draw(self, context):
|
||||
@@ -324,7 +324,7 @@ class DATA_PT_onion_skinning(OnionSkinButtonsPanel): # , Panel): # inherit from
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
# XXX: include posemode check?
|
||||
# XXX: include pose-mode check?
|
||||
return (context.object) and (context.armature)
|
||||
|
||||
def draw(self, context):
|
||||
|
||||
@@ -189,7 +189,7 @@ class BONE_PT_display(BoneButtonsPanel, Panel):
|
||||
return context.bone
|
||||
|
||||
def draw(self, context):
|
||||
# note. this works ok in editmode but isnt
|
||||
# note. this works ok in edit-mode but isn't
|
||||
# all that useful so disabling for now.
|
||||
layout = self.layout
|
||||
|
||||
|
||||
@@ -259,10 +259,11 @@ class DATA_PT_active_spline(CurveButtonsPanelActive, Panel):
|
||||
if not is_surf:
|
||||
split = layout.split()
|
||||
col = split.column()
|
||||
col.active = (curve.dimensions == '3D')
|
||||
|
||||
col.label(text="Interpolation:")
|
||||
col.prop(act_spline, "tilt_interpolation", text="Tilt")
|
||||
colsub = col.column()
|
||||
colsub.active = (curve.dimensions == '3D')
|
||||
colsub.prop(act_spline, "tilt_interpolation", text="Tilt")
|
||||
col.prop(act_spline, "radius_interpolation", text="Radius")
|
||||
|
||||
layout.prop(act_spline, "use_smooth")
|
||||
|
||||
@@ -87,7 +87,7 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel, Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
# An exception, dont call the parent poll func because
|
||||
# An exception, don't call the parent poll func because
|
||||
# this manages materials for all engine types
|
||||
|
||||
engine = context.scene.render.engine
|
||||
@@ -537,7 +537,7 @@ class MATERIAL_PT_halo(MaterialButtonsPanel, Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
mat = context.material # dont use node material
|
||||
mat = context.material # don't use node material
|
||||
halo = mat.halo
|
||||
|
||||
def number_but(layout, toggle, number, name, color):
|
||||
@@ -595,7 +595,7 @@ class MATERIAL_PT_flare(MaterialButtonsPanel, Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
mat = context.material # dont use node material
|
||||
mat = context.material # don't use node material
|
||||
halo = mat.halo
|
||||
|
||||
layout.active = halo.use_flare_mode
|
||||
@@ -622,7 +622,7 @@ class MATERIAL_PT_game_settings(MaterialButtonsPanel, bpy.types.Panel):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
game = context.material.game_settings # dont use node material
|
||||
game = context.material.game_settings # don't use node material
|
||||
|
||||
row = layout.row()
|
||||
row.prop(game, "use_backface_culling")
|
||||
@@ -653,7 +653,7 @@ class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel):
|
||||
layout = self.layout
|
||||
layout.active = context.material.game_settings.physics
|
||||
|
||||
phys = context.material.physics # dont use node material
|
||||
phys = context.material.physics # don't use node material
|
||||
|
||||
split = layout.split()
|
||||
row = split.row()
|
||||
@@ -686,7 +686,7 @@ class MATERIAL_PT_strand(MaterialButtonsPanel, Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
mat = context.material # dont use node material
|
||||
mat = context.material # don't use node material
|
||||
tan = mat.strand
|
||||
|
||||
split = layout.split()
|
||||
@@ -862,7 +862,7 @@ class MATERIAL_PT_volume_density(VolumeButtonsPanel, Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
vol = context.material.volume # dont use node material
|
||||
vol = context.material.volume # don't use node material
|
||||
|
||||
row = layout.row()
|
||||
row.prop(vol, "density")
|
||||
@@ -876,7 +876,7 @@ class MATERIAL_PT_volume_shading(VolumeButtonsPanel, Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
vol = context.material.volume # dont use node material
|
||||
vol = context.material.volume # don't use node material
|
||||
|
||||
split = layout.split()
|
||||
|
||||
@@ -901,7 +901,7 @@ class MATERIAL_PT_volume_lighting(VolumeButtonsPanel, Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
vol = context.material.volume # dont use node material
|
||||
vol = context.material.volume # don't use node material
|
||||
|
||||
split = layout.split()
|
||||
|
||||
@@ -942,7 +942,7 @@ class MATERIAL_PT_volume_transp(VolumeButtonsPanel, Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
mat = context.material # dont use node material
|
||||
mat = context.material # don't use node material
|
||||
|
||||
layout.prop(mat, "transparency_method", expand=True)
|
||||
|
||||
@@ -954,7 +954,7 @@ class MATERIAL_PT_volume_integration(VolumeButtonsPanel, Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
vol = context.material.volume # dont use node material
|
||||
vol = context.material.volume # don't use node material
|
||||
|
||||
split = layout.split()
|
||||
|
||||
|
||||
@@ -658,7 +658,7 @@ class ConstraintButtonsPanel():
|
||||
row.label(text="Source to Destination Mapping:")
|
||||
|
||||
# note: chr(187) is the ASCII arrow ( >> ). Blender Text Editor can't
|
||||
# open it. Thus we are using the hardcoded value instead.
|
||||
# open it. Thus we are using the hard-coded value instead.
|
||||
row = col.row()
|
||||
row.prop(con, "map_to_x_from", expand=False, text="")
|
||||
row.label(text=" %s X" % chr(187))
|
||||
|
||||
@@ -405,9 +405,12 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, Panel):
|
||||
|
||||
layout.enabled = particle_panel_enabled(context, psys)
|
||||
|
||||
row = layout.row()
|
||||
row.label(text="Initial Rotation:")
|
||||
row.prop(part, "use_dynamic_rotation")
|
||||
layout.prop(part, "use_dynamic_rotation")
|
||||
|
||||
if part.use_dynamic_rotation:
|
||||
layout.label(text="Initial Rotation Axis:")
|
||||
else:
|
||||
layout.label(text="Rotation Axis:")
|
||||
|
||||
split = layout.split()
|
||||
|
||||
@@ -419,12 +422,17 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, Panel):
|
||||
col.prop(part, "phase_factor", slider=True)
|
||||
col.prop(part, "phase_factor_random", text="Random", slider=True)
|
||||
|
||||
col = layout.column()
|
||||
col.label(text="Angular Velocity:")
|
||||
col.row().prop(part, "angular_velocity_mode", expand=True)
|
||||
|
||||
if part.angular_velocity_mode != 'NONE':
|
||||
col.prop(part, "angular_velocity_factor", text="")
|
||||
if part.type != 'HAIR':
|
||||
col = layout.column()
|
||||
if part.use_dynamic_rotation:
|
||||
col.label(text="Initial Angular Velocity:")
|
||||
else:
|
||||
col.label(text="Angular Velocity:")
|
||||
sub = col.row(align=True)
|
||||
sub.prop(part, "angular_velocity_mode", text="")
|
||||
subsub = sub.column()
|
||||
subsub.active = part.angular_velocity_mode != 'NONE'
|
||||
subsub.prop(part, "angular_velocity_factor", text="")
|
||||
|
||||
|
||||
class PARTICLE_PT_physics(ParticleButtonsPanel, Panel):
|
||||
@@ -832,7 +840,9 @@ class PARTICLE_PT_render(ParticleButtonsPanel, Panel):
|
||||
|
||||
elif part.render_type == 'OBJECT':
|
||||
col.prop(part, "dupli_object")
|
||||
col.prop(part, "use_global_dupli")
|
||||
sub = col.row()
|
||||
sub.prop(part, "use_global_dupli")
|
||||
sub.prop(part, "use_rotation_dupli")
|
||||
elif part.render_type == 'GROUP':
|
||||
col.prop(part, "dupli_group")
|
||||
split = layout.split()
|
||||
@@ -841,13 +851,14 @@ class PARTICLE_PT_render(ParticleButtonsPanel, Panel):
|
||||
col.prop(part, "use_whole_group")
|
||||
sub = col.column()
|
||||
sub.active = (part.use_whole_group is False)
|
||||
sub.prop(part, "use_group_pick_random")
|
||||
sub.prop(part, "use_group_count")
|
||||
|
||||
col = split.column()
|
||||
sub = col.column()
|
||||
sub.active = (part.use_whole_group is False)
|
||||
sub.prop(part, "use_global_dupli")
|
||||
sub.prop(part, "use_group_pick_random")
|
||||
sub.prop(part, "use_rotation_dupli")
|
||||
|
||||
if part.use_group_count and not part.use_whole_group:
|
||||
row = layout.row()
|
||||
|
||||
@@ -76,7 +76,7 @@ class PHYSICS_PT_add(PhysicButtonsPanel, Panel):
|
||||
physics_add(self, col, context.smoke, "Smoke", 'SMOKE', 'MOD_SMOKE', True)
|
||||
|
||||
|
||||
#cachetype can be 'PSYS' 'HAIR' 'SMOKE' etc
|
||||
# cache-type can be 'PSYS' 'HAIR' 'SMOKE' etc
|
||||
|
||||
def point_cache_ui(self, context, cache, enabled, cachetype):
|
||||
layout = self.layout
|
||||
|
||||
@@ -927,9 +927,9 @@ class TEXTURE_PT_influence(TextureSlotPanel, Panel):
|
||||
factor_but(col, "use_map_warp", "warp_factor", "Warp")
|
||||
factor_but(col, "use_map_displacement", "displacement_factor", "Displace")
|
||||
|
||||
#sub = col.column()
|
||||
#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)
|
||||
#~ sub = col.column()
|
||||
#~ 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 == 'HALO':
|
||||
layout.label(text="Halo:")
|
||||
|
||||
@@ -1014,7 +1014,7 @@ class TEXTURE_PT_influence(TextureSlotPanel, Panel):
|
||||
col = split.column()
|
||||
col.prop(tex, "blend_type", text="Blend")
|
||||
col.prop(tex, "use_rgb_to_intensity")
|
||||
# color is used on grayscale textures even when use_rgb_to_intensity is disabled.
|
||||
# color is used on gray-scale textures even when use_rgb_to_intensity is disabled.
|
||||
col.prop(tex, "color", text="")
|
||||
|
||||
col = split.column()
|
||||
@@ -1027,14 +1027,14 @@ class TEXTURE_PT_influence(TextureSlotPanel, Panel):
|
||||
if isinstance(idblock, bpy.types.Material):
|
||||
layout.label(text="Bump Mapping:")
|
||||
|
||||
# only show bump settings if activated but not for normalmap images
|
||||
# only show bump settings if activated but not for normal-map images
|
||||
row = layout.row()
|
||||
|
||||
sub = row.row()
|
||||
sub.active = (tex.use_map_normal or tex.use_map_warp) and not (tex.texture.type == 'IMAGE' and (tex.texture.use_normal_map or tex.texture.use_derivative_map))
|
||||
sub.prop(tex, "bump_method", text="Method")
|
||||
|
||||
# the space setting is supported for: derivmaps + bumpmaps (DEFAULT,BEST_QUALITY), not for normalmaps
|
||||
# the space setting is supported for: derivative-maps + bump-maps (DEFAULT,BEST_QUALITY), not for normal-maps
|
||||
sub = row.row()
|
||||
sub.active = (tex.use_map_normal or tex.use_map_warp) and not (tex.texture.type == 'IMAGE' and tex.texture.use_normal_map) and ((tex.bump_method in {'BUMP_DEFAULT', 'BUMP_BEST_QUALITY'}) or (tex.texture.type == 'IMAGE' and tex.texture.use_derivative_map))
|
||||
sub.prop(tex, "bump_objectspace", text="Space")
|
||||
|
||||
@@ -45,7 +45,7 @@ class LOGIC_PT_properties(Panel):
|
||||
row = box.row()
|
||||
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, "value", text="", toggle=True) # we don't care about the type. rna will display correctly
|
||||
row.prop(prop, "show_debug", text="", toggle=True, icon='INFO')
|
||||
row.operator("object.game_property_remove", text="", icon='X', emboss=False).index = i
|
||||
|
||||
|
||||
@@ -60,7 +60,6 @@ class SEQUENCER_HT_header(Header):
|
||||
|
||||
layout.separator()
|
||||
layout.operator("sequencer.refresh_all")
|
||||
layout.template_running_jobs()
|
||||
elif st.view_type == 'SEQUENCER_PREVIEW':
|
||||
layout.separator()
|
||||
layout.operator("sequencer.refresh_all")
|
||||
@@ -76,6 +75,8 @@ class SEQUENCER_HT_header(Header):
|
||||
row.prop(ed, "overlay_frame", text="")
|
||||
row.prop(ed, "overlay_lock", text="", icon='LOCKED')
|
||||
|
||||
layout.template_running_jobs()
|
||||
|
||||
|
||||
class SEQUENCER_MT_view_toggle(Menu):
|
||||
bl_label = "View Type"
|
||||
|
||||
@@ -426,8 +426,8 @@ class USERPREF_PT_system(Panel):
|
||||
col.label(text="Anisotropic Filtering")
|
||||
col.prop(system, "anisotropic_filter", text="")
|
||||
col.prop(system, "use_vertex_buffer_objects")
|
||||
#Anti-aliasing is disabled as it breaks broder/lasso select
|
||||
#col.prop(system, "use_antialiasing")
|
||||
# Anti-aliasing is disabled as it breaks border/lasso select
|
||||
#~ col.prop(system, "use_antialiasing")
|
||||
col.label(text="Window Draw Method:")
|
||||
col.prop(system, "window_draw_method", text="")
|
||||
col.label(text="Text Draw Options:")
|
||||
|
||||
@@ -262,7 +262,7 @@ class InputKeyMapPanel:
|
||||
|
||||
row = subcol.row(align=True)
|
||||
|
||||
#row.prop_search(wm.keyconfigs, "active", wm, "keyconfigs", text="Key Config:")
|
||||
#~ row.prop_search(wm.keyconfigs, "active", wm, "keyconfigs", text="Key Config:")
|
||||
text = bpy.path.display_name(context.window_manager.keyconfigs.active.name)
|
||||
if not text:
|
||||
text = "Blender (default)"
|
||||
@@ -270,8 +270,8 @@ class InputKeyMapPanel:
|
||||
row.operator("wm.keyconfig_preset_add", text="", icon="ZOOMIN")
|
||||
row.operator("wm.keyconfig_preset_add", text="", icon="ZOOMOUT").remove_active = True
|
||||
|
||||
# layout.context_pointer_set("keyconfig", wm.keyconfigs.active)
|
||||
# row.operator("wm.keyconfig_remove", text="", icon='X')
|
||||
#~ layout.context_pointer_set("keyconfig", wm.keyconfigs.active)
|
||||
#~ row.operator("wm.keyconfig_remove", text="", icon='X')
|
||||
|
||||
row.prop(context.space_data, "filter_text", icon="VIEWZOOM")
|
||||
|
||||
|
||||
@@ -54,10 +54,11 @@ class VIEW3D_HT_header(Header):
|
||||
else:
|
||||
sub.menu("VIEW3D_MT_object")
|
||||
|
||||
row = layout.row()
|
||||
|
||||
# Contains buttons like Mode, Pivot, Manipulator, Layer, Mesh Select Mode...
|
||||
row.template_header_3D()
|
||||
|
||||
layout.template_header_3D()
|
||||
|
||||
row = layout.row()
|
||||
if obj:
|
||||
# Particle edit
|
||||
if obj.mode == 'PARTICLE_EDIT':
|
||||
@@ -985,6 +986,7 @@ class VIEW3D_MT_make_links(Menu):
|
||||
|
||||
layout.operator("object.join_uvs") # stupid place to add this!
|
||||
|
||||
|
||||
class VIEW3D_MT_object_game(Menu):
|
||||
bl_label = "Game"
|
||||
|
||||
@@ -1140,7 +1142,7 @@ class VIEW3D_MT_sculpt(Menu):
|
||||
layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
|
||||
layout.prop(sculpt, "show_brush")
|
||||
|
||||
# TODO, make availabel from paint menu!
|
||||
# TODO, make available 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")
|
||||
|
||||
@@ -1411,7 +1413,7 @@ class BoneOptions:
|
||||
data_path_iter = "selected_bones"
|
||||
opt_suffix = ""
|
||||
options.append("lock")
|
||||
else: # posemode
|
||||
else: # pose-mode
|
||||
bone_props = bpy.types.Bone.bl_rna.properties
|
||||
data_path_iter = "selected_pose_bones"
|
||||
opt_suffix = "bone."
|
||||
@@ -2180,7 +2182,7 @@ class VIEW3D_PT_view3d_meshdisplay(Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
# The active object check is needed because of localmode
|
||||
# The active object check is needed because of local-mode
|
||||
return (context.active_object and (context.mode == 'EDIT_MESH'))
|
||||
|
||||
def draw(self, context):
|
||||
@@ -2243,7 +2245,7 @@ class VIEW3D_PT_background_image(Panel):
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
view = context.space_data
|
||||
# bg = context.space_data.background_image
|
||||
#~ bg = context.space_data.background_image
|
||||
return (view)
|
||||
|
||||
def draw_header(self, context):
|
||||
|
||||
@@ -63,7 +63,7 @@ def draw_gpencil_tools(context, layout):
|
||||
row.prop(context.tool_settings, "use_grease_pencil_sessions")
|
||||
|
||||
|
||||
# ********** default tools for objectmode ****************
|
||||
# ********** default tools for object-mode ****************
|
||||
|
||||
class VIEW3D_PT_tools_objectmode(View3DPanel, Panel):
|
||||
bl_context = "objectmode"
|
||||
@@ -385,7 +385,7 @@ class VIEW3D_PT_tools_latticeedit(View3DPanel, Panel):
|
||||
draw_gpencil_tools(context, layout)
|
||||
|
||||
|
||||
# ********** default tools for posemode ****************
|
||||
# ********** default tools for pose-mode ****************
|
||||
|
||||
|
||||
class VIEW3D_PT_tools_posemode(View3DPanel, Panel):
|
||||
@@ -484,16 +484,18 @@ class VIEW3D_PT_tools_brush(PaintPanel, Panel):
|
||||
|
||||
# XXX This needs a check if psys is editable.
|
||||
if context.particle_edit_object:
|
||||
tool = settings.tool
|
||||
|
||||
# XXX Select Particle System
|
||||
layout.column().prop(settings, "tool", expand=True)
|
||||
|
||||
if settings.tool != 'NONE':
|
||||
if tool != 'NONE':
|
||||
col = layout.column()
|
||||
col.prop(brush, "size", slider=True)
|
||||
if settings.tool != 'ADD':
|
||||
if tool != 'ADD':
|
||||
col.prop(brush, "strength", slider=True)
|
||||
|
||||
if settings.tool == 'ADD':
|
||||
if tool == 'ADD':
|
||||
col.prop(brush, "count")
|
||||
col = layout.column()
|
||||
col.prop(settings, "use_default_interpolate")
|
||||
@@ -501,15 +503,16 @@ class VIEW3D_PT_tools_brush(PaintPanel, Panel):
|
||||
sub.active = settings.use_default_interpolate
|
||||
sub.prop(brush, "steps", slider=True)
|
||||
sub.prop(settings, "default_key_count", slider=True)
|
||||
elif settings.tool == 'LENGTH':
|
||||
elif tool == 'LENGTH':
|
||||
layout.prop(brush, "length_mode", expand=True)
|
||||
elif settings.tool == 'PUFF':
|
||||
elif tool == 'PUFF':
|
||||
layout.prop(brush, "puff_mode", expand=True)
|
||||
layout.prop(brush, "use_puff_volume")
|
||||
|
||||
# Sculpt Mode #
|
||||
|
||||
elif context.sculpt_object and brush:
|
||||
tool = brush.sculpt_tool
|
||||
|
||||
col = layout.column()
|
||||
|
||||
@@ -526,12 +529,12 @@ class VIEW3D_PT_tools_brush(PaintPanel, Panel):
|
||||
|
||||
row.prop(brush, "use_pressure_size", toggle=True, text="")
|
||||
|
||||
if brush.sculpt_tool not in {'SNAKE_HOOK', 'GRAB', 'ROTATE'}:
|
||||
if tool not in {'SNAKE_HOOK', 'GRAB', 'ROTATE'}:
|
||||
col.separator()
|
||||
|
||||
row = col.row(align=True)
|
||||
|
||||
if brush.use_space and brush.sculpt_tool not in {'SMOOTH'}:
|
||||
if brush.use_space and tool != 'SMOOTH':
|
||||
if brush.use_space_atten:
|
||||
row.prop(brush, "use_space_atten", toggle=True, text="", icon='LOCKED')
|
||||
else:
|
||||
@@ -540,26 +543,26 @@ class VIEW3D_PT_tools_brush(PaintPanel, Panel):
|
||||
row.prop(brush, "strength", text="Strength", slider=True)
|
||||
row.prop(brush, "use_pressure_strength", text="")
|
||||
|
||||
if brush.sculpt_tool not in {'SMOOTH'}:
|
||||
if tool != 'SMOOTH':
|
||||
col.separator()
|
||||
|
||||
row = col.row(align=True)
|
||||
row.prop(brush, "auto_smooth_factor", slider=True)
|
||||
row.prop(brush, "use_inverse_smooth_pressure", toggle=True, text="")
|
||||
|
||||
if brush.sculpt_tool in {'GRAB', 'SNAKE_HOOK'}:
|
||||
if tool in {'GRAB', 'SNAKE_HOOK'}:
|
||||
col.separator()
|
||||
|
||||
row = col.row(align=True)
|
||||
row.prop(brush, "normal_weight", slider=True)
|
||||
|
||||
if brush.sculpt_tool in {'CREASE', 'BLOB'}:
|
||||
if tool in {'CREASE', 'BLOB'}:
|
||||
col.separator()
|
||||
|
||||
row = col.row(align=True)
|
||||
row.prop(brush, "crease_pinch_factor", slider=True, text="Pinch")
|
||||
|
||||
if brush.sculpt_tool not in {'PINCH', 'INFLATE', 'SMOOTH'}:
|
||||
if tool not in {'PINCH', 'INFLATE', 'SMOOTH'}:
|
||||
row = col.row(align=True)
|
||||
|
||||
col.separator()
|
||||
@@ -571,8 +574,8 @@ class VIEW3D_PT_tools_brush(PaintPanel, Panel):
|
||||
|
||||
row.prop(brush, "sculpt_plane", text="")
|
||||
|
||||
#if brush.sculpt_tool in {'CLAY', 'CLAY_TUBES', 'FLATTEN', 'FILL', 'SCRAPE'}:
|
||||
if brush.sculpt_tool in {'CLAY', 'FLATTEN', 'FILL', 'SCRAPE'}:
|
||||
#if tool in {'CLAY', 'CLAY_TUBES', 'FLATTEN', 'FILL', 'SCRAPE'}:
|
||||
if tool in {'CLAY', 'FLATTEN', 'FILL', 'SCRAPE'}:
|
||||
row = col.row(align=True)
|
||||
row.prop(brush, "plane_offset", slider=True)
|
||||
row.prop(brush, "use_offset_pressure", text="")
|
||||
@@ -585,7 +588,7 @@ class VIEW3D_PT_tools_brush(PaintPanel, Panel):
|
||||
row.active = brush.use_plane_trim
|
||||
row.prop(brush, "plane_trim", slider=True, text="Distance")
|
||||
|
||||
if brush.sculpt_tool == 'LAYER':
|
||||
if tool == 'LAYER':
|
||||
row = col.row()
|
||||
row.prop(brush, "height", slider=True, text="Height")
|
||||
|
||||
@@ -597,12 +600,12 @@ class VIEW3D_PT_tools_brush(PaintPanel, Panel):
|
||||
col.separator()
|
||||
col.row().prop(brush, "direction", expand=True)
|
||||
|
||||
if brush.sculpt_tool in {'DRAW', 'CREASE', 'BLOB', 'INFLATE', 'LAYER', 'CLAY'}:
|
||||
if tool in {'DRAW', 'CREASE', 'BLOB', 'INFLATE', 'LAYER', 'CLAY'}:
|
||||
col.separator()
|
||||
|
||||
col.prop(brush, "use_accumulate")
|
||||
|
||||
if brush.sculpt_tool == 'LAYER':
|
||||
if tool == 'LAYER':
|
||||
col.separator()
|
||||
|
||||
ob = context.sculpt_object
|
||||
@@ -1040,7 +1043,7 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, Panel):
|
||||
row = col.row(align=True)
|
||||
row.prop(brush, "icon_filepath", text="")
|
||||
|
||||
# ********** default tools for weightpaint ****************
|
||||
# ********** default tools for weight-paint ****************
|
||||
|
||||
|
||||
class VIEW3D_PT_tools_weightpaint(View3DPanel, Panel):
|
||||
@@ -1094,9 +1097,9 @@ class VIEW3D_PT_tools_weightpaint_options(View3DPanel, Panel):
|
||||
# col.prop(wpaint, "mul", text="")
|
||||
|
||||
# Also missing now:
|
||||
# Soft, Vgroup, X-Mirror and "Clear" Operator.
|
||||
# Soft, Vertex-Group, X-Mirror and "Clear" Operator.
|
||||
|
||||
# ********** default tools for vertexpaint ****************
|
||||
# ********** default tools for vertex-paint ****************
|
||||
|
||||
|
||||
class VIEW3D_PT_tools_vertexpaint(View3DPanel, Panel):
|
||||
@@ -1125,7 +1128,7 @@ class VIEW3D_PT_tools_vertexpaint(View3DPanel, Panel):
|
||||
# col.label(text="Multiply:")
|
||||
# col.prop(vpaint, "mul", text="")
|
||||
|
||||
# ********** default tools for texturepaint ****************
|
||||
# ********** default tools for texture-paint ****************
|
||||
|
||||
|
||||
class VIEW3D_PT_tools_projectpaint(View3DPanel, Panel):
|
||||
|
||||
34
release/scripts/templates/driver_functions.py
Normal file
34
release/scripts/templates/driver_functions.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# This script defines functions to be used directly in drivers expressions to
|
||||
# extend the builtin set of python functions.
|
||||
#
|
||||
# This can be executed on manually or set to 'Register' to
|
||||
# initialize thefunctions on file load.
|
||||
|
||||
|
||||
# two sample functions
|
||||
def invert(f):
|
||||
""" Simple function call:
|
||||
|
||||
invert(val)
|
||||
"""
|
||||
return 1.0 - f
|
||||
|
||||
|
||||
uuid_store = {}
|
||||
|
||||
def slow_value(value, fac, uuid):
|
||||
""" Delay the value by a factor, use a unique string to allow
|
||||
use in multiple drivers without conflict:
|
||||
|
||||
slow_value(val, 0.5, "my_value")
|
||||
"""
|
||||
value_prev = uuid_store.get(uuid, value)
|
||||
uuid_store[uuid] = value_new = (value_prev * fac) + (value * (1.0 - fac))
|
||||
return value_new
|
||||
|
||||
|
||||
import bpy
|
||||
|
||||
# Add variable defined in this script into the drivers namespace.
|
||||
bpy.app.driver_namespace["invert"] = invert
|
||||
bpy.app.driver_namespace["slow_value"] = slow_value
|
||||
@@ -8,7 +8,7 @@
|
||||
import bge
|
||||
|
||||
# variables defined here will only be set once when the
|
||||
# module is first imported. Set object spesific vars
|
||||
# module is first imported. Set object specific vars
|
||||
# inside the function if you intend to use the module
|
||||
# with multiple objects.
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
|
||||
unsigned int i= 0;
|
||||
GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
|
||||
|
||||
/* buffer spesific vars*/
|
||||
/* buffer specific vars*/
|
||||
const unsigned char b_col_char[4]= {font->b_col[0] * 255,
|
||||
font->b_col[1] * 255,
|
||||
font->b_col[2] * 255,
|
||||
|
||||
@@ -94,6 +94,7 @@ static const char *locales[] = {
|
||||
"greek", "el_GR",
|
||||
"korean", "ko_KR",
|
||||
"nepali", "ne_NP",
|
||||
"persian", "fa_PE",
|
||||
};
|
||||
|
||||
void BLF_lang_init(void)
|
||||
|
||||
@@ -146,7 +146,7 @@ void BKE_animsys_evaluate_animdata(struct Scene *scene, struct ID *id, struct An
|
||||
void BKE_animsys_evaluate_all_animation(struct Main *main, struct Scene *scene, float ctime);
|
||||
|
||||
|
||||
/* ------------ Specialised API --------------- */
|
||||
/* ------------ Specialized API --------------- */
|
||||
/* There are a few special tools which require these following functions. They are NOT to be used
|
||||
* for standard animation evaluation UNDER ANY CIRCUMSTANCES!
|
||||
*
|
||||
|
||||
@@ -43,8 +43,8 @@ extern "C" {
|
||||
/* these lines are grep'd, watch out for our not-so-awesome regex
|
||||
* and keep comment above the defines.
|
||||
* Use STRINGIFY() rather than defining with quotes */
|
||||
#define BLENDER_VERSION 259
|
||||
#define BLENDER_SUBVERSION 4
|
||||
#define BLENDER_VERSION 260
|
||||
#define BLENDER_SUBVERSION 0
|
||||
|
||||
#define BLENDER_MINVERSION 250
|
||||
#define BLENDER_MINSUBVERSION 0
|
||||
@@ -53,7 +53,7 @@ extern "C" {
|
||||
/* can be left blank, otherwise a,b,c... etc with no quotes */
|
||||
#define BLENDER_VERSION_CHAR
|
||||
/* alpha/beta/rc/release, docs use this */
|
||||
#define BLENDER_VERSION_CYCLE rc
|
||||
#define BLENDER_VERSION_CYCLE release
|
||||
|
||||
struct ListBase;
|
||||
struct MemFile;
|
||||
|
||||
@@ -84,7 +84,7 @@ typedef struct SculptSession {
|
||||
int modifiers_active; /* object is deformed with some modifiers */
|
||||
float (*orig_cos)[3]; /* coords of undeformed mesh */
|
||||
float (*deform_cos)[3]; /* coords of deformed mesh but without stroke displacement */
|
||||
float (*deform_imats)[3][3]; /* crazyspace deformation matricies */
|
||||
float (*deform_imats)[3][3]; /* crazyspace deformation matrices */
|
||||
|
||||
/* Partial redraw */
|
||||
int partial_redraw;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
/** \file BKE_utildefines.h
|
||||
* \ingroup bke
|
||||
* \brief blender format spesific macros
|
||||
* \brief blender format specific macros
|
||||
* \note generic defines should go in BLI_utildefines.h
|
||||
*/
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
|
||||
#ifdef WITH_GAMEENGINE
|
||||
#include "BKE_navmesh_conversion.h"
|
||||
static DerivedMesh *navmesh_dm_createNavMeshForVisualization(DerivedMesh *dm);
|
||||
#endif
|
||||
|
||||
#include "BLO_sys_types.h" // for intptr_t support
|
||||
@@ -77,8 +78,6 @@
|
||||
|
||||
extern GLubyte stipple_quarttone[128]; /* glutil.c, bad level data */
|
||||
|
||||
static DerivedMesh *navmesh_dm_createNavMeshForVisualization(DerivedMesh *dm);
|
||||
|
||||
///////////////////////////////////
|
||||
///////////////////////////////////
|
||||
|
||||
|
||||
@@ -1430,6 +1430,16 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
|
||||
|
||||
VECCOPY(vec, obmat[3]);
|
||||
obmat[3][0] = obmat[3][1] = obmat[3][2] = 0.0f;
|
||||
|
||||
/* particle rotation uses x-axis as the aligned axis, so pre-rotate the object accordingly */
|
||||
if((part->draw & PART_DRAW_ROTATE_OB) == 0) {
|
||||
float xvec[3], q[4];
|
||||
xvec[0] = -1.f;
|
||||
xvec[1] = xvec[2] = 0;
|
||||
vec_to_quat(q, xvec, ob->trackflag, ob->upflag);
|
||||
quat_to_mat4(obmat, q);
|
||||
obmat[3][3]= 1.0f;
|
||||
}
|
||||
|
||||
/* Normal particles and cached hair live in global space so we need to
|
||||
* remove the real emitter's transformation before 2nd order duplication.
|
||||
@@ -1448,7 +1458,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
|
||||
copy_m4_m4(mat, tmat);
|
||||
|
||||
if(part->draw & PART_DRAW_GLOBAL_OB)
|
||||
VECADD(mat[3], mat[3], vec);
|
||||
add_v3_v3v3(mat[3], mat[3], vec);
|
||||
|
||||
dob= new_dupli_object(lb, ob, mat, ob->lay, counter, GS(id->name) == ID_GR ? OB_DUPLIGROUP : OB_DUPLIPARTS, animated);
|
||||
copy_m4_m4(dob->omat, oldobmat);
|
||||
|
||||
@@ -974,7 +974,7 @@ static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm )
|
||||
* SPRING NETWORK BUILDING IMPLEMENTATION BEGIN
|
||||
***************************************************************************************/
|
||||
|
||||
// be carefull: implicit solver has to be resettet when using this one!
|
||||
// be careful: implicit solver has to be resettet when using this one!
|
||||
// --> only for implicit handling of this spring!
|
||||
int cloth_add_spring ( ClothModifierData *clmd, unsigned int indexA, unsigned int indexB, float restlength, int spring_type)
|
||||
{
|
||||
|
||||
@@ -1067,7 +1067,7 @@ static void trackto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
|
||||
cob->matrix[2][2]=size[2];
|
||||
|
||||
/* targetmat[2] instead of ownermat[2] is passed to vectomat
|
||||
* for backwards compatability it seems... (Aligorith)
|
||||
* for backwards compatibility it seems... (Aligorith)
|
||||
*/
|
||||
sub_v3_v3v3(vec, cob->matrix[3], ct->matrix[3]);
|
||||
vectomat(vec, ct->matrix[2],
|
||||
@@ -2104,7 +2104,7 @@ static void actcon_new_data (void *cdata)
|
||||
{
|
||||
bActionConstraint *data= (bActionConstraint *)cdata;
|
||||
|
||||
/* set type to 20 (Loc X), as 0 is Rot X for backwards compatability */
|
||||
/* set type to 20 (Loc X), as 0 is Rot X for backwards compatibility */
|
||||
data->type = 20;
|
||||
}
|
||||
|
||||
@@ -2161,7 +2161,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint
|
||||
constraint_target_to_mat4(ct->tar, ct->subtarget, tempmat, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail);
|
||||
|
||||
/* determine where in transform range target is */
|
||||
/* data->type is mapped as follows for backwards compatability:
|
||||
/* data->type is mapped as follows for backwards compatibility:
|
||||
* 00,01,02 - rotation (it used to be like this)
|
||||
* 10,11,12 - scaling
|
||||
* 20,21,22 - location
|
||||
@@ -4351,7 +4351,7 @@ short proxylocked_constraints_owner (Object *ob, bPoseChannel *pchan)
|
||||
* constraints either had one or no targets. It used to be called during the main constraint solving
|
||||
* loop, but is now only used for the remaining cases for a few constraints.
|
||||
*
|
||||
* None of the actual calculations of the matricies should be done here! Also, this function is
|
||||
* None of the actual calculations of the matrices should be done here! Also, this function is
|
||||
* not to be used by any new constraints, particularly any that have multiple targets.
|
||||
*/
|
||||
void get_constraint_target_matrix (struct Scene *scene, bConstraint *con, int n, short ownertype, void *ownerdata, float mat[][4], float ctime)
|
||||
|
||||
@@ -705,7 +705,7 @@ void bezt_add_to_cfra_elem (ListBase *lb, BezTriple *bezt)
|
||||
|
||||
/* ***************************** Samples Utilities ******************************* */
|
||||
/* Some utilities for working with FPoints (i.e. 'sampled' animation curve data, such as
|
||||
* data imported from BVH/Mocap files), which are specialised for use with high density datasets,
|
||||
* data imported from BVH/Mocap files), which are specialized for use with high density datasets,
|
||||
* which BezTriples/Keyframe data are ill equipped to do.
|
||||
*/
|
||||
|
||||
|
||||
@@ -546,7 +546,7 @@ static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo
|
||||
nu2->knotsu = nu2->knotsv = NULL;
|
||||
nu2->flag= CU_SMOOTH;
|
||||
nu2->charidx = charidx;
|
||||
if (info->mat_nr) {
|
||||
if (info->mat_nr > 0) {
|
||||
nu2->mat_nr= info->mat_nr-1;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -185,7 +185,7 @@ bGPDlayer *gpencil_layer_addnew (bGPdata *gpd)
|
||||
|
||||
/* auto-name */
|
||||
strcpy(gpl->info, "GP_Layer");
|
||||
BLI_uniquename(&gpd->layers, gpl, "GP_Layer", '.', offsetof(bGPDlayer, info[0]), sizeof(gpl->info));
|
||||
BLI_uniquename(&gpd->layers, gpl, "GP_Layer", '.', offsetof(bGPDlayer, info), sizeof(gpl->info));
|
||||
|
||||
/* make this one the active one */
|
||||
gpencil_layer_setactive(gpd, gpl);
|
||||
|
||||
@@ -1034,12 +1034,14 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver)
|
||||
/* first bone target */
|
||||
dtar= &dvar->targets[0];
|
||||
dtar->id= (ID *)idriver->ob;
|
||||
dtar->idtype= ID_OB;
|
||||
if (idriver->name[0])
|
||||
BLI_strncpy(dtar->pchan_name, idriver->name, sizeof(dtar->pchan_name));
|
||||
|
||||
/* second bone target (name was stored in same var as the first one) */
|
||||
dtar= &dvar->targets[1];
|
||||
dtar->id= (ID *)idriver->ob;
|
||||
dtar->idtype= ID_OB;
|
||||
if (idriver->name[0]) // xxx... for safety
|
||||
BLI_strncpy(dtar->pchan_name, idriver->name+DRIVER_NAME_OFFS, sizeof(dtar->pchan_name));
|
||||
}
|
||||
@@ -1051,6 +1053,7 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver)
|
||||
/* only requires a single target */
|
||||
dtar= &dvar->targets[0];
|
||||
dtar->id= (ID *)idriver->ob;
|
||||
dtar->idtype= ID_OB;
|
||||
if (idriver->name[0])
|
||||
BLI_strncpy(dtar->pchan_name, idriver->name, sizeof(dtar->pchan_name));
|
||||
dtar->transChan= adrcode_to_dtar_transchan(idriver->adrcode);
|
||||
@@ -1065,6 +1068,7 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver)
|
||||
/* only requires single target */
|
||||
dtar= &dvar->targets[0];
|
||||
dtar->id= (ID *)idriver->ob;
|
||||
dtar->idtype= ID_OB;
|
||||
dtar->transChan= adrcode_to_dtar_transchan(idriver->adrcode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1106,8 +1106,17 @@ int object_remove_material_slot(Object *ob)
|
||||
short *totcolp;
|
||||
short a, actcol;
|
||||
|
||||
if(ob==NULL || ob->totcol==0) return FALSE;
|
||||
|
||||
if (ob==NULL || ob->totcol==0) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* this should never happen and used to crash */
|
||||
if (ob->actcol <= 0) {
|
||||
printf("%s: invalid material index %d, report a bug!\n", __func__, ob->actcol);
|
||||
BLI_assert(0);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* take a mesh/curve/mball as starting point, remove 1 index,
|
||||
* AND with all objects that share the ob->data
|
||||
*
|
||||
@@ -1120,10 +1129,8 @@ int object_remove_material_slot(Object *ob)
|
||||
if(*matarar==NULL) return FALSE;
|
||||
|
||||
/* we delete the actcol */
|
||||
if(ob->totcol) {
|
||||
mao= (*matarar)[ob->actcol-1];
|
||||
if(mao) mao->id.us--;
|
||||
}
|
||||
mao= (*matarar)[ob->actcol-1];
|
||||
if(mao) mao->id.us--;
|
||||
|
||||
for(a=ob->actcol; a<ob->totcol; a++)
|
||||
(*matarar)[a-1]= (*matarar)[a];
|
||||
|
||||
@@ -4384,33 +4384,50 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa
|
||||
psys_particle_on_emitter(psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,nor,0,0,0,0);
|
||||
else
|
||||
psys_particle_on_emitter(psmd,PART_FROM_FACE,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,loc,nor,0,0,0,0);
|
||||
|
||||
copy_m3_m4(nmat, ob->imat);
|
||||
transpose_m3(nmat);
|
||||
mul_m3_v3(nmat, nor);
|
||||
normalize_v3(nor);
|
||||
|
||||
/* make sure that we get a proper side vector */
|
||||
if(fabs(dot_v3v3(nor,vec))>0.999999) {
|
||||
if(fabs(dot_v3v3(nor,xvec))>0.999999) {
|
||||
nor[0] = 0.0f;
|
||||
nor[1] = 1.0f;
|
||||
nor[2] = 0.0f;
|
||||
if(psys->part->rotmode == PART_ROT_VEL) {
|
||||
copy_m3_m4(nmat, ob->imat);
|
||||
transpose_m3(nmat);
|
||||
mul_m3_v3(nmat, nor);
|
||||
normalize_v3(nor);
|
||||
|
||||
/* make sure that we get a proper side vector */
|
||||
if(fabs(dot_v3v3(nor,vec))>0.999999) {
|
||||
if(fabs(dot_v3v3(nor,xvec))>0.999999) {
|
||||
nor[0] = 0.0f;
|
||||
nor[1] = 1.0f;
|
||||
nor[2] = 0.0f;
|
||||
}
|
||||
else {
|
||||
nor[0] = 1.0f;
|
||||
nor[1] = 0.0f;
|
||||
nor[2] = 0.0f;
|
||||
}
|
||||
}
|
||||
else {
|
||||
nor[0] = 1.0f;
|
||||
nor[1] = 0.0f;
|
||||
nor[2] = 0.0f;
|
||||
cross_v3_v3v3(side, nor, vec);
|
||||
normalize_v3(side);
|
||||
|
||||
/* rotate side vector around vec */
|
||||
if(psys->part->phasefac != 0) {
|
||||
float q_phase[4];
|
||||
float phasefac = psys->part->phasefac;
|
||||
if(psys->part->randphasefac != 0.0f)
|
||||
phasefac += psys->part->randphasefac * PSYS_FRAND((pa-psys->particles) + 20);
|
||||
axis_angle_to_quat( q_phase, vec, phasefac*(float)M_PI);
|
||||
|
||||
mul_qt_v3(q_phase, side);
|
||||
}
|
||||
|
||||
cross_v3_v3v3(nor, vec, side);
|
||||
|
||||
unit_m4(mat);
|
||||
VECCOPY(mat[0], vec);
|
||||
VECCOPY(mat[1], side);
|
||||
VECCOPY(mat[2], nor);
|
||||
}
|
||||
else {
|
||||
quat_to_mat4(mat, pa->state.rot);
|
||||
}
|
||||
cross_v3_v3v3(side, nor, vec);
|
||||
normalize_v3(side);
|
||||
cross_v3_v3v3(nor, vec, side);
|
||||
|
||||
unit_m4(mat);
|
||||
VECCOPY(mat[0], vec);
|
||||
VECCOPY(mat[1], side);
|
||||
VECCOPY(mat[2], nor);
|
||||
|
||||
*scale= len;
|
||||
}
|
||||
|
||||
@@ -1607,8 +1607,8 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
|
||||
}
|
||||
|
||||
|
||||
/* -velocity */
|
||||
if(part->randfac != 0.0f){
|
||||
/* -velocity (boids need this even if there's no random velocity) */
|
||||
if(part->randfac != 0.0f || (part->phystype==PART_PHYS_BOIDS && pa->boid)){
|
||||
r_vel[0] = 2.0f * (PSYS_FRAND(p + 10) - 0.5f);
|
||||
r_vel[1] = 2.0f * (PSYS_FRAND(p + 11) - 0.5f);
|
||||
r_vel[2] = 2.0f * (PSYS_FRAND(p + 12) - 0.5f);
|
||||
|
||||
@@ -910,7 +910,7 @@ static int ptcache_path(PTCacheID *pid, char *filename)
|
||||
else if (G.relbase_valid || lib) {
|
||||
char file[MAX_PTCACHE_PATH]; /* we dont want the dir, only the file */
|
||||
|
||||
BLI_split_dirfile(blendfilename, NULL, file);
|
||||
BLI_split_dirfile(blendfilename, NULL, file, 0, sizeof(file));
|
||||
i = strlen(file);
|
||||
|
||||
/* remove .blend */
|
||||
|
||||
@@ -827,7 +827,7 @@ static void do_cross_effect_float(float facf0, float facf1, int x, int y,
|
||||
}
|
||||
}
|
||||
|
||||
/* carefull: also used by speed effect! */
|
||||
/* careful: also used by speed effect! */
|
||||
|
||||
static struct ImBuf* do_cross_effect(
|
||||
SeqRenderData context, Sequence *UNUSED(seq), float UNUSED(cfra),
|
||||
|
||||
@@ -3647,7 +3647,7 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
|
||||
/* we only need 1 element to store the filename */
|
||||
strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
|
||||
|
||||
BLI_split_dirfile(seq_load->path, strip->dir, se->name);
|
||||
BLI_split_dirfile(seq_load->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name));
|
||||
|
||||
seq->scene_sound = sound_add_scene_sound(scene, seq, seq_load->start_frame, seq_load->start_frame + strip->len, 0);
|
||||
|
||||
@@ -3706,7 +3706,7 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
|
||||
/* we only need 1 element for MOVIE strips */
|
||||
strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
|
||||
|
||||
BLI_split_dirfile(seq_load->path, strip->dir, se->name);
|
||||
BLI_split_dirfile(seq_load->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name));
|
||||
|
||||
calc_sequence_disp(scene, seq);
|
||||
|
||||
|
||||
@@ -2818,7 +2818,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
|
||||
if (ob->softflag & OB_SB_FACECOLL) scan_for_ext_face_forces(ob,timenow);
|
||||
|
||||
/* finish matrix and solve */
|
||||
#if (0) // remove onl linking for now .. still i am not sure .. the jacobian can be usefull .. so keep that BM
|
||||
#if (0) // remove onl linking for now .. still i am not sure .. the jacobian can be useful .. so keep that BM
|
||||
if(nl_flags & NLF_SOLVE){
|
||||
//double sct,sst=PIL_check_seconds_timer();
|
||||
for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
|
||||
@@ -3540,7 +3540,7 @@ static void lattice_to_softbody(Scene *scene, Object *ob)
|
||||
}
|
||||
}
|
||||
|
||||
/* create some helper edges to enable SB lattice to be usefull at all */
|
||||
/* create some helper edges to enable SB lattice to be useful at all */
|
||||
if (ob->softflag & OB_SB_EDGES){
|
||||
makelatticesprings(lt,ob->soft->bspring,ob->softflag & OB_SB_QUADS,ob);
|
||||
build_bps_springlist(ob); /* link bps to springs */
|
||||
|
||||
@@ -63,6 +63,10 @@
|
||||
#include "BKE_sequencer.h"
|
||||
#include "BKE_scene.h"
|
||||
|
||||
// evil quiet NaN definition
|
||||
static const int NAN_INT = 0x7FC00000;
|
||||
#define NAN_FLT *((float*)(&NAN_INT))
|
||||
|
||||
#ifdef WITH_AUDASPACE
|
||||
// evil global ;-)
|
||||
static int sound_cfra;
|
||||
@@ -295,7 +299,10 @@ void sound_cache(struct bSound* sound)
|
||||
AUD_unload(sound->cache);
|
||||
|
||||
sound->cache = AUD_bufferSound(sound->handle);
|
||||
sound->playback_handle = sound->cache;
|
||||
if(sound->cache)
|
||||
sound->playback_handle = sound->cache;
|
||||
else
|
||||
sound->playback_handle = sound->handle;
|
||||
}
|
||||
|
||||
void sound_cache_notifying(struct Main* main, struct bSound* sound)
|
||||
@@ -332,6 +339,8 @@ void sound_load(struct Main *bmain, struct bSound* sound)
|
||||
sound->playback_handle = NULL;
|
||||
}
|
||||
|
||||
sound_free_waveform(sound);
|
||||
|
||||
// XXX unused currently
|
||||
#if 0
|
||||
switch(sound->type)
|
||||
@@ -625,7 +634,7 @@ float sound_sync_scene(struct Scene *scene)
|
||||
else
|
||||
return AUD_getPosition(scene->sound_scene_handle);
|
||||
}
|
||||
return 0.0f;
|
||||
return NAN_FLT;
|
||||
}
|
||||
|
||||
int sound_scene_playing(struct Scene *scene)
|
||||
@@ -782,7 +791,7 @@ static void sound_start_play_scene(struct Scene *UNUSED(scene)) {}
|
||||
void sound_play_scene(struct Scene *UNUSED(scene)) {}
|
||||
void sound_stop_scene(struct Scene *UNUSED(scene)) {}
|
||||
void sound_seek_scene(struct Main *UNUSED(bmain), struct Scene *UNUSED(scene)) {}
|
||||
float sound_sync_scene(struct Scene *UNUSED(scene)) { return 0.0f; }
|
||||
float sound_sync_scene(struct Scene *UNUSED(scene)) { return NAN_FLT; }
|
||||
int sound_scene_playing(struct Scene *UNUSED(scene)) { return -1; }
|
||||
int sound_read_sound_buffer(struct bSound* UNUSED(sound), float* UNUSED(buffer), int UNUSED(length), float UNUSED(start), float UNUSED(end)) { return 0; }
|
||||
void sound_read_waveform(struct bSound* sound) { (void)sound; }
|
||||
|
||||
@@ -103,7 +103,7 @@ void BLI_setenv_if_new(const char *env, const char* val);
|
||||
void BLI_make_file_string(const char *relabase, char *string, const char *dir, const char *file);
|
||||
void BLI_make_exist(char *dir);
|
||||
void BLI_make_existing_file(const char *name);
|
||||
void BLI_split_dirfile(const char *string, char *dir, char *file);
|
||||
void BLI_split_dirfile(const char *string, char *dir, char *file, const size_t dirlen, const size_t filelen);
|
||||
void BLI_join_dirfile(char *string, const size_t maxlen, const char *dir, const char *file);
|
||||
char *BLI_path_basename(char *path);
|
||||
int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const char *base_dir, const char *src_dir, const char *dest_dir);
|
||||
|
||||
@@ -147,6 +147,10 @@ void BLI_ascii_strtoupper(char *str, int len);
|
||||
char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy);
|
||||
int BLI_utf8_invalid_byte(const char *str, int length);
|
||||
int BLI_utf8_invalid_strip(char *str, int length);
|
||||
/* copied from glib */
|
||||
char *BLI_str_find_prev_char_utf8(const char *str, const char *p);
|
||||
char *BLI_str_find_next_char_utf8(const char *p, const char *end);
|
||||
char *BLI_str_prev_char_utf8(const char *p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ static void seq_setpath(struct BPathIterator *bpi, const char *path)
|
||||
|
||||
if (SEQ_HAS_PATH(seq)) {
|
||||
if (ELEM3(seq->type, SEQ_IMAGE, SEQ_MOVIE, SEQ_SOUND)) {
|
||||
BLI_split_dirfile(path, seq->strip->dir, seq->strip->stripdata->name);
|
||||
BLI_split_dirfile(path, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir), sizeof(seq->strip->stripdata->name));
|
||||
}
|
||||
else {
|
||||
/* simple case */
|
||||
@@ -967,7 +967,7 @@ void findMissingFiles(Main *bmain, const char *str)
|
||||
|
||||
//XXX waitcursor( 1 );
|
||||
|
||||
BLI_split_dirfile(str, dirname, NULL);
|
||||
BLI_split_dirfile(str, dirname, NULL, sizeof(dirname), 0);
|
||||
|
||||
BLI_bpathIterator_init(&bpi, bmain, bmain->name, 0);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user