merge with trunk r39834
This commit is contained in:
@@ -44,14 +44,18 @@ from . import utils, path, ops
|
||||
ops = ops.ops_fake_module
|
||||
|
||||
|
||||
def _main():
|
||||
import sys as _sys
|
||||
def main():
|
||||
import sys
|
||||
|
||||
# Possibly temp. addons path
|
||||
from os.path import join, dirname, normpath
|
||||
_sys.path.append(normpath(join(dirname(__file__),
|
||||
sys.path.append(normpath(join(dirname(__file__),
|
||||
"..", "..", "addons", "modules")))
|
||||
|
||||
# fake module to allow:
|
||||
# from bpy.types import Panel
|
||||
sys.modules["bpy.types"] = types
|
||||
|
||||
# if "-d" in sys.argv: # Enable this to measure startup speed
|
||||
if 0:
|
||||
import cProfile
|
||||
@@ -65,6 +69,6 @@ def _main():
|
||||
utils.load_scripts()
|
||||
|
||||
|
||||
_main()
|
||||
main()
|
||||
|
||||
del _main
|
||||
del main
|
||||
|
||||
@@ -58,7 +58,7 @@ def load_image(imagepath,
|
||||
For formats blender can read, simply return the path that is given.
|
||||
:type convert_callback: function
|
||||
:return: an image or None
|
||||
:rtype: :class:`Image`
|
||||
:rtype: :class:`bpy.types.Image`
|
||||
"""
|
||||
import os
|
||||
import bpy
|
||||
|
||||
@@ -252,10 +252,10 @@ def axis_conversion(from_forward='Y', from_up='Z', to_forward='Y', to_up='Z'):
|
||||
def axis_conversion_ensure(operator, forward_attr, up_attr):
|
||||
"""
|
||||
Function to ensure an operator has valid axis conversion settings, intended
|
||||
to be used from :class:`Operator.check`.
|
||||
to be used from :class:`bpy.types.Operator.check`.
|
||||
|
||||
:arg operator: the operator to access axis attributes from.
|
||||
:type operator: :class:`Operator`
|
||||
:type operator: :class:`bpy.types.Operator`
|
||||
:arg forward_attr: attribute storing the forward axis
|
||||
:type forward_attr: string
|
||||
:arg up_attr: attribute storing the up axis
|
||||
@@ -439,7 +439,7 @@ def path_reference_copy(copy_set, report=print):
|
||||
shutil.copy(file_src, file_dst)
|
||||
|
||||
|
||||
def unique_name(key, name, name_dict, name_max=-1, clean_func=None):
|
||||
def unique_name(key, name, name_dict, name_max=-1, clean_func=None, sep="."):
|
||||
"""
|
||||
Helper function for storing unique names which may have special characters
|
||||
stripped and restricted to a maximum length.
|
||||
@@ -456,6 +456,9 @@ def unique_name(key, name, name_dict, name_max=-1, clean_func=None):
|
||||
:type name_dict: dict
|
||||
:arg clean_func: Function to call on *name* before creating a unique value.
|
||||
:type clean_func: function
|
||||
:arg sep: Separator to use when between the name and a number when a
|
||||
duplicate name is found.
|
||||
:type sep: string
|
||||
"""
|
||||
name_new = name_dict.get(key)
|
||||
if name_new is None:
|
||||
@@ -466,14 +469,15 @@ def unique_name(key, name, name_dict, name_max=-1, clean_func=None):
|
||||
|
||||
if name_max == -1:
|
||||
while name_new in name_dict_values:
|
||||
name_new = "%s.%03d" % (name_new_orig, count)
|
||||
name_new = "%s%s%03d" % (name_new_orig, sep, count)
|
||||
count += 1
|
||||
else:
|
||||
name_new = name_new[:name_max]
|
||||
while name_new in name_dict_values:
|
||||
count_str = "%03d" % count
|
||||
name_new = "%.*s.%s" % (name_max - (len(count_str) + 1),
|
||||
name_new = "%.*s%s%s" % (name_max - (len(count_str) + 1),
|
||||
name_new_orig,
|
||||
sep,
|
||||
count_str,
|
||||
)
|
||||
count += 1
|
||||
|
||||
@@ -35,7 +35,7 @@ def mesh_linked_faces(mesh):
|
||||
other mesh elements within 1 mesh datablock.
|
||||
|
||||
:arg mesh: the mesh used to group with.
|
||||
:type mesh: :class:`Mesh`
|
||||
:type mesh: :class:`bpy.types.Mesh`
|
||||
:return: lists of lists containing faces.
|
||||
:rtype: list
|
||||
"""
|
||||
@@ -125,9 +125,9 @@ def edge_loops_from_faces(mesh, faces=None, seams=()):
|
||||
[[(0, 1), (4, 8), (3, 8)], ...]
|
||||
|
||||
:arg mesh: the mesh used to get edge loops from.
|
||||
:type mesh: :class:`Mesh`
|
||||
:type mesh: :class:`bpy.types.Mesh`
|
||||
:arg faces: optional face list to only use some of the meshes faces.
|
||||
:type faces: :class:`MeshFaces`, sequence or or NoneType
|
||||
:type faces: :class:`bpy.types.MeshFaces`, sequence or or NoneType
|
||||
:return: return a list of edge vertex index lists.
|
||||
:rtype: list
|
||||
"""
|
||||
@@ -426,7 +426,7 @@ def ngon_tesselate(from_data, indices, fix_loops=True):
|
||||
# See if its flipped the wrong way.
|
||||
flip = None
|
||||
for fi in fill:
|
||||
if flip != None:
|
||||
if flip is not None:
|
||||
break
|
||||
for i, vi in enumerate(fi):
|
||||
if vi == 0 and fi[i - 1] == 1:
|
||||
@@ -450,7 +450,7 @@ def face_random_points(num_points, faces):
|
||||
:arg num_points: the number of random points to generate on each face.
|
||||
:type int:
|
||||
:arg faces: list of the faces to generate points on.
|
||||
:type faces: :class:`MeshFaces`, sequence
|
||||
:type faces: :class:`bpy.types.MeshFaces`, sequence
|
||||
:return: list of random points over all faces.
|
||||
:rtype: list
|
||||
"""
|
||||
|
||||
@@ -33,11 +33,11 @@ def add_object_align_init(context, operator):
|
||||
Return a matrix using the operator settings and view context.
|
||||
|
||||
:arg context: The context to use.
|
||||
:type context: :class:`Context`
|
||||
:type context: :class:`bpy.types.Context`
|
||||
:arg operator: The operator, checked for location and rotation properties.
|
||||
:type operator: :class:`Operator`
|
||||
:type operator: :class:`bpy.types.Operator`
|
||||
:return: the matrix from the context and settings.
|
||||
:rtype: :class:`Matrix`
|
||||
:rtype: :class:`mathutils.Matrix`
|
||||
"""
|
||||
|
||||
from mathutils import Matrix, Vector, Euler
|
||||
@@ -92,13 +92,13 @@ def object_data_add(context, obdata, operator=None):
|
||||
location, rotation and layer.
|
||||
|
||||
:arg context: The context to use.
|
||||
:type context: :class:`Context`
|
||||
:type context: :class:`bpy.types.Context`
|
||||
:arg obdata: the data used for the new object.
|
||||
:type obdata: valid object data type or None.
|
||||
:arg operator: The operator, checked for location and rotation properties.
|
||||
:type operator: :class:`Operator`
|
||||
:type operator: :class:`bpy.types.Operator`
|
||||
:return: the newly created object in the scene.
|
||||
:rtype: :class:`ObjectBase`
|
||||
:rtype: :class:`bpy.types.ObjectBase`
|
||||
"""
|
||||
scene = context.scene
|
||||
|
||||
|
||||
@@ -31,14 +31,14 @@ def region_2d_to_vector_3d(region, rv3d, coord):
|
||||
coordinate.
|
||||
|
||||
:arg region: region of the 3D viewport, typically bpy.context.region.
|
||||
:type region: :class:`Region`
|
||||
:type region: :class:`bpy.types.Region`
|
||||
:arg rv3d: 3D region data, typically bpy.context.space_data.region_3d.
|
||||
:type rv3d: :class:`RegionView3D`
|
||||
:type rv3d: :class:`bpy.types.RegionView3D`
|
||||
:arg coord: 2d coordinates relative to the region:
|
||||
(event.mouse_region_x, event.mouse_region_y) for example.
|
||||
:type coord: 2d vector
|
||||
:return: normalized 3d vector.
|
||||
:rtype: :class:`Vector`
|
||||
:rtype: :class:`mathutils.Vector`
|
||||
"""
|
||||
from mathutils import Vector
|
||||
|
||||
@@ -65,9 +65,9 @@ def region_2d_to_location_3d(region, rv3d, coord, depth_location):
|
||||
*depth_location*.
|
||||
|
||||
:arg region: region of the 3D viewport, typically bpy.context.region.
|
||||
:type region: :class:`Region`
|
||||
:type region: :class:`bpy.types.Region`
|
||||
:arg rv3d: 3D region data, typically bpy.context.space_data.region_3d.
|
||||
:type rv3d: :class:`RegionView3D`
|
||||
:type rv3d: :class:`bpy.types.RegionView3D`
|
||||
:arg coord: 2d coordinates relative to the region;
|
||||
(event.mouse_region_x, event.mouse_region_y) for example.
|
||||
:type coord: 2d vector
|
||||
@@ -75,7 +75,7 @@ def region_2d_to_location_3d(region, rv3d, coord, depth_location):
|
||||
there is no defined depth with a 2d region input.
|
||||
:type depth_location: 3d vector
|
||||
:return: normalized 3d vector.
|
||||
:rtype: :class:`Vector`
|
||||
:rtype: :class:`mathutils.Vector`
|
||||
"""
|
||||
from mathutils import Vector
|
||||
from mathutils.geometry import intersect_point_line
|
||||
@@ -114,13 +114,13 @@ def location_3d_to_region_2d(region, rv3d, coord):
|
||||
Return the *region* relative 2d location of a 3d position.
|
||||
|
||||
:arg region: region of the 3D viewport, typically bpy.context.region.
|
||||
:type region: :class:`Region`
|
||||
:type region: :class:`bpy.types.Region`
|
||||
:arg rv3d: 3D region data, typically bpy.context.space_data.region_3d.
|
||||
:type rv3d: :class:`RegionView3D`
|
||||
:type rv3d: :class:`bpy.types.RegionView3D`
|
||||
:arg coord: 3d worldspace location.
|
||||
:type coord: 3d vector
|
||||
:return: 2d location
|
||||
:rtype: :class:`Vector`
|
||||
:rtype: :class:`mathutils.Vector`
|
||||
"""
|
||||
from mathutils import Vector
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class Library(bpy_types.ID):
|
||||
"curves", "grease_pencil", "groups", "images", \
|
||||
"lamps", "lattices", "materials", "metaballs", \
|
||||
"meshes", "node_groups", "objects", "scenes", \
|
||||
"sounds", "textures", "texts", "fonts", "worlds"
|
||||
"sounds", "speakers", "textures", "texts", "fonts", "worlds"
|
||||
|
||||
return tuple(id_block for attr in attr_links for id_block in getattr(bpy.data, attr) if id_block.library == self)
|
||||
|
||||
@@ -287,7 +287,7 @@ class EditBone(StructRNA, _GenericBone, metaclass=StructMetaPropGroup):
|
||||
Transform the the bones head, tail, roll and envalope (when the matrix has a scale component).
|
||||
|
||||
:arg matrix: 3x3 or 4x4 transformation matrix.
|
||||
:type matrix: :class:`Matrix`
|
||||
:type matrix: :class:`mathutils.Matrix`
|
||||
:arg scale: Scale the bone envalope by the matrix.
|
||||
:type scale: bool
|
||||
:arg roll: Correct the roll to point in the same relative direction to the head and tail.
|
||||
@@ -411,6 +411,16 @@ class Text(bpy_types.ID):
|
||||
TypeMap = {}
|
||||
|
||||
|
||||
class Sound(bpy_types.ID):
|
||||
__slots__ = ()
|
||||
|
||||
@property
|
||||
def factory(self):
|
||||
"""The aud.Factory object of the sound."""
|
||||
import aud
|
||||
return aud._sound_from_pointer(self.as_pointer())
|
||||
|
||||
|
||||
class RNAMeta(type):
|
||||
def __new__(cls, name, bases, classdict, **args):
|
||||
result = type.__new__(cls, name, bases, classdict)
|
||||
|
||||
@@ -179,7 +179,7 @@ def execute(context):
|
||||
|
||||
# special exception. its possible the command loaded a new user interface
|
||||
if hash(sc) != hash(context.space_data):
|
||||
return
|
||||
return {'FINISHED'}
|
||||
|
||||
bpy.ops.console.scrollback_append(text=sc.prompt + line, type='INPUT')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user