This commit is contained in:
Joerg Mueller 2010-08-13 10:50:29 +00:00
commit 47d38dbd20
235 changed files with 2201 additions and 1939 deletions

@ -316,12 +316,6 @@ IF(UNIX AND NOT APPLE)
SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing -Wno-char-subscripts")
IF(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
SET(PLATFORM_CFLAGS " -msse -msse2 ${PLATFORM_CFLAGS}")
ADD_DEFINITIONS(-D__SSE__)
ADD_DEFINITIONS(-D__MMX__)
ENDIF(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
SET(PLATFORM_LINKFLAGS "-pthread")
# Better warnings
@ -633,12 +627,6 @@ IF(WIN32)
SET(WITH_JACK OFF)
ENDIF(WITH_JACK)
IF(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
SET(PLATFORM_CFLAGS " -msse -msse2 ${PLATFORM_CFLAGS}")
ADD_DEFINITIONS(-D__SSE__)
ADD_DEFINITIONS(-D__MMX__)
ENDIF(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
ENDIF(MSVC)
ENDIF(WIN32)
@ -819,12 +807,6 @@ IF(APPLE)
SET(TIFF_LIBPATH ${TIFF}/lib)
ENDIF(WITH_IMAGE_TIFF)
IF(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
SET(PLATFORM_CFLAGS " -msse -msse2 ${PLATFORM_CFLAGS}")
ADD_DEFINITIONS(-D__SSE__)
ADD_DEFINITIONS(-D__MMX__)
ENDIF(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
SET(EXETYPE MACOSX_BUNDLE)
SET(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")
@ -868,9 +850,26 @@ IF(WITH_BUILDINFO)
ENDIF(BUILD_REV_RETURN)
ENDIF(WIN32)
ENDIF(WITH_BUILDINFO)
#-----------------------------------------------------------------------------
# Common.
IF(WITH_RAYOPTIMIZATION)
IF(CMAKE_COMPILER_IS_GNUCC)
IF(SUPPORT_SSE_BUILD)
SET(PLATFORM_CFLAGS " -msse ${PLATFORM_CFLAGS}")
ADD_DEFINITIONS(-D__SSE__)
ADD_DEFINITIONS(-D__MMX__)
ENDIF(SUPPORT_SSE_BUILD)
IF(SUPPORT_SSE2_BUILD)
SET(PLATFORM_CFLAGS " -msse2 ${PLATFORM_CFLAGS}")
ADD_DEFINITIONS(-D__SSE2__)
IF(NOT SUPPORT_SSE_BUILD) # dont double up
ADD_DEFINITIONS(-D__MMX__)
ENDIF(NOT SUPPORT_SSE_BUILD)
ENDIF(SUPPORT_SSE2_BUILD)
ENDIF(CMAKE_COMPILER_IS_GNUCC)
ENDIF(WITH_RAYOPTIMIZATION)
IF(WITH_IMAGE_OPENJPEG)
set(OPENJPEG ${CMAKE_SOURCE_DIR}/extern/libopenjpeg)
set(OPENJPEG_INC ${OPENJPEG})

@ -183,19 +183,38 @@ MACRO(SETUP_LIBLINKS
ENDMACRO(SETUP_LIBLINKS)
MACRO(TEST_SSE_SUPPORT)
INCLUDE(CheckCXXSourceCompiles)
INCLUDE(CheckCSourceRuns)
MESSAGE(STATUS "Detecting SSE support")
IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_REQUIRED_FLAGS "-msse -msse2")
ELSEIF(MSVC)
SET(CMAKE_REQUIRED_FLAGS "/arch:SSE2")
SET(CMAKE_REQUIRED_FLAGS "/arch:SSE2") # TODO, SSE 1 ?
ENDIF()
CHECK_CXX_SOURCE_COMPILES("
CHECK_C_SOURCE_RUNS("
#include <xmmintrin.h>
int main() { __m128 v = _mm_setzero_ps(); return 0; }"
SUPPORT_SSE_BUILD)
CHECK_C_SOURCE_RUNS("
#include <emmintrin.h>
int main() { __m128d v = _mm_setzero_pd(); return 0; }"
SUPPORT_SSE2_BUILD)
MESSAGE(STATUS "Detecting SSE support")
IF(SUPPORT_SSE_BUILD)
MESSAGE(STATUS " ...SSE support found.")
ELSE(SUPPORT_SSE_BUILD)
MESSAGE(STATUS " ...SSE support missing.")
ENDIF(SUPPORT_SSE_BUILD)
IF(SUPPORT_SSE2_BUILD)
MESSAGE(STATUS " ...SSE2 support found.")
ELSE(SUPPORT_SSE2_BUILD)
MESSAGE(STATUS " ...SSE2 support missing.")
ENDIF(SUPPORT_SSE2_BUILD)
ENDMACRO(TEST_SSE_SUPPORT)

@ -176,6 +176,9 @@ ifeq ($(OS),linux)
REL_CFLAGS += -O2
REL_CCFLAGS += -O2
NAN_DEPEND = true
ifeq ($(WITH_BF_RAYOPTIMIZATION), true)
CCFLAGS += -msse
endif
ifeq ($(CPU),alpha)
CFLAGS += -mieee
endif

@ -16,7 +16,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.

@ -16,7 +16,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.

@ -1114,13 +1114,13 @@ class Export3DS(bpy.types.Operator):
bl_idname = "export.autodesk_3ds"
bl_label = 'Export 3DS'
# List of operator properties, the attributes will be assigned
# to the class instance from the operator settings before calling.
filepath = StringProperty(name="File Path", description="Filepath used for exporting the 3DS file", maxlen= 1024, default= "")
check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
@classmethod
def poll(cls, context): # Poll isnt working yet
return context.active_object != None
def execute(self, context):
filepath = self.properties.filepath
filepath = bpy.path.ensure_ext(filepath, ".3ds")
@ -1129,23 +1129,23 @@ class Export3DS(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
wm = context.manager
wm.add_fileselect(self)
import os
if not self.properties.is_property_set("filepath"):
self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".3ds"
context.manager.add_fileselect(self)
return {'RUNNING_MODAL'}
@classmethod
def poll(cls, context): # Poll isnt working yet
return context.active_object != None
# Add to a menu
def menu_func(self, context):
default_path = os.path.splitext(bpy.data.filepath)[0] + ".3ds"
self.layout.operator(Export3DS.bl_idname, text="3D Studio (.3ds)").filepath = default_path
self.layout.operator(Export3DS.bl_idname, text="3D Studio (.3ds)")
def register():
bpy.types.INFO_MT_file_export.append(menu_func)
def unregister():
bpy.types.INFO_MT_file_export.remove(menu_func)

@ -55,7 +55,7 @@ import math # math.pi
import shutil # for file copying
import bpy
from mathutils import Vector, Euler, Matrix, RotationMatrix
from mathutils import Vector, Euler, Matrix
def copy_file(source, dest):
# XXX - remove, can use shutil
@ -107,19 +107,19 @@ def eulerRadToDeg(eul):
mtx4_identity = Matrix()
# testing
mtx_x90 = RotationMatrix( math.pi/2, 3, 'X') # used
#mtx_x90n = RotationMatrix(-90, 3, 'x')
#mtx_y90 = RotationMatrix( 90, 3, 'y')
#mtx_y90n = RotationMatrix(-90, 3, 'y')
#mtx_z90 = RotationMatrix( 90, 3, 'z')
#mtx_z90n = RotationMatrix(-90, 3, 'z')
mtx_x90 = Matrix.Rotation( math.pi/2, 3, 'X') # used
#mtx_x90n = Matrix.Rotation(-90, 3, 'x')
#mtx_y90 = Matrix.Rotation( 90, 3, 'y')
#mtx_y90n = Matrix.Rotation(-90, 3, 'y')
#mtx_z90 = Matrix.Rotation( 90, 3, 'z')
#mtx_z90n = Matrix.Rotation(-90, 3, 'z')
#mtx4_x90 = RotationMatrix( 90, 4, 'x')
mtx4_x90n = RotationMatrix(-math.pi/2, 4, 'X') # used
#mtx4_y90 = RotationMatrix( 90, 4, 'y')
mtx4_y90n = RotationMatrix(-math.pi/2, 4, 'Y') # used
mtx4_z90 = RotationMatrix( math.pi/2, 4, 'Z') # used
mtx4_z90n = RotationMatrix(-math.pi/2, 4, 'Z') # used
#mtx4_x90 = Matrix.Rotation( 90, 4, 'x')
mtx4_x90n = Matrix.Rotation(-math.pi/2, 4, 'X') # used
#mtx4_y90 = Matrix.Rotation( 90, 4, 'y')
mtx4_y90n = Matrix.Rotation(-math.pi/2, 4, 'Y') # used
mtx4_z90 = Matrix.Rotation( math.pi/2, 4, 'Z') # used
mtx4_z90n = Matrix.Rotation(-math.pi/2, 4, 'Z') # used
# def strip_path(p):
# return p.split('\\')[-1].split('/')[-1]
@ -562,7 +562,7 @@ def write(filename, batch_objects = None, \
elif type =='CAMERA':
# elif ob and type =='Camera':
y = matrix_rot * Vector((0.0, 1.0, 0.0))
matrix_rot = RotationMatrix(math.pi/2, 3, y) * matrix_rot
matrix_rot = Matrix.Rotation(math.pi/2, 3, y) * matrix_rot
return matrix_rot
@ -664,7 +664,7 @@ def write(filename, batch_objects = None, \
rot = tuple(matrix_rot.to_euler())
elif ob and ob.type =='Camera':
y = matrix_rot * Vector((0.0, 1.0, 0.0))
matrix_rot = RotationMatrix(math.pi/2, 3, y) * matrix_rot
matrix_rot = Matrix.Rotation(math.pi/2, 3, y) * matrix_rot
rot = tuple(matrix_rot.to_euler())
else:
rot = tuple(matrix_rot.to_euler())
@ -3404,8 +3404,11 @@ class ExportFBX(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
wm = context.manager
wm.add_fileselect(self)
import os
if not self.properties.is_property_set("filepath"):
self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".fbx"
context.manager.add_fileselect(self)
return {'RUNNING_MODAL'}
@ -3439,8 +3442,7 @@ class ExportFBX(bpy.types.Operator):
def menu_func(self, context):
default_path = os.path.splitext(bpy.data.filepath)[0] + ".fbx"
self.layout.operator(ExportFBX.bl_idname, text="Autodesk FBX (.fbx)").filepath = default_path
self.layout.operator(ExportFBX.bl_idname, text="Autodesk FBX (.fbx)")
def register():

@ -185,15 +185,16 @@ class ExportMDD(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
wm = context.manager
wm.add_fileselect(self)
import os
if not self.properties.is_property_set("filepath"):
self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".mdd"
context.manager.add_fileselect(self)
return {'RUNNING_MODAL'}
def menu_func(self, context):
import os
default_path = os.path.splitext(bpy.data.filepath)[0] + ".mdd"
self.layout.operator(ExportMDD.bl_idname, text="Lightwave Point Cache (.mdd)").filepath = default_path
self.layout.operator(ExportMDD.bl_idname, text="Lightwave Point Cache (.mdd)")
def register():

@ -363,7 +363,7 @@ def write_file(filepath, objects, scene,
file.write('mtllib %s\n' % ( mtlfilepath.split('\\')[-1].split('/')[-1] ))
if EXPORT_ROTX90:
mat_xrot90= mathutils.RotationMatrix(-math.pi/2, 4, 'X')
mat_xrot90= mathutils.Matrix.Rotation(-math.pi/2, 4, 'X')
# Initialize totals, these are updated each object
totverts = totuvco = totno = 1
@ -960,14 +960,16 @@ class ExportOBJ(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
wm = context.manager
wm.add_fileselect(self)
import os
if not self.properties.is_property_set("filepath"):
self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".obj"
context.manager.add_fileselect(self)
return {'RUNNING_MODAL'}
def menu_func(self, context):
default_path = os.path.splitext(bpy.data.filepath)[0] + ".obj"
self.layout.operator(ExportOBJ.bl_idname, text="Wavefront (.obj)").filepath = default_path
self.layout.operator(ExportOBJ.bl_idname, text="Wavefront (.obj)")
def register():

@ -293,8 +293,11 @@ class ExportPLY(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
wm = context.manager
wm.add_fileselect(self)
import os
if not self.properties.is_property_set("filepath"):
self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".ply"
context.manager.add_fileselect(self)
return {'RUNNING_MODAL'}
def draw(self, context):
@ -310,9 +313,7 @@ class ExportPLY(bpy.types.Operator):
def menu_func(self, context):
import os
default_path = os.path.splitext(bpy.data.filepath)[0] + ".ply"
self.layout.operator(ExportPLY.bl_idname, text="Stanford (.ply)").filepath = default_path
self.layout.operator(ExportPLY.bl_idname, text="Stanford (.ply)")
def register():

@ -81,7 +81,7 @@ from export_3ds import create_derived_objects, free_derived_objects
#
DEG2RAD=0.017453292519943295
MATWORLD= mathutils.RotationMatrix(-90, 4, 'X')
MATWORLD= mathutils.Matrix.Rotation(-90, 4, 'X')
####################################
# Global Variables
@ -1205,14 +1205,16 @@ class ExportX3D(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
wm = context.manager
wm.add_fileselect(self)
import os
if not self.properties.is_property_set("filepath"):
self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".x3d"
context.manager.add_fileselect(self)
return {'RUNNING_MODAL'}
def menu_func(self, context):
default_path = os.path.splitext(bpy.data.filepath)[0] + ".x3d"
self.layout.operator(ExportX3D.bl_idname, text="X3D Extensible 3D (.x3d)").filepath = default_path
self.layout.operator(ExportX3D.bl_idname, text="X3D Extensible 3D (.x3d)")
def register():

@ -23,7 +23,7 @@ from math import radians
import bpy
import mathutils
from mathutils import Vector, Euler, Matrix, RotationMatrix, TranslationMatrix
from mathutils import Vector, Euler, Matrix
class bvh_node_class(object):
@ -78,7 +78,7 @@ MATRIX_IDENTITY_4x4 = Matrix([1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0,
def eulerRotate(x, y, z, rot_order):
# Clamp all values between 0 and 360, values outside this raise an error.
mats = [RotationMatrix(x, 3, 'X'), RotationMatrix(y, 3, 'Y'), RotationMatrix(z, 3, 'Z')]
mats = [Matrix.Rotation(x, 3, 'X'), Matrix.Rotation(y, 3, 'Y'), Matrix.Rotation(z, 3, 'Z')]
return (MATRIX_IDENTITY_3x3 * mats[rot_order[0]] * (mats[rot_order[1]] * (mats[rot_order[2]]))).to_euler()
# Should work but doesnt!
@ -529,7 +529,7 @@ def bvh_node_dict2armature(context, bvh_nodes, ROT_MODE='XYZ', IMPORT_START_FRAM
prev_euler[i] = euler
if bvh_node.has_loc:
pose_bone.location = (bone_rest_matrix_inv * TranslationMatrix(Vector((lx, ly, lz)) - bvh_node.rest_head_local)).translation_part()
pose_bone.location = (bone_rest_matrix_inv * Matrix.Translation(Vector((lx, ly, lz)) - bvh_node.rest_head_local)).translation_part()
if bvh_node.has_loc:
pose_bone.keyframe_insert("location")

@ -141,7 +141,7 @@ import os
import time
import struct
from import_scene_obj import unpack_face_list, load_image
from import_scene_obj import load_image
import bpy
import mathutils
@ -312,10 +312,10 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
contextMaterial = None
contextMatrix_rot = None # Blender.mathutils.Matrix(); contextMatrix.identity()
#contextMatrix_tx = None # Blender.mathutils.Matrix(); contextMatrix.identity()
contextMesh_vertls = None
contextMesh_vertls = None # flat array: (verts * 3)
contextMesh_facels = None
contextMeshMaterials = {} # matname:[face_idxs]
contextMeshUV = None
contextMeshUV = None # flat array (verts * 2)
TEXTURE_DICT = {}
MATDICT = {}
@ -333,113 +333,69 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
# print STRUCT_SIZE_4x3MAT, ' STRUCT_SIZE_4x3MAT'
def putContextMesh(myContextMesh_vertls, myContextMesh_facels, myContextMeshMaterials):
bmesh = bpy.data.meshes.new(contextObName)
if myContextMesh_vertls:
materialFaces = set() # faces that have a material. Can optimize?
# Now make copies with assigned materils.
def makeMeshMaterialCopy(matName, faces):
'''
Make a new mesh with only face the faces that use this material.
faces can be any iterable object - containing ints.
'''
faceVertUsers = [False] * len(myContextMesh_vertls)
ok = 0
for fIdx in faces:
for vindex in myContextMesh_facels[fIdx]:
faceVertUsers[vindex] = True
if matName != None: # if matName is none then this is a set(), meaning we are using the untextured faces and do not need to store textured faces.
materialFaces.add(fIdx)
ok = 1
if not ok:
return
myVertMapping = {}
vertMappingIndex = 0
vertsToUse = [i for i in range(len(myContextMesh_vertls)) if faceVertUsers[i]]
myVertMapping = {ii: i for i, ii in enumerate(vertsToUse)}
tempName= '%s_%s' % (contextObName, matName) # matName may be None.
bmesh = bpy.data.meshes.new(tempName)
if matName == None:
img = None
bmesh.add_geometry(len(myContextMesh_vertls)//3, 0, len(myContextMesh_facels))
bmesh.verts.foreach_set("co", myContextMesh_vertls)
eekadoodle_faces = []
for v1, v2, v3 in myContextMesh_facels:
eekadoodle_faces.extend([v3, v1, v2, 0] if v3 == 0 else [v1, v2, v3, 0])
bmesh.faces.foreach_set("verts_raw", eekadoodle_faces)
if bmesh.faces and contextMeshUV:
bmesh.add_uv_texture()
uv_faces = bmesh.active_uv_texture.data[:]
else:
bmat = MATDICT[matName][1]
bmesh.add_material(bmat)
# bmesh.materials = [bmat]
try: img = TEXTURE_DICT[bmat.name]
except: img = None
uv_faces = None
# bmesh_verts = bmesh.verts
if len(vertsToUse):
bmesh.add_geometry(len(vertsToUse), 0, len(faces))
for mat_idx, (matName, faces) in enumerate(myContextMeshMaterials.items()):
if matName is None:
bmesh.add_material(None)
else:
bmat = MATDICT[matName][1]
bmesh.add_material(bmat) # can be None
img = TEXTURE_DICT.get(bmat.name)
if uv_faces and img:
for fidx in faces:
bmesh.faces[fidx].material_index = mat_idx
uf = uv_faces[fidx]
uf.image = img
uf.tex = True
else:
for fidx in faces:
bmesh.faces[fidx].material_index = mat_idx
if uv_faces:
for fidx, uf in enumerate(uv_faces):
face = myContextMesh_facels[fidx]
v1, v2, v3 = face
# eekadoodle
if v3 == 0:
v1, v2, v3 = v3, v1, v2
uf.uv1 = contextMeshUV[v1 * 2:(v1 * 2) + 2]
uf.uv2 = contextMeshUV[v2 * 2:(v2 * 2) + 2]
uf.uv3 = contextMeshUV[v3 * 2:(v3 * 2) + 2]
# always a tri
# XXX why add extra vertex?
# bmesh_verts.extend( [Vector()] )
bmesh.verts.foreach_set("co", [x for tup in [myContextMesh_vertls[i] for i in vertsToUse] for x in tup])
# bmesh_verts.extend( [myContextMesh_vertls[i] for i in vertsToUse] )
ob = bpy.data.objects.new(tempName, bmesh)
SCN.objects.link(ob)
'''
if contextMatrix_tx:
ob.setMatrix(contextMatrix_tx)
'''
if contextMatrix_rot:
ob.matrix_world = contextMatrix_rot
# +1 because of DUMMYVERT
bmesh.faces.foreach_set("verts_raw", unpack_face_list([[myVertMapping[vindex] for vindex in myContextMesh_facels[fIdx]] for fIdx in faces]))
# face_mapping = bmesh.faces.extend( [ [ bmesh_verts[ myVertMapping[vindex]+1] for vindex in myContextMesh_facels[fIdx]] for fIdx in faces ], indexList=True )
if bmesh.faces and (contextMeshUV or img):
bmesh.add_uv_texture()
for ii, i in enumerate(faces):
# Mapped index- faces may have not been added- if so, then map to the correct index
# BUGGY API - face_mapping is not always the right length
# map_index = face_mapping[ii]
if 1:
# if map_index != None:
targetFace = bmesh.faces[ii]
# targetFace = bmesh.faces[map_index]
uf = bmesh.active_uv_texture.data[ii]
if contextMeshUV:
# v.index-1 because of the DUMMYVERT
uvs = [contextMeshUV[vindex] for vindex in myContextMesh_facels[i]]
if len(myContextMesh_facels[i]) == 3:
uf.uv1, uf.uv2, uf.uv3, uf.uv4 = uvs + [(0.0, 0.0)]
else:
uf.uv1, uf.uv2, uf.uv3, uf.uv4 = uvs
# targetFace.uv = [contextMeshUV[vindex] for vindex in myContextMesh_facels[i]]
if img:
uf.image = img
# to get this image to show up in 'Textured' shading mode
uf.tex = True
# bmesh.transform(contextMatrix)
ob = bpy.data.objects.new(tempName, bmesh)
SCN.objects.link(ob)
# ob = SCN_OBJECTS.new(bmesh, tempName)
'''
if contextMatrix_tx:
ob.setMatrix(contextMatrix_tx)
'''
if contextMatrix_rot:
ob.matrix_world = contextMatrix_rot
importedObjects.append(ob)
bmesh.update()
# bmesh.calcNormals()
for matName, faces in myContextMeshMaterials.items():
makeMeshMaterialCopy(matName, faces)
if len(materialFaces) != len(myContextMesh_facels):
# Invert material faces.
makeMeshMaterialCopy(None, set(range(len( myContextMesh_facels ))) - materialFaces)
#raise 'Some UnMaterialed faces', len(contextMesh.faces)
importedObjects.append(ob)
bmesh.update()
#a spare chunk
new_chunk = chunk()
@ -667,14 +623,10 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
new_chunk.bytes_read += 2
# print 'number of verts: ', num_verts
def getvert():
temp_data = struct.unpack('<3f', file.read(STRUCT_SIZE_3FLOAT))
new_chunk.bytes_read += STRUCT_SIZE_3FLOAT #12: 3 floats x 4 bytes each
return temp_data
#contextMesh.verts.extend( [Vector(),] ) # DUMMYVERT! - remove when blenders internals are fixed.
contextMesh_vertls = [getvert() for i in range(num_verts)]
contextMesh_vertls = struct.unpack('<%df' % (num_verts * 3), file.read(STRUCT_SIZE_3FLOAT * num_verts))
new_chunk.bytes_read += STRUCT_SIZE_3FLOAT * num_verts
# dummyvert is not used atm!
#print 'object verts: bytes read: ', new_chunk.bytes_read
elif (new_chunk.ID == OBJECT_FACES):
@ -684,15 +636,11 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
new_chunk.bytes_read += 2
#print 'number of faces: ', num_faces
def getface():
# print '\ngetting a face'
temp_data = file.read(STRUCT_SIZE_4UNSIGNED_SHORT)
new_chunk.bytes_read += STRUCT_SIZE_4UNSIGNED_SHORT #4 short ints x 2 bytes each
v1,v2,v3,dummy = struct.unpack('<4H', temp_data)
return v1, v2, v3
contextMesh_facels = [ getface() for i in range(num_faces) ]
# print '\ngetting a face'
temp_data = file.read(STRUCT_SIZE_4UNSIGNED_SHORT * num_faces)
new_chunk.bytes_read += STRUCT_SIZE_4UNSIGNED_SHORT * num_faces #4 short ints x 2 bytes each
contextMesh_facels = struct.unpack('<%dH' % (num_faces * 4), temp_data)
contextMesh_facels = [contextMesh_facels[i - 3:i] for i in range(3, (num_faces * 4) + 3, 4)]
elif (new_chunk.ID == OBJECT_MATERIAL):
# print 'elif (new_chunk.ID == OBJECT_MATERIAL):'
@ -703,12 +651,11 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
num_faces_using_mat = struct.unpack('<H', temp_data)[0]
new_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT
def getmat():
temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT)
new_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT
return struct.unpack('<H', temp_data)[0]
temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT * num_faces_using_mat)
new_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT * num_faces_using_mat
contextMeshMaterials[material_name]= [ getmat() for i in range(num_faces_using_mat) ]
contextMeshMaterials[material_name]= struct.unpack("<%dH" % (num_faces_using_mat), temp_data)
#look up the material in all the materials
@ -717,12 +664,9 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
num_uv = struct.unpack('<H', temp_data)[0]
new_chunk.bytes_read += 2
def getuv():
temp_data = file.read(STRUCT_SIZE_2FLOAT)
new_chunk.bytes_read += STRUCT_SIZE_2FLOAT #2 float x 4 bytes each
return mathutils.Vector( struct.unpack('<2f', temp_data) )
contextMeshUV = [ getuv() for i in range(num_uv) ]
temp_data = file.read(STRUCT_SIZE_2FLOAT * num_uv)
new_chunk.bytes_read += STRUCT_SIZE_2FLOAT * num_uv
contextMeshUV = struct.unpack('<%df' % (num_uv * 2), temp_data)
elif (new_chunk.ID == OBJECT_TRANS_MATRIX):
# How do we know the matrix size? 54 == 4x4 48 == 4x3
@ -771,7 +715,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
#print contextMatrix_rot
contextMatrix_rot.invert()
#print contextMatrix_rot
#contextMatrix_tx = Blender.mathutils.TranslationMatrix(0.5 * Blender.mathutils.Vector(data[9:]))
#contextMatrix_tx = mathutils.Matrix.Translation(0.5 * Blender.mathutils.Vector(data[9:]))
#contextMatrix_tx.invert()
#tx.invert()
@ -806,7 +750,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
# FINISHED LOOP
# There will be a number of objects still not added
if contextMesh_facels != None:
if CreateBlenderObject:
putContextMesh(contextMesh_vertls, contextMesh_facels, contextMeshMaterials)
def load_3ds(filename, context, IMPORT_CONSTRAIN_BOUNDS=10.0, IMAGE_SEARCH=True, APPLY_MATRIX=False):

@ -82,23 +82,21 @@ def unpack_list(list_of_tuples):
# same as above except that it adds 0 for triangle faces
def unpack_face_list(list_of_tuples):
l = []
# allocate the entire list
flat_ls = [0] * (len(list_of_tuples) * 4)
i = 0
for t in list_of_tuples:
face = [i for i in t]
if len(t) == 3:
if t[2] == 0:
t = t[1], t[2], t[0]
else: # assuem quad
if t[3] == 0 or t[2] == 0:
t = t[2], t[3], t[0], t[1]
if len(face) != 3 and len(face) != 4:
raise RuntimeError("{0} vertices in face.".format(len(face)))
# rotate indices if the 4th is 0
if len(face) == 4 and face[3] == 0:
face = [face[3], face[0], face[1], face[2]]
if len(face) == 3:
face.append(0)
l.extend(face)
return l
flat_ls[i:i + len(t)] = t
i += 4
return flat_ls
def BPyMesh_ngon(from_data, indices, PREF_FIX_LOOPS= True):
'''
@ -305,24 +303,28 @@ def load_image(imagepath, dirname):
if os.path.exists(imagepath):
return bpy.data.images.load(imagepath)
variants = [os.path.join(dirname, imagepath), os.path.join(dirname, os.path.basename(imagepath))]
variants = [imagepath, os.path.join(dirname, imagepath), os.path.join(dirname, os.path.basename(imagepath))]
for path in variants:
if os.path.exists(path):
return bpy.data.images.load(path)
else:
print(path, "doesn't exist")
for filepath in variants:
for nfilepath in (filepath, bpy.path.resolve_ncase(filepath)):
if os.path.exists(nfilepath):
return bpy.data.images.load(nfilepath)
# TODO comprehensiveImageLoad also searched in bpy.config.textureDir
return None
def obj_image_load(imagepath, DIR, IMAGE_SEARCH):
if '_' in imagepath:
image= load_image(imagepath.replace('_', ' '), DIR)
if image: return image
if image:
return image
return load_image(imagepath, DIR)
image = load_image(imagepath, DIR)
if image:
return image
print("failed to load '%s' doesn't exist", imagepath)
return None
# def obj_image_load(imagepath, DIR, IMAGE_SEARCH):
# '''
@ -765,14 +767,12 @@ def create_mesh(scn, new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_l
blender_tface= me.uv_textures[0].data[i]
if context_material:
image, has_data= unique_material_images[context_material]
image, has_data = unique_material_images[context_material]
if image: # Can be none if the material dosnt have an image.
blender_tface.image= image
# blender_face.image= image
if has_data:
# if has_data and image.depth == 32:
blender_tface.image = image
blender_tface.tex = True
if has_data and image.depth == 32:
blender_tface.transp = 'ALPHA'
# blender_face.transp |= ALPHA
# BUG - Evil eekadoodle problem where faces that have vert index 0 location at 3 or 4 are shuffled.
if len(face_vert_loc_indicies)==4:
@ -1596,8 +1596,7 @@ class IMPORT_OT_obj(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
wm = context.manager
wm.add_fileselect(self)
context.manager.add_fileselect(self)
return {'RUNNING_MODAL'}

@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENCE BLOCK *****

@ -25,11 +25,11 @@ import mathutils
def add_object_align_init(context, operator):
if operator and operator.properties.is_property_set("location") and operator.properties.is_property_set("rotation"):
location = mathutils.TranslationMatrix(mathutils.Vector(operator.properties.location))
location = mathutils.Matrix.Translation(mathutils.Vector(operator.properties.location))
rotation = mathutils.Euler(operator.properties.rotation).to_matrix().resize4x4()
else:
# TODO, local view cursor!
location = mathutils.TranslationMatrix(context.scene.cursor_location)
location = mathutils.Matrix.Translation(context.scene.cursor_location)
if context.user_preferences.edit.object_align == 'VIEW' and context.space_data.type == 'VIEW_3D':
rotation = context.space_data.region_3d.view_matrix.rotation_part().invert().resize4x4()

@ -30,8 +30,6 @@ import sys as _sys
from _bpy import blend_paths
from _bpy import script_paths as _bpy_script_paths
_TEST_XML = _bpy.app.debug
def _test_import(module_name, loaded_modules):
import traceback
import time
@ -54,35 +52,6 @@ def _test_import(module_name, loaded_modules):
loaded_modules.add(mod.__name__) # should match mod.__name__ too
return mod
if _TEST_XML:
# TEST CODE
def _test_import_xml(path, f, loaded_modules):
import bpy_xml_ui
import traceback
f_full = _os.path.join(path, f)
_bpy_types._register_immediate = True
try:
classes = bpy_xml_ui.load_xml(f_full)
except:
traceback.print_exc()
classes = []
_bpy_types._register_immediate = False
if classes:
mod_name = f.split(".")[0]
# fake module
mod = type(traceback)(mod_name)
mod.__file__ = f_full
for cls in classes:
setattr(mod, cls.__name__, cls)
loaded_modules.add(mod_name)
_sys.modules[mod_name] = mod
mod.register = lambda: None # quiet errors
return mod
def modules_from_path(path, loaded_modules):
"""
@ -110,10 +79,6 @@ def modules_from_path(path, loaded_modules):
else:
mod = None
if _TEST_XML:
if mod is None and f.endswith(".xml"):
mod = _test_import_xml(path, f, loaded_modules)
if mod:
modules.append(mod)

@ -525,7 +525,7 @@ class Text(bpy_types.ID):
def as_string(self):
"""Return the text as a string."""
return "\n".join(line.line for line in self.lines)
return "\n".join(line.body for line in self.lines)
def from_string(self, string):
"""Replace text with this string."""

@ -1,151 +0,0 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
"""
This module translates XML into blender/ui function calls.
"""
import xml.dom.minidom
import bpy as _bpy
def parse_rna(prop, value):
if prop.type == 'FLOAT':
value = float(value)
elif prop.type == 'INT':
value = int(value)
elif prop.type == 'BOOLEAN':
if value not in ("true", "false"):
raise Exception("invalid bool value: %s", value)
value = bool(value == "true")
elif prop.type in ('STRING', 'ENUM'):
pass
elif prop.type == 'POINTER':
value = eval("_bpy." + value)
else:
raise Exception("type not supported %s.%s" % (prop.identifier, prop.type))
return value
def parse_args(base, xml_node):
args = {}
rna_params = base.bl_rna.functions[xml_node.tagName].parameters
for key, value in xml_node.attributes.items():
args[key] = parse_rna(rna_params[key], value)
return args
def ui_xml(base, xml_node):
name = xml_node.tagName
prop = base.bl_rna.properties.get(name)
if name in base.bl_rna.properties:
attr = xml_node.attributes.get("expr")
if attr:
value = attr.value
value = eval(value, {"context": _bpy.context})
setattr(base, name, value)
else:
attr = xml_node.attributes['value']
value = attr.value
value = parse_rna(prop, value)
setattr(base, name, value)
else:
func_new = getattr(base, name)
kw_args = parse_args(base, xml_node)
base_new = func_new(**kw_args) # call blender func
if xml_node.hasChildNodes():
ui_xml_list(base_new, xml_node.childNodes)
def ui_xml_list(base, xml_nodes):
import bpy
for node in xml_nodes:
if node.nodeType not in (node.TEXT_NODE, node.COMMENT_NODE):
ui_xml(base, node)
bpy.N = node
def test(layout):
uixml = xml.dom.minidom.parseString(open("/mnt/test/blender-svn/blender/release/scripts/ui/test.xml", 'r').read())
panel = uixml.getElementsByTagName('panel')[0]
ui_xml_list(layout, panel.childNodes)
def load_xml(filepath):
classes = []
fn = open(filepath, 'r')
data = fn.read()
uixml = xml.dom.minidom.parseString(data).getElementsByTagName("ui")[0]
fn.close()
def draw_xml(self, context):
node = self._xml_node.getElementsByTagName("draw")[0]
ui_xml_list(self.layout, node.childNodes)
def draw_header_xml(self, context):
node = self._xml_node.getElementsByTagName("draw_header")[0]
ui_xml_list(self.layout, node.childNodes)
for node in uixml.childNodes:
if node.nodeType not in (node.TEXT_NODE, node.COMMENT_NODE):
name = node.tagName
class_name = node.attributes["identifier"].value
if name == "panel":
class_dict = {
"bl_label": node.attributes["label"].value,
"bl_region_type": node.attributes["region_type"].value,
"bl_space_type": node.attributes["space_type"].value,
"bl_context": node.attributes["context"].value,
"bl_default_closed": ((node.attributes["default_closed"].value == "true") if "default_closed" in node.attributes else False),
"draw": draw_xml,
"_xml_node": node
}
if node.getElementsByTagName("draw_header"):
class_dict["draw_header"] = draw_header_xml
# will register instantly
class_new = type(class_name, (_bpy.types.Panel,), class_dict)
elif name == "menu":
class_dict = {
"bl_label": node.attributes["label"].value,
"draw": draw_xml,
"_xml_node": node
}
# will register instantly
class_new = type(class_name, (_bpy.types.Menu,), class_dict)
elif name == "header":
class_dict = {
"bl_label": node.attributes["label"].value,
"bl_space_type": node.attributes["space_type"].value,
"draw": draw_xml,
"_xml_node": node
}
# will register instantly
class_new = type(class_name, (_bpy.types.Header,), class_dict)
else:
raise Exception("invalid id found '%s': expected a value in ('header', 'panel', 'menu)'" % name)
classes.append(class_new)
return classes

@ -0,0 +1,204 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
"""
This module translates a python like XML representation into XML
or simple python blender/ui function calls.
sometag(arg=10) [
another()
another(key="value")
]
# converts into ...
<sometag arg="10">
<another/>
<another key="value" />
</sometag>
"""
TAG, ARGS, CHILDREN = range(3)
class ReturnStore(tuple):
def __getitem__(self, key):
# single item get's
if type(key) is ReturnStore:
key = (key, )
if type(key) is tuple:
children = self[CHILDREN]
if children:
raise Exception("Only a single __getitem__ is allowed on the ReturnStore")
else:
children[:] = key
return self
else:
return tuple.__getitem__(self, key)
class FunctionStore(object):
def __call__(self, **kwargs):
return ReturnStore((self.__class__.__name__, kwargs, []))
def tag_vars(tags, module=__name__):
return {tag: type(tag, (FunctionStore, ), {"__module__": module})() for tag in tags}
def tag_module(mod_name, tags):
import sys
from types import ModuleType
mod = ModuleType(mod_name)
sys.modules[mod_name] = mod
dict_values = tag_vars(tags, mod_name)
mod.__dict__.update(dict_values)
return mod
def toxml(py_data, indent=" "):
if len(py_data) != 1 or type(py_data) != list:
raise Exception("Expected a list with one member")
def _to_xml(py_item, xml_node=None):
if xml_node is None:
xml_node = newdoc.createElement(py_item[TAG])
for key, value in py_item[ARGS].items():
xml_node.setAttribute(key, str(value))
for py_item_child in py_item[CHILDREN]:
xml_node.appendChild(_to_xml(py_item_child))
return xml_node
def _to_xml_iter(xml_parent, data_ls):
for py_item in data_ls:
xml_node = newdoc.createElement(py_item[TAG])
# ok if its empty
_to_xml_iter(xml_node, py_item[CHILDREN])
import xml.dom.minidom
impl = xml.dom.minidom.getDOMImplementation()
newdoc = impl.createDocument(None, py_data[0][TAG], None)
_to_xml(py_data[0], newdoc.documentElement)
return newdoc.documentElement.toprettyxml(indent=" ")
def fromxml(data):
def _fromxml_kwargs(xml_node):
kwargs = {}
for key, value in xml_node.attributes.items():
kwargs[key] = value
return kwargs
def _fromxml(xml_node):
py_item = (xml_node.tagName, _fromxml_kwargs(xml_node), [])
#_fromxml_iter(py_item, xml_node.childNodes)
for xml_node_child in xml_node.childNodes:
if xml_node_child.nodeType not in (xml_node_child.TEXT_NODE, xml_node_child.COMMENT_NODE):
py_item[CHILDREN].append(_fromxml(xml_node_child))
return py_item
import xml.dom.minidom
xml_doc = xml.dom.minidom.parseString(data)
return [_fromxml(xml_doc.documentElement)]
def topretty_py(py_data, indent=" "):
if len(py_data) != 1:
raise Exception("Expected a list with one member")
lines = []
def _to_kwargs(kwargs):
return ", ".join([("%s=%s" % (key, repr(value))) for key, value in sorted(kwargs.items())])
def _topretty(py_item, indent_ctx, last):
if py_item[CHILDREN]:
lines.append("%s%s(%s) [" % (indent_ctx, py_item[TAG], _to_kwargs(py_item[ARGS])))
py_item_last = py_item[CHILDREN][-1]
for py_item_child in py_item[CHILDREN]:
_topretty(py_item_child, indent_ctx + indent, (py_item_child is py_item_last))
lines.append("%s]%s" % (indent_ctx, ("" if last else ",")))
else:
lines.append("%s%s(%s)%s" % (indent_ctx, py_item[TAG], _to_kwargs(py_item[ARGS]), ("" if last else ",")))
_topretty(py_data[0], "", True)
return "\n".join(lines)
if __name__ == "__main__":
# testing code.
tag_module("bpyml_test", ("ui", "prop", "row", "column", "active", "separator", "split"))
from bpyml_test import *
draw = [
ui() [
split() [
column() [
prop(data='context.scene.render', property='stamp_time', text='Time'),
prop(data='context.scene.render', property='stamp_date', text='Date'),
prop(data='context.scene.render', property='stamp_render_time', text='RenderTime'),
prop(data='context.scene.render', property='stamp_frame', text='Frame'),
prop(data='context.scene.render', property='stamp_scene', text='Scene'),
prop(data='context.scene.render', property='stamp_camera', text='Camera'),
prop(data='context.scene.render', property='stamp_filename', text='Filename'),
prop(data='context.scene.render', property='stamp_marker', text='Marker'),
prop(data='context.scene.render', property='stamp_sequencer_strip', text='Seq. Strip')
],
column() [
active(expr='context.scene.render.render_stamp'),
prop(data='context.scene.render', property='stamp_foreground', slider=True),
prop(data='context.scene.render', property='stamp_background', slider=True),
separator(),
prop(data='context.scene.render', property='stamp_font_size', text='Font Size')
]
],
split(percentage=0.2) [
prop(data='context.scene.render', property='stamp_note', text='Note'),
row() [
active(expr='context.scene.render.stamp_note'),
prop(data='context.scene.render', property='stamp_note_text', text='')
]
]
]
]
xml_data = toxml(draw)
print(xml_data) # xml version
py_data = fromxml(xml_data)
print(py_data) # converted back to py
xml_data = toxml(py_data)
print(xml_data) # again back to xml
py_data = fromxml(xml_data) # pretty python version
print(topretty_py(py_data))

@ -0,0 +1,100 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import bpy as _bpy
import bpyml
from bpyml import TAG, ARGS, CHILDREN
from types import ModuleType
_uilayout_rna = _bpy.types.UILayout.bl_rna
_uilayout_tags = ["ui"] + \
_uilayout_rna.properties.keys() + \
_uilayout_rna.functions.keys()
# these need to be imported directly
# >>> from bpyml_ui.locals import *
locals = bpyml.tag_module("%s.locals" % __name__ , _uilayout_tags)
def _parse_rna(prop, value):
if prop.type == 'FLOAT':
value = float(value)
elif prop.type == 'INT':
value = int(value)
elif prop.type == 'BOOLEAN':
if value in (True, False):
pass
else:
if value not in ("True", "False"):
raise Exception("invalid bool value: %s" % value)
value = bool(value == "True")
elif prop.type in ('STRING', 'ENUM'):
pass
elif prop.type == 'POINTER':
value = eval("_bpy." + value)
else:
raise Exception("type not supported %s.%s" % (prop.identifier, prop.type))
return value
def _parse_rna_args(base, py_node):
rna_params = base.bl_rna.functions[py_node[TAG]].parameters
args = {}
for key, value in py_node[ARGS].items():
args[key] = _parse_rna(rna_params[key], value)
return args
def _call_recursive(context, base, py_node):
prop = base.bl_rna.properties.get(py_node[TAG])
if py_node[TAG] in base.bl_rna.properties:
value = py_node[ARGS].get("expr")
if value:
value = eval(value, {"context": _bpy.context})
setattr(base, py_node[TAG], value)
else:
value = py_node[ARGS]['value'] # have to have this
setattr(base, name, value)
else:
args = _parse_rna_args(base, py_node)
func_new = getattr(base, py_node[TAG])
base_new = func_new(**args) # call blender func
if base_new is not None:
for py_node_child in py_node[CHILDREN]:
_call_recursive(context, base_new, py_node_child)
class BPyML_BaseUI():
'''
This is a mix-in class that defines a draw function
which checks for draw_data
'''
def draw(self, context):
layout = self.layout
for py_node in self.draw_data[CHILDREN]:
_call_recursive(context, layout, py_node)
def draw_header(self, context):
layout = self.layout
for py_node in self.draw_header_data[CHILDREN]:
_call_recursive(context, layout, py_node)

@ -147,7 +147,7 @@ def deform(obj, definitions, base_names, options):
def main(obj, bone_definition, base_names, options):
from mathutils import Vector, RotationMatrix
from mathutils import Vector, Matrix
from math import radians, pi
arm = obj.data
@ -264,7 +264,7 @@ def main(obj, bone_definition, base_names, options):
# Rotate the rev chain 180 about the by the first bones center point
pivot = (rv_chain.spine_01_e.head + rv_chain.spine_01_e.tail) * 0.5
matrix = RotationMatrix(radians(180), 3, 'X')
matrix = Matrix.Rotation(radians(180), 3, 'X')
for i, attr in enumerate(rv_chain.attr_names): # similar to neck
spine_e = getattr(rv_chain, attr + "_e")
# use the first bone as the pivot

@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
@ -22,7 +22,7 @@ import bpy
from rigify import RigifyError
from rigify_utils import bone_class_instance, copy_bone_simple
from rna_prop_ui import rna_idprop_ui_prop_get
from mathutils import Vector, RotationMatrix
from mathutils import Vector, Matrix
from math import radians, pi
# not used, defined for completeness

@ -131,7 +131,7 @@ def execute(context):
is_multiline = False
try:
line = line_object.line
line = line_object.body
# run the console, "\n" executes a multiline statement
line_exec = line if line.strip() else "\n"
@ -208,13 +208,13 @@ def autocomplete(context):
try:
current_line = sc.history[-1]
line = current_line.line
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
current_line.line, current_line.current_character, scrollback = \
current_line.body, current_line.current_character, scrollback = \
intellisense.expand(
line=current_line.line,
line=current_line.body,
cursor=current_line.current_character,
namespace=console.locals,
private=bpy.app.debug)
@ -226,7 +226,7 @@ def autocomplete(context):
# Separate automplete output by command prompts
if scrollback != '':
bpy.ops.console.scrollback_append(text=sc.prompt + current_line.line, type='INPUT')
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

@ -47,7 +47,7 @@ def execute(context):
sc = context.space_data
try:
line = sc.history[-1].line
line = sc.history[-1].body
except:
return {'CANCELLED'}

@ -22,7 +22,7 @@
# <pep8 compliant>
from mathutils import Matrix, Vector, RotationMatrix
from mathutils import Matrix, Vector
import time
import geometry
import bpy
@ -275,15 +275,15 @@ def testNewVecLs2DRotIsBetter(vecs, mat=-1, bestAreaSoFar = -1):
# Takes a list of faces that make up a UV island and rotate
# until they optimally fit inside a square.
ROTMAT_2D_POS_90D = RotationMatrix( radians(90.0), 2)
ROTMAT_2D_POS_45D = RotationMatrix( radians(45.0), 2)
ROTMAT_2D_POS_90D = Matrix.Rotation( radians(90.0), 2)
ROTMAT_2D_POS_45D = Matrix.Rotation( radians(45.0), 2)
RotMatStepRotation = []
rot_angle = 22.5 #45.0/2
while rot_angle > 0.1:
RotMatStepRotation.append([\
RotationMatrix( radians(rot_angle), 2),\
RotationMatrix( radians(-rot_angle), 2)])
Matrix.Rotation( radians(rot_angle), 2),\
Matrix.Rotation( radians(-rot_angle), 2)])
rot_angle = rot_angle/2.0

@ -6,7 +6,7 @@
# for keyboard event comparison
# import GameKeys
# support for Vector(), Matrix() types and advanced functions like ScaleMatrix(...) and RotationMatrix(...)
# support for Vector(), Matrix() types and advanced functions like Matrix.Scale(...) and Matrix.Rotation(...)
# import mathutils
# for functions like getWindowWidth(), getWindowHeight()

@ -51,11 +51,6 @@ class DATA_PT_context_arm(ArmatureButtonsPanel, bpy.types.Panel):
split.separator()
class DATA_PT_custom_props_arm(ArmatureButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
class DATA_PT_skeleton(ArmatureButtonsPanel, bpy.types.Panel):
bl_label = "Skeleton"
@ -285,6 +280,11 @@ class DATA_PT_onion_skinning(OnionSkinButtonsPanel): #, bpy.types.Panel): # inhe
self.draw_settings(context, ob.pose.animation_visualisation, bones=True)
class DATA_PT_custom_props_arm(ArmatureButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
def register():
pass

@ -95,12 +95,13 @@ class DATA_PT_template(bpy.types.Panel):
subsubrow.operator("pose.metarig_assign", text="Assign")
subsubrow.operator("pose.metarig_clear", text="Clear")
subsubrow = subrow.split(percentage=0.8)
subsubrow.operator("pose.metarig_sample_add", text="Sample").metarig_type = self.templates[pose_templates.active_template_index]
subsubrow.operator("pose.metarig_sample_add", text="All").metarig_type = "" # self.templates[pose_templates.active_template_index]
if self.templates:
subsubrow = subrow.split(percentage=0.8)
subsubrow.operator("pose.metarig_sample_add", text="Sample").metarig_type = self.templates[pose_templates.active_template_index]
subsubrow.operator("pose.metarig_sample_add", text="All").metarig_type = "" # self.templates[pose_templates.active_template_index]
sub = row.column(align=True)
sub.operator("pose.metarig_reload", icon="FILE_REFRESH", text="")
sub = row.column(align=True)
sub.operator("pose.metarig_reload", icon="FILE_REFRESH", text="")
# operators

@ -47,18 +47,6 @@ class BONE_PT_context_bone(BoneButtonsPanel, bpy.types.Panel):
row.prop(bone, "name", text="")
class BONE_PT_custom_props(BoneButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@property
def _context_path(self):
obj = bpy.context.object
if obj and obj.mode == 'POSE':
return "active_pose_bone"
else:
return "active_bone"
class BONE_PT_transform(BoneButtonsPanel, bpy.types.Panel):
bl_label = "Transform"
@ -354,6 +342,18 @@ class BONE_PT_deform(BoneButtonsPanel, bpy.types.Panel):
col.prop(bone, "cyclic_offset")
class BONE_PT_custom_props(BoneButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@property
def _context_path(self):
obj = bpy.context.object
if obj and obj.mode == 'POSE':
return "active_pose_bone"
else:
return "active_bone"
def register():
pass

@ -53,11 +53,6 @@ class DATA_PT_context_camera(CameraButtonsPanel, bpy.types.Panel):
split.separator()
class DATA_PT_custom_props_camera(CameraButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
class DATA_PT_camera(CameraButtonsPanel, bpy.types.Panel):
bl_label = "Lens"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@ -137,6 +132,11 @@ class DATA_PT_camera_display(CameraButtonsPanel, bpy.types.Panel):
sub.prop(cam, "passepartout_alpha", text="Alpha", slider=True)
class DATA_PT_custom_props_camera(CameraButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
def register():
pass

@ -69,11 +69,6 @@ class DATA_PT_context_curve(CurveButtonsPanel, bpy.types.Panel):
split.separator()
class DATA_PT_custom_props_curve(CurveButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
class DATA_PT_shape_curve(CurveButtonsPanel, bpy.types.Panel):
bl_label = "Shape"
@ -385,6 +380,11 @@ class DATA_PT_textboxes(CurveButtonsPanel, bpy.types.Panel):
row.operator("font.textbox_remove", text='', icon='X', emboss=False).index = i
class DATA_PT_custom_props_curve(CurveButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
def register():
pass

@ -40,13 +40,6 @@ class DataButtonsPanel():
return context.lamp and (engine in cls.COMPAT_ENGINES)
class DATA_PT_preview(DataButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
def draw(self, context):
self.layout.template_preview(context.lamp)
class DATA_PT_context_lamp(DataButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
@ -69,9 +62,12 @@ class DATA_PT_context_lamp(DataButtonsPanel, bpy.types.Panel):
split.separator()
class DATA_PT_custom_props_lamp(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
class DATA_PT_preview(DataButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
def draw(self, context):
self.layout.template_preview(context.lamp)
class DATA_PT_lamp(DataButtonsPanel, bpy.types.Panel):
@ -387,6 +383,11 @@ class DATA_PT_falloff_curve(DataButtonsPanel, bpy.types.Panel):
self.layout.template_curve_mapping(lamp, "falloff_curve")
class DATA_PT_custom_props_lamp(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
def register():
pass

@ -51,11 +51,6 @@ class DATA_PT_context_lattice(DataButtonsPanel, bpy.types.Panel):
split.separator()
class DATA_PT_custom_props_lattice(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
class DATA_PT_lattice(DataButtonsPanel, bpy.types.Panel):
bl_label = "Lattice"
@ -85,6 +80,11 @@ class DATA_PT_lattice(DataButtonsPanel, bpy.types.Panel):
row = layout.row()
row.prop(lat, "outside")
row.prop_object(lat, "vertex_group", context.object, "vertex_groups", text="")
class DATA_PT_custom_props_lattice(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
def register():

@ -79,11 +79,6 @@ class DATA_PT_context_mesh(MeshButtonsPanel, bpy.types.Panel):
split.separator()
class DATA_PT_custom_props_mesh(MeshButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
class DATA_PT_normals(MeshButtonsPanel, bpy.types.Panel):
bl_label = "Normals"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@ -351,6 +346,11 @@ class DATA_PT_vertex_colors(MeshButtonsPanel, bpy.types.Panel):
layout.prop(lay, "name")
class DATA_PT_custom_props_mesh(MeshButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
def register():
pass

@ -51,11 +51,6 @@ class DATA_PT_context_metaball(DataButtonsPanel, bpy.types.Panel):
split.separator()
class DATA_PT_custom_props_metaball(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
class DATA_PT_metaball(DataButtonsPanel, bpy.types.Panel):
bl_label = "Metaball"
@ -120,6 +115,11 @@ class DATA_PT_metaball_element(DataButtonsPanel, bpy.types.Panel):
col.prop(metaelem, "size_y", text="Y")
class DATA_PT_custom_props_metaball(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
def register():
pass

@ -24,7 +24,7 @@ from rna_prop_ui import PropertyPanel
def active_node_mat(mat):
# TODO, 2.4x has a pipeline section, for 2.5 we need to communicate
# which settings from node-materials are used
if mat:
if mat is not None:
mat_node = mat.active_node_material
if mat_node:
return mat_node
@ -63,14 +63,6 @@ class MaterialButtonsPanel():
return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES)
class MATERIAL_PT_preview(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
def draw(self, context):
self.layout.template_preview(context.material)
class MATERIAL_PT_context_material(MaterialButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
@ -127,203 +119,15 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel, bpy.types.Panel):
if mat:
layout.prop(mat, "type", expand=True)
class MATERIAL_PT_custom_props(MaterialButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "material"
class MATERIAL_PT_shading(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Shading"
class MATERIAL_PT_preview(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@classmethod
def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
self.layout.template_preview(context.material)
mat = active_node_mat(context.material)
if mat.type in ('SURFACE', 'WIRE'):
split = layout.split()
col = split.column()
sub = col.column()
sub.active = not mat.shadeless
sub.prop(mat, "emit")
sub.prop(mat, "ambient")
sub = col.column()
sub.prop(mat, "translucency")
col = split.column()
col.prop(mat, "shadeless")
sub = col.column()
sub.active = not mat.shadeless
sub.prop(mat, "tangent_shading")
sub.prop(mat, "cubic")
elif mat.type == 'HALO':
layout.prop(mat, "alpha")
class MATERIAL_PT_strand(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Strand"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
def poll(cls, context):
mat = context.material
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = context.material # dont use node material
tan = mat.strand
split = layout.split()
col = split.column()
sub = col.column(align=True)
sub.label(text="Size:")
sub.prop(tan, "root_size", text="Root")
sub.prop(tan, "tip_size", text="Tip")
sub.prop(tan, "min_size", text="Minimum")
sub.prop(tan, "blender_units")
sub = col.column()
sub.active = (not mat.shadeless)
sub.prop(tan, "tangent_shading")
col.prop(tan, "shape")
col = split.column()
col.label(text="Shading:")
col.prop(tan, "width_fade")
ob = context.object
if ob and ob.type == 'MESH':
col.prop_object(tan, "uv_layer", ob.data, "uv_textures", text="")
else:
col.prop(tan, "uv_layer", text="")
col.separator()
sub = col.column()
sub.active = (not mat.shadeless)
sub.prop(tan, "surface_diffuse")
sub = col.column()
sub.active = tan.surface_diffuse
sub.prop(tan, "blend_distance", text="Distance")
class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Physics"
COMPAT_ENGINES = {'BLENDER_GAME'}
@classmethod
def poll(cls, context):
return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
phys = context.material.physics # dont use node material
split = layout.split()
col = split.column()
col.prop(phys, "distance")
col.prop(phys, "friction")
col.prop(phys, "align_to_normal")
col = split.column()
col.prop(phys, "force", slider=True)
col.prop(phys, "elasticity", slider=True)
col.prop(phys, "damp", slider=True)
class MATERIAL_PT_options(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Options"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@classmethod
def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = active_node_mat(context.material)
split = layout.split()
col = split.column()
col.prop(mat, "traceable")
col.prop(mat, "full_oversampling")
col.prop(mat, "use_sky")
col.prop(mat, "exclude_mist")
col.prop(mat, "invert_z")
sub = col.row()
sub.prop(mat, "z_offset")
sub.active = mat.transparency and mat.transparency_method == 'Z_TRANSPARENCY'
sub = col.column(align=True)
sub.label(text="Light Group:")
sub.prop(mat, "light_group", text="")
row = sub.row()
row.active = bool(mat.light_group)
row.prop(mat, "light_group_exclusive", text="Exclusive")
col = split.column()
col.prop(mat, "face_texture")
sub = col.column()
sub.active = mat.face_texture
sub.prop(mat, "face_texture_alpha")
col.separator()
col.prop(mat, "vertex_color_paint")
col.prop(mat, "vertex_color_light")
col.prop(mat, "object_color")
class MATERIAL_PT_shadow(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Shadow"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@classmethod
def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = active_node_mat(context.material)
split = layout.split()
col = split.column()
col.prop(mat, "shadows", text="Receive")
col.prop(mat, "receive_transparent_shadows", text="Receive Transparent")
col.prop(mat, "only_shadow", text="Shadows Only")
col.prop(mat, "cast_shadows_only", text="Cast Only")
col.prop(mat, "shadow_casting_alpha", text="Casting Alpha")
col = split.column()
col.prop(mat, "cast_buffer_shadows")
sub = col.column()
sub.active = mat.cast_buffer_shadows
sub.prop(mat, "shadow_buffer_bias", text="Buffer Bias")
col.prop(mat, "ray_shadow_bias", text="Auto Ray Bias")
sub = col.column()
sub.active = (not mat.ray_shadow_bias)
sub.prop(mat, "shadow_ray_bias", text="Ray Bias")
col.prop(mat, "cast_approximate")
class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Diffuse"
@ -457,113 +261,41 @@ class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel):
row.prop(mat, "specular_ramp_factor", text="Factor")
class MATERIAL_PT_sss(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Subsurface Scattering"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
class MATERIAL_PT_shading(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Shading"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@classmethod
def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
mat = active_node_mat(context.material)
sss = mat.subsurface_scattering
self.layout.active = (not mat.shadeless)
self.layout.prop(sss, "enabled", text="")
return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = active_node_mat(context.material)
sss = mat.subsurface_scattering
layout.active = (sss.enabled) and (not mat.shadeless)
if mat.type in ('SURFACE', 'WIRE'):
split = layout.split()
row = layout.row().split()
sub = row.row(align=True).split(percentage=0.75)
sub.menu("MATERIAL_MT_sss_presets", text=bpy.types.MATERIAL_MT_sss_presets.bl_label)
sub.operator("material.sss_preset_add", text="", icon="ZOOMIN")
col = split.column()
sub = col.column()
sub.active = not mat.shadeless
sub.prop(mat, "emit")
sub.prop(mat, "ambient")
sub = col.column()
sub.prop(mat, "translucency")
split = layout.split()
col = split.column()
col.prop(mat, "shadeless")
sub = col.column()
sub.active = not mat.shadeless
sub.prop(mat, "tangent_shading")
sub.prop(mat, "cubic")
col = split.column()
col.prop(sss, "ior")
col.prop(sss, "scale")
col.prop(sss, "color", text="")
col.prop(sss, "radius", text="RGB Radius", expand=True)
col = split.column()
sub = col.column(align=True)
sub.label(text="Blend:")
sub.prop(sss, "color_factor", text="Color")
sub.prop(sss, "texture_factor", text="Texture")
sub.label(text="Scattering Weight:")
sub.prop(sss, "front")
sub.prop(sss, "back")
col.separator()
col.prop(sss, "error_tolerance", text="Error")
class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Mirror"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
raym = active_node_mat(context.material).raytrace_mirror
self.layout.prop(raym, "enabled", text="")
def draw(self, context):
layout = self.layout
mat = active_node_mat(context.material)
raym = mat.raytrace_mirror
layout.active = raym.enabled
split = layout.split()
col = split.column()
col.prop(raym, "reflect_factor")
col.prop(mat, "mirror_color", text="")
col = split.column()
col.prop(raym, "fresnel")
sub = col.column()
sub.active = raym.fresnel > 0
sub.prop(raym, "fresnel_factor", text="Blend")
split = layout.split()
col = split.column()
col.separator()
col.prop(raym, "depth")
col.prop(raym, "distance", text="Max Dist")
col.separator()
sub = col.split(percentage=0.4)
sub.active = raym.distance > 0.0
sub.label(text="Fade To:")
sub.prop(raym, "fade_to", text="")
col = split.column()
col.label(text="Gloss:")
col.prop(raym, "gloss_factor", text="Amount")
sub = col.column()
sub.active = raym.gloss_factor < 1.0
sub.prop(raym, "gloss_threshold", text="Threshold")
sub.prop(raym, "gloss_samples", text="Samples")
sub.prop(raym, "gloss_anisotropic", text="Anisotropic")
elif mat.type == 'HALO':
layout.prop(mat, "alpha")
class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
@ -625,39 +357,116 @@ class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
sub = col.column()
sub.active = rayt.gloss_factor < 1.0
sub.prop(rayt, "gloss_threshold", text="Threshold")
sub.prop(rayt, "gloss_samples", text="Samples")
sub.prop(rayt, "gloss_samples", text="Samples")
class MATERIAL_PT_transp_game(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Transparency"
class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Mirror"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_GAME'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
return mat and (engine in cls.COMPAT_ENGINES)
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
mat = active_node_mat(context.material)
raym = active_node_mat(context.material).raytrace_mirror
self.layout.prop(mat, "transparency", text="")
self.layout.prop(raym, "enabled", text="")
def draw(self, context):
layout = self.layout
mat = active_node_mat(context.material)
rayt = mat.raytrace_transparency
raym = mat.raytrace_mirror
row = layout.row()
row.active = mat.transparency and (not mat.shadeless)
row.prop(mat, "transparency_method", expand=True)
layout.active = raym.enabled
split = layout.split()
col = split.column()
col.prop(mat, "alpha")
col.prop(raym, "reflect_factor")
col.prop(mat, "mirror_color", text="")
col = split.column()
col.prop(raym, "fresnel")
sub = col.column()
sub.active = raym.fresnel > 0
sub.prop(raym, "fresnel_factor", text="Blend")
split = layout.split()
col = split.column()
col.separator()
col.prop(raym, "depth")
col.prop(raym, "distance", text="Max Dist")
col.separator()
sub = col.split(percentage=0.4)
sub.active = raym.distance > 0.0
sub.label(text="Fade To:")
sub.prop(raym, "fade_to", text="")
col = split.column()
col.label(text="Gloss:")
col.prop(raym, "gloss_factor", text="Amount")
sub = col.column()
sub.active = raym.gloss_factor < 1.0
sub.prop(raym, "gloss_threshold", text="Threshold")
sub.prop(raym, "gloss_samples", text="Samples")
sub.prop(raym, "gloss_anisotropic", text="Anisotropic")
class MATERIAL_PT_sss(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Subsurface Scattering"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
mat = active_node_mat(context.material)
sss = mat.subsurface_scattering
self.layout.active = (not mat.shadeless)
self.layout.prop(sss, "enabled", text="")
def draw(self, context):
layout = self.layout
mat = active_node_mat(context.material)
sss = mat.subsurface_scattering
layout.active = (sss.enabled) and (not mat.shadeless)
row = layout.row().split()
sub = row.row(align=True).split(percentage=0.75)
sub.menu("MATERIAL_MT_sss_presets", text=bpy.types.MATERIAL_MT_sss_presets.bl_label)
sub.operator("material.sss_preset_add", text="", icon="ZOOMIN")
split = layout.split()
col = split.column()
col.prop(sss, "ior")
col.prop(sss, "scale")
col.prop(sss, "color", text="")
col.prop(sss, "radius", text="RGB Radius", expand=True)
col = split.column()
sub = col.column(align=True)
sub.label(text="Blend:")
sub.prop(sss, "color_factor", text="Color")
sub.prop(sss, "texture_factor", text="Texture")
sub.label(text="Scattering Weight:")
sub.prop(sss, "front")
sub.prop(sss, "back")
col.separator()
col.prop(sss, "error_tolerance", text="Error")
class MATERIAL_PT_halo(MaterialButtonsPanel, bpy.types.Panel):
@ -744,6 +553,193 @@ class MATERIAL_PT_flare(MaterialButtonsPanel, bpy.types.Panel):
col.prop(halo, "flare_subsize", text="Subsize")
class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Physics"
COMPAT_ENGINES = {'BLENDER_GAME'}
@classmethod
def poll(cls, context):
return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
phys = context.material.physics # dont use node material
split = layout.split()
col = split.column()
col.prop(phys, "distance")
col.prop(phys, "friction")
col.prop(phys, "align_to_normal")
col = split.column()
col.prop(phys, "force", slider=True)
col.prop(phys, "elasticity", slider=True)
col.prop(phys, "damp", slider=True)
class MATERIAL_PT_strand(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Strand"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
def poll(cls, context):
mat = context.material
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = context.material # dont use node material
tan = mat.strand
split = layout.split()
col = split.column()
sub = col.column(align=True)
sub.label(text="Size:")
sub.prop(tan, "root_size", text="Root")
sub.prop(tan, "tip_size", text="Tip")
sub.prop(tan, "min_size", text="Minimum")
sub.prop(tan, "blender_units")
sub = col.column()
sub.active = (not mat.shadeless)
sub.prop(tan, "tangent_shading")
col.prop(tan, "shape")
col = split.column()
col.label(text="Shading:")
col.prop(tan, "width_fade")
ob = context.object
if ob and ob.type == 'MESH':
col.prop_object(tan, "uv_layer", ob.data, "uv_textures", text="")
else:
col.prop(tan, "uv_layer", text="")
col.separator()
sub = col.column()
sub.active = (not mat.shadeless)
sub.prop(tan, "surface_diffuse")
sub = col.column()
sub.active = tan.surface_diffuse
sub.prop(tan, "blend_distance", text="Distance")
class MATERIAL_PT_options(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Options"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@classmethod
def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = active_node_mat(context.material)
split = layout.split()
col = split.column()
col.prop(mat, "traceable")
col.prop(mat, "full_oversampling")
col.prop(mat, "use_sky")
col.prop(mat, "exclude_mist")
col.prop(mat, "invert_z")
sub = col.row()
sub.prop(mat, "z_offset")
sub.active = mat.transparency and mat.transparency_method == 'Z_TRANSPARENCY'
sub = col.column(align=True)
sub.label(text="Light Group:")
sub.prop(mat, "light_group", text="")
row = sub.row()
row.active = bool(mat.light_group)
row.prop(mat, "light_group_exclusive", text="Exclusive")
col = split.column()
col.prop(mat, "face_texture")
sub = col.column()
sub.active = mat.face_texture
sub.prop(mat, "face_texture_alpha")
col.separator()
col.prop(mat, "vertex_color_paint")
col.prop(mat, "vertex_color_light")
col.prop(mat, "object_color")
class MATERIAL_PT_shadow(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Shadow"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@classmethod
def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = active_node_mat(context.material)
split = layout.split()
col = split.column()
col.prop(mat, "shadows", text="Receive")
col.prop(mat, "receive_transparent_shadows", text="Receive Transparent")
col.prop(mat, "only_shadow", text="Shadows Only")
col.prop(mat, "cast_shadows_only", text="Cast Only")
col.prop(mat, "shadow_casting_alpha", text="Casting Alpha")
col = split.column()
col.prop(mat, "cast_buffer_shadows")
sub = col.column()
sub.active = mat.cast_buffer_shadows
sub.prop(mat, "shadow_buffer_bias", text="Buffer Bias")
col.prop(mat, "ray_shadow_bias", text="Auto Ray Bias")
sub = col.column()
sub.active = (not mat.ray_shadow_bias)
sub.prop(mat, "shadow_ray_bias", text="Ray Bias")
col.prop(mat, "cast_approximate")
class MATERIAL_PT_transp_game(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Transparency"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_GAME'}
@classmethod
def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
return mat and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
mat = active_node_mat(context.material)
self.layout.prop(mat, "transparency", text="")
def draw(self, context):
layout = self.layout
mat = active_node_mat(context.material)
rayt = mat.raytrace_transparency
row = layout.row()
row.active = mat.transparency and (not mat.shadeless)
row.prop(mat, "transparency_method", expand=True)
split = layout.split()
col = split.column()
col.prop(mat, "alpha")
class VolumeButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
@ -897,6 +893,11 @@ class MATERIAL_PT_volume_options(VolumeButtonsPanel, bpy.types.Panel):
row.prop(mat, "light_group_exclusive", text="Exclusive")
class MATERIAL_PT_custom_props(MaterialButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "material"
def register():
pass

@ -252,7 +252,7 @@ class OBJECT_PT_animation(ObjectButtonsPanel, bpy.types.Panel):
col.prop(ob, "time_offset_edit", text="Edit")
row = col.row()
row.prop(ob, "time_offset_particle", text="Particle")
row.active = len(ob.particle_systems) != 0
row.active = bool(ob.particle_systems)
row = col.row()
row.prop(ob, "time_offset_parent", text="Parent")
row.active = (ob.parent is not None)

@ -440,7 +440,7 @@ class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel):
# Audio:
sub = layout.column()
if rd.ffmpeg_format not in ('MP3'):
if rd.ffmpeg_format not in ('MP3', ):
sub.prop(rd, "ffmpeg_audio_codec", text="Audio Codec")
sub.separator()

@ -1,79 +0,0 @@
<ui>
<panel identifier="RENDER_PT_stamp_test" label="Stamp (XML)" space_type="PROPERTIES" region_type="WINDOW" context="render" default_closed="true">
<draw_header>
<prop data="context.scene.render" property="render_stamp" text=""/>
</draw_header>
<draw>
<split>
<column>
<prop data="context.scene.render" property="stamp_time" text="Time"/>
<prop data="context.scene.render" property="stamp_date" text="Date"/>
<prop data="context.scene.render" property="stamp_render_time" text="RenderTime"/>
<prop data="context.scene.render" property="stamp_frame" text="Frame"/>
<prop data="context.scene.render" property="stamp_scene" text="Scene"/>
<prop data="context.scene.render" property="stamp_camera" text="Camera"/>
<prop data="context.scene.render" property="stamp_filename" text="Filename"/>
<prop data="context.scene.render" property="stamp_marker" text="Marker"/>
<prop data="context.scene.render" property="stamp_sequencer_strip" text="Seq. Strip"/>
</column>
<column>
<active expr="context.scene.render.render_stamp"/>
<prop data="context.scene.render" property="stamp_foreground" slider="true"/>
<prop data="context.scene.render" property="stamp_background" slider="true"/>
<separator/>
<prop data="context.scene.render" property="stamp_font_size" text="Font Size"/>
</column>
</split>
<split percentage="0.2">
<prop data="context.scene.render" property="stamp_note" text="Note"/>
<row>
<active expr="context.scene.render.stamp_note"/>
<prop data="context.scene.render" property="stamp_note_text" text=""/>
</row>
</split>
</draw>
</panel>
<panel identifier="RENDER_PT_dimensions_test" label="Dimensions (XML)" space_type="PROPERTIES" region_type="WINDOW" context="render">
<draw>
<row align="true">
<menu menu="RENDER_MT_presets"/>
<operator operator="render.preset_add" text="" icon="ZOOMIN"/>
</row>
<split>
<column>
<column align="true">
<label text="Resolution:"/>
<prop data="context.scene.render" property="resolution_x" text="X"/>
<prop data="context.scene.render" property="resolution_y" text="Y"/>
<prop data="context.scene.render" property="resolution_percentage" text=""/>
<label text="Aspect Ratio:"/>
<prop data="context.scene.render" property="pixel_aspect_x" text="X"/>
<prop data="context.scene.render" property="pixel_aspect_y" text="Y"/>
</column>
<row>
<prop data="context.scene.render" property="use_border" text="Border"/>
<row>
<active expr="context.scene.render.use_border"/>
<prop data="context.scene.render" property="crop_to_border" text="Crop"/>
</row>
</row>
</column>
<column>
<column align="true">
<label text="Frame Range:"/>
<prop data="context.scene" property="frame_start" text="Start"/>
<prop data="context.scene" property="frame_end" text="End"/>
<prop data="context.scene" property="frame_step" text="Step"/>
<label text="Frame Rate:"/>
<prop data="context.scene.render" property="fps"/>
<prop data="context.scene.render" property="fps_base" text="/"/>
</column>
</column>
</split>
</draw>
</panel>
</ui>

@ -43,11 +43,6 @@ class SCENE_PT_scene(SceneButtonsPanel, bpy.types.Panel):
layout.prop(scene, "set", text="Background")
class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "scene"
class SCENE_PT_unit(SceneButtonsPanel, bpy.types.Panel):
bl_label = "Units"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@ -205,6 +200,11 @@ class SCENE_PT_simplify(SceneButtonsPanel, bpy.types.Panel):
col.prop(rd, "simplify_ao_sss", text="AO and SSS")
class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "scene"
from bpy.props import *

@ -74,23 +74,6 @@ class TextureButtonsPanel():
return tex and (tex.type != 'NONE' or tex.use_nodes) and (context.scene.render.engine in cls.COMPAT_ENGINES)
class TEXTURE_PT_preview(TextureButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
def draw(self, context):
layout = self.layout
tex = context.texture
slot = getattr(context, "texture_slot", None)
idblock = context_tex_datablock(context)
if idblock:
layout.template_preview(tex, parent=idblock, slot=slot)
else:
layout.template_preview(tex, slot=slot)
class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
@ -155,9 +138,21 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel):
split.prop(tex, "type", text="")
class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel, bpy.types.Panel):
class TEXTURE_PT_preview(TextureButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "texture"
def draw(self, context):
layout = self.layout
tex = context.texture
slot = getattr(context, "texture_slot", None)
idblock = context_tex_datablock(context)
if idblock:
layout.template_preview(tex, parent=idblock, slot=slot)
else:
layout.template_preview(tex, slot=slot)
class TEXTURE_PT_colors(TextureButtonsPanel, bpy.types.Panel):
@ -989,6 +984,11 @@ class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel, bpy.types.Panel):
col.prop(pd, "turbulence_strength")
class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "texture"
def register():
pass

@ -33,19 +33,6 @@ class WorldButtonsPanel():
return (rd.engine in cls.COMPAT_ENGINES)
class WORLD_PT_preview(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
def poll(cls, context):
rd = context.scene.render
return (context.world) and (not rd.use_game_engine) and (rd.engine in cls.COMPAT_ENGINES)
def draw(self, context):
self.layout.template_preview(context.world)
class WORLD_PT_context_world(WorldButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
@ -70,9 +57,23 @@ class WORLD_PT_context_world(WorldButtonsPanel, bpy.types.Panel):
split.template_ID(space, "pin_id")
class WORLD_PT_custom_props(WorldButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "world"
class WORLD_PT_preview(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
def poll(cls, context):
rd = context.scene.render
return (context.world) and (not rd.use_game_engine) and (rd.engine in cls.COMPAT_ENGINES)
def draw(self, context):
self.layout.template_preview(context.world)
class WORLD_PT_world(WorldButtonsPanel, bpy.types.Panel):
@ -96,62 +97,6 @@ class WORLD_PT_world(WorldButtonsPanel, bpy.types.Panel):
row.column().prop(world, "ambient_color")
class WORLD_PT_mist(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Mist"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw_header(self, context):
world = context.world
self.layout.prop(world.mist, "use_mist", text="")
def draw(self, context):
layout = self.layout
world = context.world
layout.active = world.mist.use_mist
split = layout.split()
col = split.column()
col.prop(world.mist, "intensity", slider=True)
col.prop(world.mist, "start")
col = split.column()
col.prop(world.mist, "depth")
col.prop(world.mist, "height")
layout.prop(world.mist, "falloff")
class WORLD_PT_stars(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Stars"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw_header(self, context):
world = context.world
self.layout.prop(world.stars, "use_stars", text="")
def draw(self, context):
layout = self.layout
world = context.world
layout.active = world.stars.use_stars
split = layout.split()
col = split.column()
col.prop(world.stars, "size")
col.prop(world.stars, "color_randomization", text="Colors")
col = split.column()
col.prop(world.stars, "min_distance", text="Min. Dist")
col.prop(world.stars, "average_separation", text="Separation")
class WORLD_PT_ambient_occlusion(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Ambient Occlusion"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@ -262,6 +207,67 @@ class WORLD_PT_gather(WorldButtonsPanel, bpy.types.Panel):
col.prop(light, "correction")
class WORLD_PT_mist(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Mist"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw_header(self, context):
world = context.world
self.layout.prop(world.mist, "use_mist", text="")
def draw(self, context):
layout = self.layout
world = context.world
layout.active = world.mist.use_mist
split = layout.split()
col = split.column()
col.prop(world.mist, "intensity", slider=True)
col.prop(world.mist, "start")
col = split.column()
col.prop(world.mist, "depth")
col.prop(world.mist, "height")
layout.prop(world.mist, "falloff")
class WORLD_PT_stars(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Stars"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw_header(self, context):
world = context.world
self.layout.prop(world.stars, "use_stars", text="")
def draw(self, context):
layout = self.layout
world = context.world
layout.active = world.stars.use_stars
split = layout.split()
col = split.column()
col.prop(world.stars, "size")
col.prop(world.stars, "color_randomization", text="Colors")
col = split.column()
col.prop(world.stars, "min_distance", text="Min. Dist")
col.prop(world.stars, "average_separation", text="Separation")
class WORLD_PT_custom_props(WorldButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "world"
def register():
pass

@ -27,7 +27,7 @@ class INFO_HT_header(bpy.types.Header):
layout = self.layout
wm = context.manager
if wm and len(wm.operators):
if wm and wm.operators:
last_op = wm.operators[-1]
else:
last_op = None
@ -131,7 +131,7 @@ class INFO_MT_file_import(bpy.types.Menu):
bl_label = "Import"
def draw(self, context):
if "collada_import" in dir(bpy.ops.wm):
if hasattr(bpy.types, "WM_OT_collada_import"):
self.layout.operator("wm.collada_import", text="COLLADA (.dae)")
@ -140,7 +140,7 @@ class INFO_MT_file_export(bpy.types.Menu):
bl_label = "Export"
def draw(self, context):
if "collada_export" in dir(bpy.ops.wm):
if hasattr(bpy.types, "WM_OT_collada_export"):
self.layout.operator("wm.collada_export", text="COLLADA (.dae)")

@ -48,9 +48,9 @@ class TEXT_HT_header(bpy.types.Header):
layout.template_ID(st, "text", new="text.new", unlink="text.unlink")
row = layout.row(align=True)
row.prop(st, "line_numbers", text="")
row.prop(st, "word_wrap", text="")
row.prop(st, "syntax_highlight", text="")
row.prop(st, "show_line_numbers", text="")
row.prop(st, "show_word_wrap", text="")
row.prop(st, "show_syntax_highlight", text="")
if text:
row = layout.row()
@ -81,9 +81,10 @@ class TEXT_PT_properties(bpy.types.Panel):
st = context.space_data
flow = layout.column_flow()
flow.prop(st, "line_numbers")
flow.prop(st, "word_wrap")
flow.prop(st, "syntax_highlight")
flow.prop(st, "show_line_numbers")
flow.prop(st, "show_word_wrap")
flow.prop(st, "show_syntax_highlight")
flow.prop(st, "show_line_highlight")
flow.prop(st, "live_edit")
flow = layout.column_flow()

@ -1925,8 +1925,8 @@ class VIEW3D_MT_edit_armature_roll(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.operator("armature.calculate_roll", text="Clear Roll (Z-Axis Up)").type = 'GLOBALUP'
layout.operator("armature.calculate_roll", text="Roll to Cursor").type = 'CURSOR'
layout.operator("armature.calculate_roll", text="Recalculate with Z-Axis Up").type = 'GLOBALUP'
layout.operator("armature.calculate_roll", text="Recalculate with Z-Axis to Cursor").type = 'CURSOR'
layout.separator()

@ -487,7 +487,7 @@ class PaintPanel():
elif context.particle_edit_object:
return ts.particle_edit
return False
return None
class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
@ -753,7 +753,7 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
col.separator()
col = layout.column()
col.active = tex_slot.map_mode in ('FIXED')
col.active = tex_slot.map_mode in ('FIXED', )
col.label(text="Angle:")
col = layout.column()
@ -963,6 +963,7 @@ class VIEW3D_PT_tools_brush_curve(PaintPanel, bpy.types.Panel):
layout = self.layout
settings = self.paint_settings(context)
brush = settings.brush
layout.template_curve_mapping(brush, "curve", brush=True)

@ -17,7 +17,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2009 Blender Foundation
# All rights reserved.

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2008 Blender Foundation.
# All rights reserved.

@ -0,0 +1,75 @@
/**
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef BKE_ID_INFO_H
#define BKE_ID_INFO_H
/**
* Convert an idcode into a name.
*
* @param code The code to convert.
* @return A static string representing the name of
* the code.
*/
const char *BKE_idcode_to_name(int code);
/**
* Convert an idcode into a name (plural).
*
* @param code The code to convert.
* @return A static string representing the name of
* the code.
*/
const char *BKE_idcode_to_name_plural(int code);
/**
* Convert a name into an idcode (ie. ID_SCE)
*
* @param name The name to convert.
* @return The code for the name, or 0 if invalid.
*/
int BKE_idcode_from_name(const char *name);
/**
* Return non-zero when an ID type is linkable.
*
* @param code The code to check.
* @return Boolean, 0 when non linkable.
*/
int BKE_idcode_is_linkable(int code);
/**
* Return if the ID code is a valid ID code.
*
* @param code The code to check.
* @return Boolean, 0 when invalid.
*/
int BKE_idcode_is_valid(int code);
#endif

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.

@ -1189,10 +1189,15 @@ static void emDM_getFace(DerivedMesh *dm, int index, MFace *face_r)
static void emDM_copyVertArray(DerivedMesh *dm, MVert *vert_r)
{
EditVert *ev = ((EditMeshDerivedMesh *)dm)->em->verts.first;
EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
EditVert *ev = emdm->em->verts.first;
int i;
for( ; ev; ev = ev->next, ++vert_r) {
VECCOPY(vert_r->co, ev->co);
for(i=0; ev; ev = ev->next, ++vert_r, ++i) {
if(emdm->vertexCos)
copy_v3_v3(vert_r->co, emdm->vertexCos[i]);
else
copy_v3_v3(vert_r->co, ev->co);
vert_r->no[0] = ev->no[0] * 32767.0;
vert_r->no[1] = ev->no[1] * 32767.0;

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.

@ -1573,7 +1573,7 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *
for(a=0; a<resolu; a++, fac+= dfac) {
if (tilt_array) {
if (nu->tilt_interp==3) { /* May as well support for tilt also 2.47 ease interp */
if (nu->tilt_interp==KEY_CU_EASE) { /* May as well support for tilt also 2.47 ease interp */
*tilt_array = prevbezt->alfa + (bezt->alfa - prevbezt->alfa)*(3.0f*fac*fac - 2.0f*fac*fac*fac);
} else {
key_curve_position_weights(fac, t, nu->tilt_interp);
@ -1584,7 +1584,7 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *
}
if (radius_array) {
if (nu->radius_interp==3) {
if (nu->radius_interp==KEY_CU_EASE) {
/* Support 2.47 ease interp
* Note! - this only takes the 2 points into account,
* giving much more localized results to changes in radius, sometimes you want that */

@ -0,0 +1,128 @@
/**
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
* return info about ID types
*/
#include <stdlib.h>
#include <string.h>
#include "DNA_ID.h"
typedef struct {
unsigned short code;
char *name, *plural;
int flags;
#define IDTYPE_FLAGS_ISLINKABLE (1<<0)
} IDType;
/* plural need to match rna_main.c's MainCollectionDef */
static IDType idtypes[]= {
{ ID_AC, "Action", "actions", IDTYPE_FLAGS_ISLINKABLE},
{ ID_AR, "Armature", "armatures", IDTYPE_FLAGS_ISLINKABLE},
{ ID_BR, "Brush", "brushes", IDTYPE_FLAGS_ISLINKABLE},
{ ID_CA, "Camera", "cameras", IDTYPE_FLAGS_ISLINKABLE},
{ ID_CU, "Curve", "curves", IDTYPE_FLAGS_ISLINKABLE},
{ ID_GD, "GPencil", "gpencil", IDTYPE_FLAGS_ISLINKABLE}, /* rename gpencil */
{ ID_GR, "Group", "groups", IDTYPE_FLAGS_ISLINKABLE},
{ ID_ID, "ID", "ids", 0}, /* plural is fake */
{ ID_IM, "Image", "images", IDTYPE_FLAGS_ISLINKABLE},
{ ID_IP, "Ipo", "ipos", IDTYPE_FLAGS_ISLINKABLE}, /* deprecated */
{ ID_KE, "Key", "keys", 0},
{ ID_LA, "Lamp", "lamps", IDTYPE_FLAGS_ISLINKABLE},
{ ID_LI, "Library", "libraries", 0},
{ ID_LT, "Lattice", "lattices", IDTYPE_FLAGS_ISLINKABLE},
{ ID_MA, "Material", "materials", IDTYPE_FLAGS_ISLINKABLE},
{ ID_MB, "Metaball", "metaballs", IDTYPE_FLAGS_ISLINKABLE},
{ ID_ME, "Mesh", "meshes", IDTYPE_FLAGS_ISLINKABLE},
{ ID_NT, "NodeTree", "node_groups", IDTYPE_FLAGS_ISLINKABLE},
{ ID_OB, "Object", "objects", IDTYPE_FLAGS_ISLINKABLE},
{ ID_PA, "ParticleSettings", "particles", 0},
{ ID_SCE, "Scene", "scenes", IDTYPE_FLAGS_ISLINKABLE},
{ ID_SCR, "Screen", "screens", 0},
{ ID_SEQ, "Sequence", "sequences", 0}, /* not actually ID data */
{ ID_SO, "Sound", "sounds", IDTYPE_FLAGS_ISLINKABLE},
{ ID_TE, "Texture", "textures", IDTYPE_FLAGS_ISLINKABLE},
{ ID_TXT, "Text", "texts", IDTYPE_FLAGS_ISLINKABLE},
{ ID_VF, "VFont", "fonts", IDTYPE_FLAGS_ISLINKABLE},
{ ID_WO, "World", "worlds", IDTYPE_FLAGS_ISLINKABLE},
{ ID_WM, "WindowManager", "window_managers", 0},
};
static int nidtypes= sizeof(idtypes)/sizeof(idtypes[0]);
static IDType *idtype_from_name(const char *str)
{
int i= nidtypes;
while (i--)
if (strcmp(str, idtypes[i].name)==0)
return &idtypes[i];
return NULL;
}
static IDType *idtype_from_code(int code)
{
int i= nidtypes;
while (i--)
if (code==idtypes[i].code)
return &idtypes[i];
return NULL;
}
int BKE_idcode_is_valid(int code)
{
return idtype_from_code(code)?1:0;
}
int BKE_idcode_is_linkable(int code) {
IDType *idt= idtype_from_code(code);
return idt?(idt->flags&IDTYPE_FLAGS_ISLINKABLE):0;
}
const char *BKE_idcode_to_name(int code)
{
IDType *idt= idtype_from_code(code);
return idt?idt->name:NULL;
}
int BKE_idcode_from_name(const char *name)
{
IDType *idt= idtype_from_name(name);
return idt?idt->code:0;
}
const char *BKE_idcode_to_name_plural(int code)
{
IDType *idt= idtype_from_code(code);
return idt?idt->plural:NULL;
}

@ -27,6 +27,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include "BKE_idprop.h"
@ -491,47 +492,41 @@ void IDP_ReplaceGroupInGroup(IDProperty *dest, IDProperty *src)
void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
{
IDProperty *loop;
for (loop=group->data.group.first; loop; loop=loop->next) {
if (BSTR_EQ(loop->name, prop->name)) {
BLI_insertlink(&group->data.group, loop, prop);
BLI_remlink(&group->data.group, loop);
IDP_FreeProperty(loop);
MEM_freeN(loop);
return;
}
if((loop= IDP_GetPropertyFromGroup(group, prop->name))) {
BLI_insertlink(&group->data.group, loop, prop);
BLI_remlink(&group->data.group, loop);
IDP_FreeProperty(loop);
MEM_freeN(loop);
}
else {
group->len++;
BLI_addtail(&group->data.group, prop);
}
group->len++;
BLI_addtail(&group->data.group, prop);
}
/*returns 0 if an id property with the same name exists and it failed,
or 1 if it succeeded in adding to the group.*/
int IDP_AddToGroup(IDProperty *group, IDProperty *prop)
{
IDProperty *loop;
for (loop=group->data.group.first; loop; loop=loop->next) {
if (BSTR_EQ(loop->name, prop->name)) return 0;
if(IDP_GetPropertyFromGroup(group, prop->name) == NULL) {
group->len++;
BLI_addtail(&group->data.group, prop);
return 1;
}
group->len++;
BLI_addtail(&group->data.group, prop);
return 1;
return 0;
}
int IDP_InsertToGroup(IDProperty *group, IDProperty *previous, IDProperty *pnew)
{
IDProperty *loop;
for (loop=group->data.group.first; loop; loop=loop->next) {
if (BSTR_EQ(loop->name, pnew->name)) return 0;
if(IDP_GetPropertyFromGroup(group, pnew->name) == NULL) {
group->len++;
BLI_insertlink(&group->data.group, previous, pnew);
return 1;
}
group->len++;
BLI_insertlink(&group->data.group, previous, pnew);
return 1;
return 0;
}
void IDP_RemFromGroup(IDProperty *group, IDProperty *prop)
@ -542,11 +537,7 @@ void IDP_RemFromGroup(IDProperty *group, IDProperty *prop)
IDProperty *IDP_GetPropertyFromGroup(IDProperty *prop, const char *name)
{
IDProperty *loop;
for (loop=prop->data.group.first; loop; loop=loop->next) {
if (strcmp(loop->name, name)==0) return loop;
}
return NULL;
return (IDProperty *)BLI_findstring(&prop->data.group, name, offsetof(IDProperty, name));
}
typedef struct IDPIter {

@ -1850,9 +1850,12 @@ void vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
tot= count_curveverts(&cu->nurb);
}
fp= kb->data= MEM_callocN(tot*elemsize, "key_to_vertcos vertCos");
if (tot == 0) {
kb->data= NULL;
return;
}
if (tot == 0) return;
fp= kb->data= MEM_callocN(tot*elemsize, "key_to_vertcos vertCos");
/* Copy coords to keyblock */

@ -1265,13 +1265,13 @@ void BKE_nlastrip_validate_name (AnimData *adt, NlaStrip *strip)
char *dot;
/* Strip off the suffix */
dot = strchr(strip->name, '.');
dot = strrchr(strip->name, '.');
if (dot) *dot=0;
/* Try different possibilities */
for (number = 1; number <= 999; number++) {
/* assemble alternative name */
BLI_snprintf(tempname, 128, "%s%c%03d", strip->name, ".", number);
BLI_snprintf(tempname, 128, "%s.%03d", strip->name, number);
/* if hash doesn't have this, set it */
if (BLI_ghash_haskey(gh, tempname) == 0) {

@ -1855,9 +1855,8 @@ static void node_group_execute(bNodeStack *stack, void *data, bNode *gnode, bNod
/* for groups, only execute outputs for edited group */
if(node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
if(gnode->flag & NODE_GROUP_EDIT)
if(node->flag & NODE_DO_OUTPUT)
node->typeinfo->execfunc(data, node, nsin, nsout);
if(node->type==CMP_NODE_OUTPUT_FILE || (gnode->flag & NODE_GROUP_EDIT))
node->typeinfo->execfunc(data, node, nsin, nsout);
}
else
node->typeinfo->execfunc(data, node, nsin, nsout);

@ -2501,7 +2501,7 @@ void object_handle_update(Scene *scene, Object *ob)
/* includes all keys and modifiers */
if(ob->type==OB_MESH) {
EditMesh *em = BKE_mesh_get_editmesh(ob->data);
EditMesh *em = (ob == scene->obedit)? BKE_mesh_get_editmesh(ob->data): NULL;
/* evaluate drivers */
// XXX: should we push this to derivedmesh instead?

@ -69,6 +69,8 @@ static int ccgDM_getVertMapIndex(CCGSubSurf *ss, CCGVert *v);
static int ccgDM_getEdgeMapIndex(CCGSubSurf *ss, CCGEdge *e);
static int ccgDM_getFaceMapIndex(CCGSubSurf *ss, CCGFace *f);
static int ccgDM_use_grid_pbvh(CCGDerivedMesh *ccgdm);
///
static void *arena_alloc(CCGAllocatorHDL a, int numBytes) {
@ -1249,7 +1251,7 @@ static void ccgDM_glNormalFast(float *a, float *b, float *c, float *d)
static void ccgdm_pbvh_update(CCGDerivedMesh *ccgdm)
{
if(ccgdm->pbvh && ccgdm->multires.mmd) {
if(ccgdm->pbvh && ccgDM_use_grid_pbvh(ccgdm)) {
CCGFace **faces;
int totface;

@ -45,6 +45,7 @@ void BLI_insertlink(struct ListBase *listbase, void *vprevlink, void *vnewlink);
void *BLI_findlink(struct ListBase *listbase, int number);
int BLI_findindex(struct ListBase *listbase, void *vlink);
void *BLI_findstring(struct ListBase *listbase, const char *id, int offset);
void *BLI_findstring_ptr(struct ListBase *listbase, const char *id, int offset);
int BLI_findstringindex(struct ListBase *listbase, const char *id, int offset);
void BLI_freelistN(struct ListBase *listbase);
void BLI_addtail(struct ListBase *listbase, void *vlink);

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.

@ -374,6 +374,27 @@ void *BLI_findstring(ListBase *listbase, const char *id, int offset)
return NULL;
}
void *BLI_findstring_ptr(ListBase *listbase, const char *id, int offset)
{
Link *link= NULL;
const char *id_iter;
if (listbase == NULL) return NULL;
link= listbase->first;
while (link) {
/* exact copy of BLI_findstring(), except for this line */
id_iter= *((const char **)(((const char *)link) + offset));
if(id[0] == id_iter[0] && strcmp(id, id_iter)==0)
return link;
link= link->next;
}
return NULL;
}
int BLI_findstringindex(ListBase *listbase, const char *id, int offset)
{
Link *link= NULL;

@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.

@ -586,7 +586,7 @@ int BLI_path_abs(char *path, const char *basepath)
BLI_strncpy(tmp, path, FILE_MAX);
}
#else
BLI_strncpy(tmp, path, FILE_MAX);
BLI_strncpy(tmp, path, sizeof(tmp));
/* Check for loading a windows path on a posix system
* in this case, there is no use in trying C:/ since it
@ -603,7 +603,7 @@ int BLI_path_abs(char *path, const char *basepath)
#endif
BLI_strncpy(base, basepath, FILE_MAX);
BLI_strncpy(base, basepath, sizeof(base));
BLI_cleanup_file(NULL, base);
@ -626,13 +626,13 @@ int BLI_path_abs(char *path, const char *basepath)
BLI_strncpy(path, tmp+2, FILE_MAX);
memcpy(tmp, base, baselen);
strcpy(tmp+baselen, path);
strcpy(path, tmp);
BLI_strncpy(tmp+baselen, path, sizeof(tmp)-baselen);
BLI_strncpy(path, tmp, FILE_MAX);
} else {
strcpy(path, tmp+2);
BLI_strncpy(path, tmp+2, FILE_MAX);
}
} else {
strcpy(path, tmp);
BLI_strncpy(path, tmp, FILE_MAX);
}
if (path[0]!='\0') {
@ -1162,7 +1162,7 @@ void BLI_make_existing_file(char *name)
{
char di[FILE_MAXDIR+FILE_MAXFILE], fi[FILE_MAXFILE];
strcpy(di, name);
BLI_strncpy(di, name, sizeof(di));
BLI_splitdirstring(di, fi);
/* test exist */

@ -237,8 +237,19 @@ void BLI_builddir(char *dirname, char *relname)
if (newnum){
if (files) files=(struct direntry *)realloc(files,(totnum+newnum) * sizeof(struct direntry));
else files=(struct direntry *)malloc(newnum * sizeof(struct direntry));
if(files) {
void *tmp= realloc(files, (totnum+newnum) * sizeof(struct direntry));
if(tmp) {
files= (struct direntry *)tmp;
}
else { /* realloc fail */
free(files);
files= NULL;
}
}
if(files==NULL)
files=(struct direntry *)malloc(newnum * sizeof(struct direntry));
if (files){
dlink = (struct dirlink *) dirbase->first;

@ -111,38 +111,6 @@ BlendFileData *BLO_read_from_memfile(struct Main *oldmain, const char *filename,
void
BLO_blendfiledata_free(
BlendFileData *bfd);
/**
* Convert an idcode into a name.
*
* @param code The code to convert.
* @return A static string representing the name of
* the code.
*/
char*
BLO_idcode_to_name(
int code);
/**
* Convert an idcode into a name (plural).
*
* @param code The code to convert.
* @return A static string representing the name of
* the code.
*/
char*
BLO_idcode_to_name_plural(
int code);
/**
* Convert a name into an idcode (ie. ID_SCE)
*
* @param name The name to convert.
* @return The code for the name, or 0 if invalid.
*/
int
BLO_idcode_from_name(
char *name);
/**
* Open a blendhandle from a file path.

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.

@ -46,6 +46,7 @@
#include "BKE_main.h"
#include "BKE_library.h" // for free_main
#include "BKE_idcode.h"
#include "BKE_report.h"
#include "BLO_readfile.h"
@ -61,111 +62,9 @@
#include "BLI_winstuff.h"
#endif
/**
* IDType stuff, I plan to move this
* out into its own file + prefix, and
* make sure all IDType handling goes through
* these routines.
*/
typedef struct {
unsigned short code;
char *name, *plural;
int flags;
#define IDTYPE_FLAGS_ISLINKABLE (1<<0)
} IDType;
/* plural need to match rna_main.c's MainCollectionDef */
static IDType idtypes[]= {
{ ID_AC, "Action", "actions", IDTYPE_FLAGS_ISLINKABLE},
{ ID_AR, "Armature", "armatures", IDTYPE_FLAGS_ISLINKABLE},
{ ID_BR, "Brush", "brushes", IDTYPE_FLAGS_ISLINKABLE},
{ ID_CA, "Camera", "cameras", IDTYPE_FLAGS_ISLINKABLE},
{ ID_CU, "Curve", "curves", IDTYPE_FLAGS_ISLINKABLE},
{ ID_GD, "GPencil", "gpencil", IDTYPE_FLAGS_ISLINKABLE}, /* rename gpencil */
{ ID_GR, "Group", "groups", IDTYPE_FLAGS_ISLINKABLE},
{ ID_ID, "ID", "ids", 0}, /* plural is fake */
{ ID_IM, "Image", "images", IDTYPE_FLAGS_ISLINKABLE},
{ ID_IP, "Ipo", "ipos", IDTYPE_FLAGS_ISLINKABLE}, /* deprecated */
{ ID_KE, "Key", "keys", 0},
{ ID_LA, "Lamp", "lamps", IDTYPE_FLAGS_ISLINKABLE},
{ ID_LI, "Library", "libraries", 0},
{ ID_LT, "Lattice", "lattices", IDTYPE_FLAGS_ISLINKABLE},
{ ID_MA, "Material", "materials", IDTYPE_FLAGS_ISLINKABLE},
{ ID_MB, "Metaball", "metaballs", IDTYPE_FLAGS_ISLINKABLE},
{ ID_ME, "Mesh", "meshes", IDTYPE_FLAGS_ISLINKABLE},
{ ID_NT, "NodeTree", "node_groups", IDTYPE_FLAGS_ISLINKABLE},
{ ID_OB, "Object", "objects", IDTYPE_FLAGS_ISLINKABLE},
{ ID_PA, "ParticleSettings", "particles", 0},
{ ID_SCE, "Scene", "scenes", IDTYPE_FLAGS_ISLINKABLE},
{ ID_SCR, "Screen", "screens", 0},
{ ID_SEQ, "Sequence", "sequences", 0}, /* not actually ID data */
{ ID_SO, "Sound", "sounds", IDTYPE_FLAGS_ISLINKABLE},
{ ID_TE, "Texture", "textures", IDTYPE_FLAGS_ISLINKABLE},
{ ID_TXT, "Text", "texts", IDTYPE_FLAGS_ISLINKABLE},
{ ID_VF, "VFont", "fonts", IDTYPE_FLAGS_ISLINKABLE},
{ ID_WO, "World", "worlds", IDTYPE_FLAGS_ISLINKABLE},
{ ID_WM, "WindowManager", "window_managers", 0},
};
static int nidtypes= sizeof(idtypes)/sizeof(idtypes[0]);
/* local prototypes --------------------- */
void BLO_blendhandle_print_sizes(BlendHandle *, void *);
static IDType *idtype_from_name(char *str)
{
int i= nidtypes;
while (i--)
if (BLI_streq(str, idtypes[i].name))
return &idtypes[i];
return NULL;
}
static IDType *idtype_from_code(int code)
{
int i= nidtypes;
while (i--)
if (code==idtypes[i].code)
return &idtypes[i];
return NULL;
}
static int bheadcode_is_idcode(int code)
{
return idtype_from_code(code)?1:0;
}
static int idcode_is_linkable(int code) {
IDType *idt= idtype_from_code(code);
return idt?(idt->flags&IDTYPE_FLAGS_ISLINKABLE):0;
}
char *BLO_idcode_to_name(int code)
{
IDType *idt= idtype_from_code(code);
return idt?idt->name:NULL;
}
int BLO_idcode_from_name(char *name)
{
IDType *idt= idtype_from_name(name);
return idt?idt->code:0;
}
char *BLO_idcode_to_name_plural(int code)
{
IDType *idt= idtype_from_code(code);
return idt?idt->plural:NULL;
}
/* Access routines used by filesel. */
BlendHandle *BLO_blendhandle_from_file(char *file)
@ -308,13 +207,13 @@ LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh)
for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
if (bhead->code==ENDB) {
break;
} else if (bheadcode_is_idcode(bhead->code)) {
if (idcode_is_linkable(bhead->code)) {
char *str= BLO_idcode_to_name(bhead->code);
} else if (BKE_idcode_is_valid(bhead->code)) {
if (BKE_idcode_is_linkable(bhead->code)) {
const char *str= BKE_idcode_to_name(bhead->code);
if (!BLI_ghash_haskey(gathered, str)) {
if (!BLI_ghash_haskey(gathered, (void *)str)) {
BLI_linklist_prepend(&names, strdup(str));
BLI_ghash_insert(gathered, str, NULL);
BLI_ghash_insert(gathered, (void *)str, NULL);
}
}
}

@ -105,6 +105,7 @@
#include "BKE_image.h"
#include "BKE_lattice.h"
#include "BKE_library.h" // for which_libbase
#include "BKE_idcode.h"
#include "BKE_main.h" // for Main
#include "BKE_mesh.h" // for ME_ defines (patching)
#include "BKE_modifier.h"
@ -4106,8 +4107,9 @@ static void composite_patch(bNodeTree *ntree, Scene *scene)
static void link_paint(FileData *fd, Scene *sce, Paint *p)
{
if(p && p->brush) {
if(p) {
p->brush= newlibadr_us(fd, sce->id.lib, p->brush);
p->paint_cursor= NULL;
}
}
@ -12592,8 +12594,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
append_id_part(fd, mainptr, id, &realid);
if (!realid) {
BKE_reportf(fd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
if(!G.background && basefd->reports) printf("LIB ERROR: %s:'%s' missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
BKE_reportf(fd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' missing from '%s'\n", BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
if(!G.background && basefd->reports) printf("LIB ERROR: %s:'%s' missing from '%s'\n", BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
}
change_idid_adr(mainlist, basefd, id, realid);
@ -12628,8 +12630,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
ID *idn= id->next;
if(id->flag & LIB_READ) {
BLI_remlink(lbarray[a], id);
BKE_reportf(basefd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
if(!G.background && basefd->reports)printf("LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
BKE_reportf(basefd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
if(!G.background && basefd->reports)printf("LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
change_idid_adr(mainlist, basefd, id, NULL);
MEM_freeN(id);

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2008 Blender Foundation.
# All rights reserved.

@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.

@ -17,7 +17,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) Blender Foundation.
# All rights reserved.

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2007 Blender Foundation
# All rights reserved.

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2007 Blender Foundation
# All rights reserved.

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2007 Blender Foundation
# All rights reserved.

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2007 Blender Foundation
# All rights reserved.

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2007 Blender Foundation
# All rights reserved.

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2007 Blender Foundation
# All rights reserved.

@ -1146,7 +1146,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *wcol, rcti *rect)
glColor4fv( &cbd->r );
glVertex2fv(v1); glVertex2fv(v2);
for( a = 1; a < sizex; a++ ) {
for( a = 1; a <= sizex; a++ ) {
pos = ((float)a) / (sizex-1);
do_colorband( coba, pos, colf );
if (but->block->color_profile != BLI_PR_NONE)
@ -1163,19 +1163,8 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *wcol, rcti *rect)
glDisable(GL_BLEND);
/* outline */
v1[0]= x1; v1[1]= y1;
cpack(0x0);
glBegin(GL_LINE_LOOP);
glVertex2fv(v1);
v1[0]+= sizex;
glVertex2fv(v1);
v1[1]+= sizey;
glVertex2fv(v1);
v1[0]-= sizex;
glVertex2fv(v1);
glEnd();
glColor4f(0.0, 0.0, 0.0, 1.0);
fdrawbox(x1, y1, x1+sizex, y1+sizey);
/* help lines */
v1[0]= v2[0]=v3[0]= x1;
@ -1231,6 +1220,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *wcol, rcti *rect)
}
}
glEnd();
}
void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)

@ -4262,7 +4262,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
return WM_UI_HANDLER_BREAK;
}
/* reset to default */
else if(event->type == ZEROKEY && event->val == KM_PRESS) {
else if(ELEM(event->type, ZEROKEY,PAD0) && event->val == KM_PRESS) {
if (!(ELEM3(but->type, HSVCIRCLE, HSVCUBE, HISTOGRAM)))
ui_set_but_default(C, but);
}

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2007 Blender Foundation
# All rights reserved.

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2007 Blender Foundation
# All rights reserved.

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2007 Blender Foundation
# All rights reserved.

@ -225,11 +225,11 @@ static void bake_update(void *bkv)
static void bake_freejob(void *bkv)
{
BakeRender *bkr= bkv;
BLI_end_threads(&bkr->threads);
finish_bake_internal(bkr);
if(bkr->tot==0) BKE_report(bkr->reports, RPT_ERROR, "No Images found to bake to");
MEM_freeN(bkr);
G.rendering = 0;
}
/* catch esc */
@ -269,6 +269,7 @@ static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *_eve
WM_jobs_callbacks(steve, bake_startjob, NULL, bake_update, NULL);
G.afbreek= 0;
G.rendering = 1;
WM_jobs_start(CTX_wm_manager(C), steve);

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2007 Blender Foundation
# All rights reserved.

@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2007 Blender Foundation
# All rights reserved.

@ -791,7 +791,7 @@ void BIF_view3d_previewrender(Main *bmain, Scene *scene, ScrArea *sa)
lay |= v3d->lay;
else lay= v3d->lay;
RE_Database_FromScene(re, scene, lay, 0); // 0= dont use camera view
RE_Database_FromScene(re, bmain, scene, lay, 0); // 0= dont use camera view
rstats= RE_GetStats(re);
if(rstats->convertdone)

Some files were not shown because too many files have changed in this diff Show More