NLA SoC: Merge from 2.5

20669 to 20771

(sheesh, that took an hour, not including having to restart the whole process after TortoiseSVN bailed out midway through the first try)
This commit is contained in:
2009-06-10 03:36:28 +00:00
667 changed files with 39411 additions and 27084 deletions

View File

@@ -59,7 +59,24 @@ ENDMACRO(SETUP_LIBDIRS)
MACRO(SETUP_LIBLINKS MACRO(SETUP_LIBLINKS
target) target)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS} ") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS} ")
TARGET_LINK_LIBRARIES(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${PYTHON_LIB} ${PYTHON_LINKFLAGS} ${JPEG_LIB} ${PNG_LIB} ${ZLIB_LIB} ${SDL_LIB} ${LLIBS}) #TARGET_LINK_LIBRARIES(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${PYTHON_LIB} ${PYTHON_LINKFLAGS} ${JPEG_LIB} ${PNG_LIB} ${ZLIB_LIB} ${SDL_LIB} ${LLIBS})
TARGET_LINK_LIBRARIES(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${PYTHON_LINKFLAGS} ${JPEG_LIB} ${PNG_LIB} ${ZLIB_LIB} ${SDL_LIB} ${LLIBS})
# since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions
IF(WIN32)
TARGET_LINK_LIBRARIES(${target} debug ${PYTHON_LIB}_d)
TARGET_LINK_LIBRARIES(${target} optimized ${PYTHON_LIB})
ELSE(WIN32)
TARGET_LINK_LIBRARIES(${target} ${PYTHON_LIB})
ENDIF(WIN32)
TARGET_LINK_LIBRARIES(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${PYTHON_LINKFLAGS} ${JPEG_LIB} ${PNG_LIB} ${ZLIB_LIB} ${SDL_LIB} ${LLIBS}) TARGET_LINK_LIBRARIES(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${PYTHON_LINKFLAGS} ${JPEG_LIB} ${PNG_LIB} ${ZLIB_LIB} ${SDL_LIB} ${LLIBS})
TARGET_LINK_LIBRARIES(${target} ${FREETYPE_LIB}) TARGET_LINK_LIBRARIES(${target} ${FREETYPE_LIB})

View File

@@ -99,20 +99,6 @@ IF(UNIX)
ENDIF(OPENAL_FOUND) ENDIF(OPENAL_FOUND)
ENDIF(WITH_OPENAL) ENDIF(WITH_OPENAL)
FIND_LIBRARY(ALUT_LIBRARY
NAMES alut
PATHS
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
)
IF(ALUT_LIBRARY)
SET(OPENAL_LIB ${OPENAL_LIB} ${ALUT_LIBRARY})
ENDIF(ALUT_LIBRARY)
FIND_LIBRARY(INTL_LIBRARY FIND_LIBRARY(INTL_LIBRARY
NAMES intl NAMES intl
PATHS PATHS
@@ -288,7 +274,7 @@ IF(WIN32)
SET(FFMPEG ${LIBDIR}/ffmpeg) SET(FFMPEG ${LIBDIR}/ffmpeg)
SET(FFMPEG_INC ${FFMPEG}/include) SET(FFMPEG_INC ${FFMPEG}/include)
SET(FFMPEG_LIB avcodec-51 avformat-52 avdevice-52 avutil-49 swscale-0) SET(FFMPEG_LIB avcodec-52 avformat-52 avdevice-52 avutil-50 swscale-0)
SET(FFMPEG_LIBPATH ${FFMPEG}/lib) SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
IF(CMAKE_CL_64) IF(CMAKE_CL_64)
@@ -468,20 +454,18 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ")
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Libraries # Libraries
FILE(WRITE ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt "") FILE(WRITE ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt "")
SUBDIRS( ADD_SUBDIRECTORY(intern)
intern ADD_SUBDIRECTORY(extern)
extern ADD_SUBDIRECTORY(source)
source
)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Blender Application # Blender Application
SUBDIRS(source/creator) ADD_SUBDIRECTORY(source/creator)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Blender Player # Blender Player
IF(WITH_PLAYER) IF(WITH_PLAYER)
SUBDIRS(blenderplayer) ADD_SUBDIRECTORY(blenderplayer)
ENDIF(WITH_PLAYER) ENDIF(WITH_PLAYER)

View File

@@ -20,11 +20,6 @@ BF_OPENAL_LIB = 'openal'
BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a' BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
BF_OPENAL_LIBPATH = LIBDIR + '/lib' BF_OPENAL_LIBPATH = LIBDIR + '/lib'
# some distros have a separate libalut
# if you get linker complaints, you need to uncomment the line below
# BF_OPENAL_LIB = 'openal alut'
# BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a ${BF_OPENAL}/lib/libalut.a'
BF_CXX = '/usr' BF_CXX = '/usr'
WITH_BF_STATICCXX = 'false' WITH_BF_STATICCXX = 'false'
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a' BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'

View File

@@ -1,9 +1,17 @@
LCGDIR = '../lib/linux2' LCGDIR = '../lib/linux2'
LIBDIR = "${LCGDIR}" LIBDIR = "${LCGDIR}"
def py_version_string():
'''
returns py version - "2.5", "2.6" etc
'''
import platform
ver = platform.python_version_tuple()
return '%d.%d' % (int(ver[0]), int(ver[1])) # py2.5 uses strings, 2.6 ints
BF_PYTHON = '/usr' BF_PYTHON = '/usr'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib' BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
BF_PYTHON_VERSION = '2.5' BF_PYTHON_VERSION = py_version_string()
WITH_BF_STATICPYTHON = False WITH_BF_STATICPYTHON = False
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}' BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}' BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
@@ -18,11 +26,6 @@ BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIB = 'openal' BF_OPENAL_LIB = 'openal'
BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a' BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
# some distros have a separate libalut
# if you get linker complaints, you need to uncomment the line below
# BF_OPENAL_LIB = 'openal alut'
# BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a ${BF_OPENAL}/lib/libalut.a'
BF_CXX = '/usr' BF_CXX = '/usr'
WITH_BF_STATICCXX = False WITH_BF_STATICCXX = False
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a' BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
@@ -71,7 +74,8 @@ BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gettextlib' BF_GETTEXT_LIB = 'gettextlib'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib' BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_GAMEENGINE=False WITH_BF_GAMEENGINE = True
WITH_BF_PLAYER = True
WITH_BF_ODE = False WITH_BF_ODE = False
BF_ODE = LIBDIR + '/ode' BF_ODE = LIBDIR + '/ode'

View File

@@ -182,7 +182,7 @@ WITH_BF_DOCS=False
BF_DEBUG=False BF_DEBUG=False
BF_BSC=False BF_BSC=False
CFLAGS = [] CFLAGS = []
CCFLAGS = ['/nologo', '/Ob1', '/J', '/W3', '/Gd', '/MT', '/openmp'] CCFLAGS = ['/nologo', '/Ob1', '/J', '/W3', '/Gd', '/MT']
CXXFLAGS = ['/EHsc'] CXXFLAGS = ['/EHsc']
if BF_DEBUG: if BF_DEBUG:
@@ -190,7 +190,7 @@ if BF_DEBUG:
else: else:
BF_NUMJOBS=6 BF_NUMJOBS=6
PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:X64','/ENTRY:mainCRTStartup','/INCREMENTAL:NO','/NODEFAULTLIB:"msvcprt.lib"','/NODEFAULTLIB:"glut32.lib"','/NODEFAULTLIB:"libc.lib"','/NODEFAULTLIB:"libcd.lib"','/NODEFAULTLIB:"libcpd.lib"','/NODEFAULTLIB:"libcp.lib"','/LARGEADDRESSAWARE'] PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:X64','/ENTRY:mainCRTStartup','/INCREMENTAL:NO','/NODEFAULTLIB:"msvcprt.lib"','/NODEFAULTLIB:"glut32.lib"','/NODEFAULTLIB:"libc.lib"','/NODEFAULTLIB:"libcd.lib"','/NODEFAULTLIB:"libcpd.lib"','/NODEFAULTLIB:"libcp.lib"']
BF_BUILDDIR = '..\\build\\blender25-win64-vc' BF_BUILDDIR = '..\\build\\blender25-win64-vc'
BF_INSTALLDIR='..\\install\\blender25-win64-vc' BF_INSTALLDIR='..\\install\\blender25-win64-vc'

11
extern/CMakeLists.txt vendored
View File

@@ -25,19 +25,20 @@
# ***** END GPL LICENSE BLOCK ***** # ***** END GPL LICENSE BLOCK *****
IF(WITH_GAMEENGINE) IF(WITH_GAMEENGINE)
SUBDIRS(qhull solid) ADD_SUBDIRECTORY(qhull)
ADD_SUBDIRECTORY(solid)
ENDIF(WITH_GAMEENGINE) ENDIF(WITH_GAMEENGINE)
IF(WITH_BULLET) IF(WITH_BULLET)
SUBDIRS(bullet2) ADD_SUBDIRECTORY(bullet2)
ENDIF(WITH_BULLET) ENDIF(WITH_BULLET)
IF(CMAKE_SYSTEM_NAME MATCHES "Linux") IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
SUBDIRS(binreloc) ADD_SUBDIRECTORY(binreloc)
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
SUBDIRS(glew) ADD_SUBDIRECTORY(glew)
IF(WITH_OPENJPEG) IF(WITH_OPENJPEG)
SUBDIRS(libopenjpeg) ADD_SUBDIRECTORY(libopenjpeg)
ENDIF(WITH_OPENJPEG) ENDIF(WITH_OPENJPEG)

7
extern/Makefile vendored
View File

@@ -41,9 +41,10 @@ ifeq ($(NAN_FFMPEG), $(LCGDIR)/gcc/ffmpeg)
endif endif
endif endif
ifneq ($(NAN_NO_KETSJI), true) # Cloth requires it
DIRS += bullet2 #ifneq ($(NAN_NO_KETSJI), true)
endif DIRS += bullet2
#endif
ifeq ($(WITH_BINRELOC), true) ifeq ($(WITH_BINRELOC), true)
DIRS += binreloc DIRS += binreloc

View File

@@ -22,12 +22,13 @@ Written by: Marcus Hennix
#include "LinearMath/btMinMax.h" #include "LinearMath/btMinMax.h"
#include <new> #include <new>
//-----------------------------------------------------------------------------
//#define CONETWIST_USE_OBSOLETE_SOLVER true
#define CONETWIST_USE_OBSOLETE_SOLVER false #define CONETWIST_USE_OBSOLETE_SOLVER false
#define CONETWIST_DEF_FIX_THRESH btScalar(.05f) #define CONETWIST_DEF_FIX_THRESH btScalar(.05f)
//-----------------------------------------------------------------------------
btConeTwistConstraint::btConeTwistConstraint() btConeTwistConstraint::btConeTwistConstraint()
:btTypedConstraint(CONETWIST_CONSTRAINT_TYPE), :btTypedConstraint(CONETWIST_CONSTRAINT_TYPE),
@@ -63,13 +64,13 @@ void btConeTwistConstraint::init()
m_bMotorEnabled = false; m_bMotorEnabled = false;
m_maxMotorImpulse = btScalar(-1); m_maxMotorImpulse = btScalar(-1);
setLimit(btScalar(1e30), btScalar(1e30), btScalar(1e30)); setLimit(btScalar(BT_LARGE_FLOAT), btScalar(BT_LARGE_FLOAT), btScalar(BT_LARGE_FLOAT));
m_damping = btScalar(0.01); m_damping = btScalar(0.01);
m_fixThresh = CONETWIST_DEF_FIX_THRESH; m_fixThresh = CONETWIST_DEF_FIX_THRESH;
} }
//-----------------------------------------------------------------------------
void btConeTwistConstraint::getInfo1 (btConstraintInfo1* info) void btConeTwistConstraint::getInfo1 (btConstraintInfo1* info)
{ {
@@ -99,9 +100,9 @@ void btConeTwistConstraint::getInfo1 (btConstraintInfo1* info)
info->nub--; info->nub--;
} }
} }
} // btConeTwistConstraint::getInfo1() }
//-----------------------------------------------------------------------------
void btConeTwistConstraint::getInfo2 (btConstraintInfo2* info) void btConeTwistConstraint::getInfo2 (btConstraintInfo2* info)
{ {
@@ -230,7 +231,7 @@ void btConeTwistConstraint::getInfo2 (btConstraintInfo2* info)
} }
} }
//-----------------------------------------------------------------------------
void btConeTwistConstraint::buildJacobian() void btConeTwistConstraint::buildJacobian()
{ {
@@ -239,6 +240,7 @@ void btConeTwistConstraint::buildJacobian()
m_appliedImpulse = btScalar(0.); m_appliedImpulse = btScalar(0.);
m_accTwistLimitImpulse = btScalar(0.); m_accTwistLimitImpulse = btScalar(0.);
m_accSwingLimitImpulse = btScalar(0.); m_accSwingLimitImpulse = btScalar(0.);
m_accMotorImpulse = btVector3(0.,0.,0.);
if (!m_angularOnly) if (!m_angularOnly)
{ {
@@ -277,7 +279,7 @@ void btConeTwistConstraint::buildJacobian()
} }
} }
//-----------------------------------------------------------------------------
void btConeTwistConstraint::solveConstraintObsolete(btSolverBody& bodyA,btSolverBody& bodyB,btScalar timeStep) void btConeTwistConstraint::solveConstraintObsolete(btSolverBody& bodyA,btSolverBody& bodyB,btScalar timeStep)
{ {
@@ -406,10 +408,10 @@ void btConeTwistConstraint::solveConstraintObsolete(btSolverBody& bodyA,btSolver
} }
} }
else // no motor: do a little damping else if (m_damping > SIMD_EPSILON) // no motor: do a little damping
{ {
const btVector3& angVelA = getRigidBodyA().getAngularVelocity(); btVector3 angVelA; bodyA.getAngularVelocity(angVelA);
const btVector3& angVelB = getRigidBodyB().getAngularVelocity(); btVector3 angVelB; bodyB.getAngularVelocity(angVelB);
btVector3 relVel = angVelB - angVelA; btVector3 relVel = angVelB - angVelA;
if (relVel.length2() > SIMD_EPSILON) if (relVel.length2() > SIMD_EPSILON)
{ {
@@ -490,7 +492,7 @@ void btConeTwistConstraint::solveConstraintObsolete(btSolverBody& bodyA,btSolver
} }
//-----------------------------------------------------------------------------
void btConeTwistConstraint::updateRHS(btScalar timeStep) void btConeTwistConstraint::updateRHS(btScalar timeStep)
{ {
@@ -498,7 +500,7 @@ void btConeTwistConstraint::updateRHS(btScalar timeStep)
} }
//-----------------------------------------------------------------------------
void btConeTwistConstraint::calcAngleInfo() void btConeTwistConstraint::calcAngleInfo()
{ {
@@ -584,12 +586,12 @@ void btConeTwistConstraint::calcAngleInfo()
m_twistAxis.normalize(); m_twistAxis.normalize();
} }
} }
} // btConeTwistConstraint::calcAngleInfo() }
static btVector3 vTwist(1,0,0); // twist axis in constraint's space static btVector3 vTwist(1,0,0); // twist axis in constraint's space
//-----------------------------------------------------------------------------
void btConeTwistConstraint::calcAngleInfo2() void btConeTwistConstraint::calcAngleInfo2()
{ {
@@ -597,13 +599,34 @@ void btConeTwistConstraint::calcAngleInfo2()
m_twistLimitSign = btScalar(0.); m_twistLimitSign = btScalar(0.);
m_solveTwistLimit = false; m_solveTwistLimit = false;
m_solveSwingLimit = false; m_solveSwingLimit = false;
// compute rotation of A wrt B (in constraint space)
if (m_bMotorEnabled && (!m_useSolveConstraintObsolete))
{ // it is assumed that setMotorTarget() was alredy called
// and motor target m_qTarget is within constraint limits
// TODO : split rotation to pure swing and pure twist
// compute desired transforms in world
btTransform trPose(m_qTarget);
btTransform trA = getRigidBodyA().getCenterOfMassTransform() * m_rbAFrame;
btTransform trB = getRigidBodyB().getCenterOfMassTransform() * m_rbBFrame;
btTransform trDeltaAB = trB * trPose * trA.inverse();
btQuaternion qDeltaAB = trDeltaAB.getRotation();
btVector3 swingAxis = btVector3(qDeltaAB.x(), qDeltaAB.y(), qDeltaAB.z());
m_swingAxis = swingAxis;
m_swingAxis.normalize();
m_swingCorrection = qDeltaAB.getAngle();
if(!btFuzzyZero(m_swingCorrection))
{
m_solveSwingLimit = true;
}
return;
}
{ {
// compute rotation of A wrt B (in constraint space) // compute rotation of A wrt B (in constraint space)
btQuaternion qA = getRigidBodyA().getCenterOfMassTransform().getRotation() * m_rbAFrame.getRotation(); btQuaternion qA = getRigidBodyA().getCenterOfMassTransform().getRotation() * m_rbAFrame.getRotation();
btQuaternion qB = getRigidBodyB().getCenterOfMassTransform().getRotation() * m_rbBFrame.getRotation(); btQuaternion qB = getRigidBodyB().getCenterOfMassTransform().getRotation() * m_rbBFrame.getRotation();
btQuaternion qAB = qB.inverse() * qA; btQuaternion qAB = qB.inverse() * qA;
// split rotation into cone and twist // split rotation into cone and twist
// (all this is done from B's perspective. Maybe I should be averaging axes...) // (all this is done from B's perspective. Maybe I should be averaging axes...)
btVector3 vConeNoTwist = quatRotate(qAB, vTwist); vConeNoTwist.normalize(); btVector3 vConeNoTwist = quatRotate(qAB, vTwist); vConeNoTwist.normalize();
@@ -756,7 +779,7 @@ void btConeTwistConstraint::calcAngleInfo2()
m_twistAngle = btScalar(0.f); m_twistAngle = btScalar(0.f);
} }
} }
} // btConeTwistConstraint::calcAngleInfo2() }
@@ -982,8 +1005,5 @@ void btConeTwistConstraint::setMotorTargetInConstraintSpace(const btQuaternion &
} }
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

View File

@@ -17,6 +17,22 @@ Written by: Marcus Hennix
/*
Overview:
btConeTwistConstraint can be used to simulate ragdoll joints (upper arm, leg etc).
It is a fixed translation, 3 degree-of-freedom (DOF) rotational "joint".
It divides the 3 rotational DOFs into swing (movement within a cone) and twist.
Swing is divided into swing1 and swing2 which can have different limits, giving an elliptical shape.
(Note: the cone's base isn't flat, so this ellipse is "embedded" on the surface of a sphere.)
In the contraint's frame of reference:
twist is along the x-axis,
and swing 1 and 2 are along the z and y axes respectively.
*/
#ifndef CONETWISTCONSTRAINT_H #ifndef CONETWISTCONSTRAINT_H
#define CONETWISTCONSTRAINT_H #define CONETWISTCONSTRAINT_H
@@ -141,7 +157,18 @@ public:
}; };
} }
void setLimit(btScalar _swingSpan1,btScalar _swingSpan2,btScalar _twistSpan, btScalar _softness = 1.f, btScalar _biasFactor = 0.3f, btScalar _relaxationFactor = 1.0f) // setLimit(), a few notes:
// _softness:
// 0->1, recommend ~0.8->1.
// describes % of limits where movement is free.
// beyond this softness %, the limit is gradually enforced until the "hard" (1.0) limit is reached.
// _biasFactor:
// 0->1?, recommend 0.3 +/-0.3 or so.
// strength with which constraint resists zeroth order (angular, not angular velocity) limit violation.
// __relaxationFactor:
// 0->1, recommend to stay near 1.
// the lower the value, the less the constraint will fight velocities which violate the angular limits.
void setLimit(btScalar _swingSpan1,btScalar _swingSpan2,btScalar _twistSpan, btScalar _softness = 1.f, btScalar _biasFactor = 0.3f, btScalar _relaxationFactor = 1.0f)
{ {
m_swingSpan1 = _swingSpan1; m_swingSpan1 = _swingSpan1;
m_swingSpan2 = _swingSpan2; m_swingSpan2 = _swingSpan2;

View File

@@ -77,7 +77,7 @@ struct btContactSolverInfo : public btContactSolverInfoData
m_splitImpulsePenetrationThreshold = -0.02f; m_splitImpulsePenetrationThreshold = -0.02f;
m_linearSlop = btScalar(0.0); m_linearSlop = btScalar(0.0);
m_warmstartingFactor=btScalar(0.85); m_warmstartingFactor=btScalar(0.85);
m_solverMode = SOLVER_USE_WARMSTARTING | SOLVER_SIMD ;//SOLVER_RANDMIZE_ORDER m_solverMode = SOLVER_USE_WARMSTARTING | SOLVER_USE_2_FRICTION_DIRECTIONS |SOLVER_SIMD | SOLVER_RANDMIZE_ORDER;
m_restingContactRestitutionThreshold = 2;//resting contact lifetime threshold to disable restitution m_restingContactRestitutionThreshold = 2;//resting contact lifetime threshold to disable restitution
} }
}; };

View File

@@ -22,11 +22,13 @@ http://gimpact.sf.net
#include "btGeneric6DofConstraint.h" #include "btGeneric6DofConstraint.h"
#include "BulletDynamics/Dynamics/btRigidBody.h" #include "BulletDynamics/Dynamics/btRigidBody.h"
#include "LinearMath/btTransformUtil.h" #include "LinearMath/btTransformUtil.h"
#include "LinearMath/btTransformUtil.h"
#include <new> #include <new>
#define D6_USE_OBSOLETE_METHOD false #define D6_USE_OBSOLETE_METHOD false
//-----------------------------------------------------------------------------
btGeneric6DofConstraint::btGeneric6DofConstraint() btGeneric6DofConstraint::btGeneric6DofConstraint()
:btTypedConstraint(D6_CONSTRAINT_TYPE), :btTypedConstraint(D6_CONSTRAINT_TYPE),
@@ -35,7 +37,7 @@ m_useSolveConstraintObsolete(D6_USE_OBSOLETE_METHOD)
{ {
} }
//-----------------------------------------------------------------------------
btGeneric6DofConstraint::btGeneric6DofConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB, bool useLinearReferenceFrameA) btGeneric6DofConstraint::btGeneric6DofConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB, bool useLinearReferenceFrameA)
: btTypedConstraint(D6_CONSTRAINT_TYPE, rbA, rbB) : btTypedConstraint(D6_CONSTRAINT_TYPE, rbA, rbB)
@@ -46,12 +48,12 @@ m_useSolveConstraintObsolete(D6_USE_OBSOLETE_METHOD)
{ {
} }
//-----------------------------------------------------------------------------
#define GENERIC_D6_DISABLE_WARMSTARTING 1 #define GENERIC_D6_DISABLE_WARMSTARTING 1
//-----------------------------------------------------------------------------
btScalar btGetMatrixElem(const btMatrix3x3& mat, int index); btScalar btGetMatrixElem(const btMatrix3x3& mat, int index);
btScalar btGetMatrixElem(const btMatrix3x3& mat, int index) btScalar btGetMatrixElem(const btMatrix3x3& mat, int index)
@@ -61,7 +63,7 @@ btScalar btGetMatrixElem(const btMatrix3x3& mat, int index)
return mat[i][j]; return mat[i][j];
} }
//-----------------------------------------------------------------------------
///MatrixToEulerXYZ from http://www.geometrictools.com/LibFoundation/Mathematics/Wm4Matrix3.inl.html ///MatrixToEulerXYZ from http://www.geometrictools.com/LibFoundation/Mathematics/Wm4Matrix3.inl.html
bool matrixToEulerXYZ(const btMatrix3x3& mat,btVector3& xyz); bool matrixToEulerXYZ(const btMatrix3x3& mat,btVector3& xyz);
@@ -129,7 +131,7 @@ int btRotationalLimitMotor::testLimitValue(btScalar test_value)
} }
//-----------------------------------------------------------------------------
btScalar btRotationalLimitMotor::solveAngularLimits( btScalar btRotationalLimitMotor::solveAngularLimits(
btScalar timeStep,btVector3& axis,btScalar jacDiagABInv, btScalar timeStep,btVector3& axis,btScalar jacDiagABInv,
@@ -191,8 +193,8 @@ btScalar btRotationalLimitMotor::solveAngularLimits(
// sort with accumulated impulses // sort with accumulated impulses
btScalar lo = btScalar(-1e30); btScalar lo = btScalar(-BT_LARGE_FLOAT);
btScalar hi = btScalar(1e30); btScalar hi = btScalar(BT_LARGE_FLOAT);
btScalar oldaccumImpulse = m_accumulatedImpulse; btScalar oldaccumImpulse = m_accumulatedImpulse;
btScalar sum = oldaccumImpulse + clippedMotorImpulse; btScalar sum = oldaccumImpulse + clippedMotorImpulse;
@@ -249,9 +251,9 @@ int btTranslationalLimitMotor::testLimitValue(int limitIndex, btScalar test_valu
m_currentLimit[limitIndex] = 0;//Free from violation m_currentLimit[limitIndex] = 0;//Free from violation
m_currentLimitError[limitIndex] = btScalar(0.f); m_currentLimitError[limitIndex] = btScalar(0.f);
return 0; return 0;
} // btTranslationalLimitMotor::testLimitValue() }
//-----------------------------------------------------------------------------
btScalar btTranslationalLimitMotor::solveLinearAxis( btScalar btTranslationalLimitMotor::solveLinearAxis(
btScalar timeStep, btScalar timeStep,
@@ -283,8 +285,8 @@ btScalar btTranslationalLimitMotor::solveLinearAxis(
//positional error (zeroth order error) //positional error (zeroth order error)
btScalar depth = -(pointInA - pointInB).dot(axis_normal_on_a); btScalar depth = -(pointInA - pointInB).dot(axis_normal_on_a);
btScalar lo = btScalar(-1e30); btScalar lo = btScalar(-BT_LARGE_FLOAT);
btScalar hi = btScalar(1e30); btScalar hi = btScalar(BT_LARGE_FLOAT);
btScalar minLimit = m_lowerLimit[limit_index]; btScalar minLimit = m_lowerLimit[limit_index];
btScalar maxLimit = m_upperLimit[limit_index]; btScalar maxLimit = m_upperLimit[limit_index];
@@ -372,7 +374,7 @@ void btGeneric6DofConstraint::calculateAngleInfo()
} }
//-----------------------------------------------------------------------------
void btGeneric6DofConstraint::calculateTransforms() void btGeneric6DofConstraint::calculateTransforms()
{ {
@@ -382,7 +384,7 @@ void btGeneric6DofConstraint::calculateTransforms()
calculateAngleInfo(); calculateAngleInfo();
} }
//-----------------------------------------------------------------------------
void btGeneric6DofConstraint::buildLinearJacobian( void btGeneric6DofConstraint::buildLinearJacobian(
btJacobianEntry & jacLinear,const btVector3 & normalWorld, btJacobianEntry & jacLinear,const btVector3 & normalWorld,
@@ -400,7 +402,7 @@ void btGeneric6DofConstraint::buildLinearJacobian(
m_rbB.getInvMass()); m_rbB.getInvMass());
} }
//-----------------------------------------------------------------------------
void btGeneric6DofConstraint::buildAngularJacobian( void btGeneric6DofConstraint::buildAngularJacobian(
btJacobianEntry & jacAngular,const btVector3 & jointAxisW) btJacobianEntry & jacAngular,const btVector3 & jointAxisW)
@@ -413,17 +415,18 @@ void btGeneric6DofConstraint::buildAngularJacobian(
} }
//-----------------------------------------------------------------------------
bool btGeneric6DofConstraint::testAngularLimitMotor(int axis_index) bool btGeneric6DofConstraint::testAngularLimitMotor(int axis_index)
{ {
btScalar angle = m_calculatedAxisAngleDiff[axis_index]; btScalar angle = m_calculatedAxisAngleDiff[axis_index];
m_angularLimits[axis_index].m_currentPosition = angle;
//test limits //test limits
m_angularLimits[axis_index].testLimitValue(angle); m_angularLimits[axis_index].testLimitValue(angle);
return m_angularLimits[axis_index].needApplyTorques(); return m_angularLimits[axis_index].needApplyTorques();
} }
//-----------------------------------------------------------------------------
void btGeneric6DofConstraint::buildJacobian() void btGeneric6DofConstraint::buildJacobian()
{ {
@@ -483,7 +486,7 @@ void btGeneric6DofConstraint::buildJacobian()
} }
} }
//-----------------------------------------------------------------------------
void btGeneric6DofConstraint::getInfo1 (btConstraintInfo1* info) void btGeneric6DofConstraint::getInfo1 (btConstraintInfo1* info)
{ {
@@ -519,7 +522,7 @@ void btGeneric6DofConstraint::getInfo1 (btConstraintInfo1* info)
} }
} }
//-----------------------------------------------------------------------------
void btGeneric6DofConstraint::getInfo2 (btConstraintInfo2* info) void btGeneric6DofConstraint::getInfo2 (btConstraintInfo2* info)
{ {
@@ -528,7 +531,7 @@ void btGeneric6DofConstraint::getInfo2 (btConstraintInfo2* info)
setAngularLimits(info, row); setAngularLimits(info, row);
} }
//-----------------------------------------------------------------------------
int btGeneric6DofConstraint::setLinearLimits(btConstraintInfo2* info) int btGeneric6DofConstraint::setLinearLimits(btConstraintInfo2* info)
{ {
@@ -542,6 +545,7 @@ int btGeneric6DofConstraint::setLinearLimits(btConstraintInfo2* info)
{ // re-use rotational motor code { // re-use rotational motor code
limot.m_bounce = btScalar(0.f); limot.m_bounce = btScalar(0.f);
limot.m_currentLimit = m_linearLimits.m_currentLimit[i]; limot.m_currentLimit = m_linearLimits.m_currentLimit[i];
limot.m_currentPosition = m_linearLimits.m_currentLinearDiff[i];
limot.m_currentLimitError = m_linearLimits.m_currentLimitError[i]; limot.m_currentLimitError = m_linearLimits.m_currentLimitError[i];
limot.m_damping = m_linearLimits.m_damping; limot.m_damping = m_linearLimits.m_damping;
limot.m_enableMotor = m_linearLimits.m_enableMotor[i]; limot.m_enableMotor = m_linearLimits.m_enableMotor[i];
@@ -559,7 +563,7 @@ int btGeneric6DofConstraint::setLinearLimits(btConstraintInfo2* info)
return row; return row;
} }
//-----------------------------------------------------------------------------
int btGeneric6DofConstraint::setAngularLimits(btConstraintInfo2 *info, int row_offset) int btGeneric6DofConstraint::setAngularLimits(btConstraintInfo2 *info, int row_offset)
{ {
@@ -582,7 +586,7 @@ int btGeneric6DofConstraint::setAngularLimits(btConstraintInfo2 *info, int row_o
return row; return row;
} }
//-----------------------------------------------------------------------------
void btGeneric6DofConstraint::solveConstraintObsolete(btSolverBody& bodyA,btSolverBody& bodyB,btScalar timeStep) void btGeneric6DofConstraint::solveConstraintObsolete(btSolverBody& bodyA,btSolverBody& bodyB,btScalar timeStep)
{ {
@@ -643,7 +647,7 @@ void btGeneric6DofConstraint::solveConstraintObsolete(btSolverBody& bodyA,btSolv
} }
} }
//-----------------------------------------------------------------------------
void btGeneric6DofConstraint::updateRHS(btScalar timeStep) void btGeneric6DofConstraint::updateRHS(btScalar timeStep)
{ {
@@ -651,21 +655,26 @@ void btGeneric6DofConstraint::updateRHS(btScalar timeStep)
} }
//-----------------------------------------------------------------------------
btVector3 btGeneric6DofConstraint::getAxis(int axis_index) const btVector3 btGeneric6DofConstraint::getAxis(int axis_index) const
{ {
return m_calculatedAxis[axis_index]; return m_calculatedAxis[axis_index];
} }
//-----------------------------------------------------------------------------
btScalar btGeneric6DofConstraint::getAngle(int axis_index) const btScalar btGeneric6DofConstraint::getRelativePivotPosition(int axisIndex) const
{ {
return m_calculatedAxisAngleDiff[axis_index]; return m_calculatedLinearDiff[axisIndex];
} }
//-----------------------------------------------------------------------------
btScalar btGeneric6DofConstraint::getAngle(int axisIndex) const
{
return m_calculatedAxisAngleDiff[axisIndex];
}
void btGeneric6DofConstraint::calcAnchorPos(void) void btGeneric6DofConstraint::calcAnchorPos(void)
{ {
@@ -684,9 +693,9 @@ void btGeneric6DofConstraint::calcAnchorPos(void)
const btVector3& pB = m_calculatedTransformB.getOrigin(); const btVector3& pB = m_calculatedTransformB.getOrigin();
m_AnchorPos = pA * weight + pB * (btScalar(1.0) - weight); m_AnchorPos = pA * weight + pB * (btScalar(1.0) - weight);
return; return;
} // btGeneric6DofConstraint::calcAnchorPos() }
//-----------------------------------------------------------------------------
void btGeneric6DofConstraint::calculateLinearInfo() void btGeneric6DofConstraint::calculateLinearInfo()
{ {
@@ -694,11 +703,12 @@ void btGeneric6DofConstraint::calculateLinearInfo()
m_calculatedLinearDiff = m_calculatedTransformA.getBasis().inverse() * m_calculatedLinearDiff; m_calculatedLinearDiff = m_calculatedTransformA.getBasis().inverse() * m_calculatedLinearDiff;
for(int i = 0; i < 3; i++) for(int i = 0; i < 3; i++)
{ {
m_linearLimits.m_currentLinearDiff[i] = m_calculatedLinearDiff[i];
m_linearLimits.testLimitValue(i, m_calculatedLinearDiff[i]); m_linearLimits.testLimitValue(i, m_calculatedLinearDiff[i]);
} }
} // btGeneric6DofConstraint::calculateLinearInfo() }
//-----------------------------------------------------------------------------
int btGeneric6DofConstraint::get_limit_motor_info2( int btGeneric6DofConstraint::get_limit_motor_info2(
btRotationalLimitMotor * limot, btRotationalLimitMotor * limot,
@@ -721,7 +731,7 @@ int btGeneric6DofConstraint::get_limit_motor_info2(
J2[srow+1] = -ax1[1]; J2[srow+1] = -ax1[1];
J2[srow+2] = -ax1[2]; J2[srow+2] = -ax1[2];
} }
if((!rotational) && limit) if((!rotational))
{ {
btVector3 ltd; // Linear Torque Decoupling vector btVector3 ltd; // Linear Torque Decoupling vector
btVector3 c = m_calculatedTransformB.getOrigin() - body0->getCenterOfMassPosition(); btVector3 c = m_calculatedTransformB.getOrigin() - body0->getCenterOfMassPosition();
@@ -745,7 +755,14 @@ int btGeneric6DofConstraint::get_limit_motor_info2(
info->cfm[srow] = 0.0f; info->cfm[srow] = 0.0f;
if(!limit) if(!limit)
{ {
info->m_constraintError[srow] += limot->m_targetVelocity; btScalar tag_vel = rotational ? limot->m_targetVelocity : -limot->m_targetVelocity;
btScalar mot_fact = getMotorFactor( limot->m_currentPosition,
limot->m_loLimit,
limot->m_hiLimit,
tag_vel,
info->fps * info->erp);
info->m_constraintError[srow] += mot_fact * limot->m_targetVelocity;
info->m_lowerLimit[srow] = -limot->m_maxMotorForce; info->m_lowerLimit[srow] = -limot->m_maxMotorForce;
info->m_upperLimit[srow] = limot->m_maxMotorForce; info->m_upperLimit[srow] = limot->m_maxMotorForce;
} }
@@ -824,6 +841,131 @@ int btGeneric6DofConstraint::get_limit_motor_info2(
else return 0; else return 0;
} }
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
btGeneric6DofSpringConstraint::btGeneric6DofSpringConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA)
: btGeneric6DofConstraint(rbA, rbB, frameInA, frameInB, useLinearReferenceFrameA)
{
for(int i = 0; i < 6; i++)
{
m_springEnabled[i] = false;
m_equilibriumPoint[i] = btScalar(0.f);
m_springStiffness[i] = btScalar(0.f);
m_springDamping[i] = btScalar(1.f);
}
}
void btGeneric6DofSpringConstraint::enableSpring(int index, bool onOff)
{
btAssert((index >= 0) && (index < 6));
m_springEnabled[index] = onOff;
if(index < 3)
{
m_linearLimits.m_enableMotor[index] = onOff;
}
else
{
m_angularLimits[index - 3].m_enableMotor = onOff;
}
}
void btGeneric6DofSpringConstraint::setStiffness(int index, btScalar stiffness)
{
btAssert((index >= 0) && (index < 6));
m_springStiffness[index] = stiffness;
}
void btGeneric6DofSpringConstraint::setDamping(int index, btScalar damping)
{
btAssert((index >= 0) && (index < 6));
m_springDamping[index] = damping;
}
void btGeneric6DofSpringConstraint::setEquilibriumPoint()
{
calculateTransforms();
for(int i = 0; i < 3; i++)
{
m_equilibriumPoint[i] = m_calculatedLinearDiff[i];
}
for(int i = 0; i < 3; i++)
{
m_equilibriumPoint[i + 3] = m_calculatedAxisAngleDiff[i];
}
}
void btGeneric6DofSpringConstraint::setEquilibriumPoint(int index)
{
btAssert((index >= 0) && (index < 6));
calculateTransforms();
if(index < 3)
{
m_equilibriumPoint[index] = m_calculatedLinearDiff[index];
}
else
{
m_equilibriumPoint[index + 3] = m_calculatedAxisAngleDiff[index];
}
}
void btGeneric6DofSpringConstraint::internalUpdateSprings(btConstraintInfo2* info)
{
calculateTransforms();
// it is assumed that calculateTransforms() have been called before this call
int i;
btVector3 relVel = m_rbB.getLinearVelocity() - m_rbA.getLinearVelocity();
for(i = 0; i < 3; i++)
{
if(m_springEnabled[i])
{
// get current position of constraint
btScalar currPos = m_calculatedLinearDiff[i];
// calculate difference
btScalar delta = currPos - m_equilibriumPoint[i];
// spring force is (delta * m_stiffness) according to Hooke's Law
btScalar force = delta * m_springStiffness[i];
btScalar velFactor = info->fps * m_springDamping[i];
m_linearLimits.m_targetVelocity[i] = velFactor * force;
m_linearLimits.m_maxMotorForce[i] = btFabs(force) / info->fps;
}
}
for(i = 0; i < 3; i++)
{
if(m_springEnabled[i + 3])
{
// get current position of constraint
btScalar currPos = m_calculatedAxisAngleDiff[i];
// calculate difference
btScalar delta = currPos - m_equilibriumPoint[i+3];
// spring force is (-delta * m_stiffness) according to Hooke's Law
btScalar force = -delta * m_springStiffness[i+3];
btScalar velFactor = info->fps * m_springDamping[i+3];
m_angularLimits[i].m_targetVelocity = velFactor * force;
m_angularLimits[i].m_maxMotorForce = btFabs(force) / info->fps;
}
}
}
void btGeneric6DofSpringConstraint::getInfo2(btConstraintInfo2* info)
{
// this will be called by constraint solver at the constraint setup stage
// set current motor parameters
internalUpdateSprings(info);
// do the rest of job for constraint setup
btGeneric6DofConstraint::getInfo2(info);
}

View File

@@ -54,6 +54,7 @@ public:
//! temp_variables //! temp_variables
//!@{ //!@{
btScalar m_currentLimitError;//! How much is violated this limit btScalar m_currentLimitError;//! How much is violated this limit
btScalar m_currentPosition; //! current value of angle
int m_currentLimit;//!< 0=free, 1=at lo limit, 2=at hi limit int m_currentLimit;//!< 0=free, 1=at lo limit, 2=at hi limit
btScalar m_accumulatedImpulse; btScalar m_accumulatedImpulse;
//!@} //!@}
@@ -134,6 +135,7 @@ public:
btVector3 m_targetVelocity;//!< target motor velocity btVector3 m_targetVelocity;//!< target motor velocity
btVector3 m_maxMotorForce;//!< max force on motor btVector3 m_maxMotorForce;//!< max force on motor
btVector3 m_currentLimitError;//! How much is violated this limit btVector3 m_currentLimitError;//! How much is violated this limit
btVector3 m_currentLinearDiff;//! Current relative offset of constraint frames
int m_currentLimit[3];//!< 0=free, 1=at lower limit, 2=at upper limit int m_currentLimit[3];//!< 0=free, 1=at lower limit, 2=at upper limit
btTranslationalLimitMotor() btTranslationalLimitMotor()
@@ -380,14 +382,21 @@ public:
//! Get the relative Euler angle //! Get the relative Euler angle
/*! /*!
\pre btGeneric6DofConstraint.buildJacobian must be called previously. \pre btGeneric6DofConstraint::calculateTransforms() must be called previously.
*/ */
btScalar getAngle(int axis_index) const; btScalar getAngle(int axis_index) const;
//! Get the relative position of the constraint pivot
/*!
\pre btGeneric6DofConstraint::calculateTransforms() must be called previously.
*/
btScalar getRelativePivotPosition(int axis_index) const;
//! Test angular limit. //! Test angular limit.
/*! /*!
Calculates angular correction and returns true if limit needs to be corrected. Calculates angular correction and returns true if limit needs to be corrected.
\pre btGeneric6DofConstraint.buildJacobian must be called previously. \pre btGeneric6DofConstraint::calculateTransforms() must be called previously.
*/ */
bool testAngularLimitMotor(int axis_index); bool testAngularLimitMotor(int axis_index);
@@ -477,4 +486,34 @@ public:
}; };
/// Generic 6 DOF constraint that allows to set spring motors to any translational and rotational DOF
/// DOF index used in enableSpring() and setStiffness() means:
/// 0 : translation X
/// 1 : translation Y
/// 2 : translation Z
/// 3 : rotation X (3rd Euler rotational around new position of X axis, range [-PI+epsilon, PI-epsilon] )
/// 4 : rotation Y (2nd Euler rotational around new position of Y axis, range [-PI/2+epsilon, PI/2-epsilon] )
/// 5 : rotation Z (1st Euler rotational around Z axis, range [-PI+epsilon, PI-epsilon] )
class btGeneric6DofSpringConstraint : public btGeneric6DofConstraint
{
protected:
bool m_springEnabled[6];
btScalar m_equilibriumPoint[6];
btScalar m_springStiffness[6];
btScalar m_springDamping[6]; // between 0 and 1 (1 == no damping)
void internalUpdateSprings(btConstraintInfo2* info);
public:
btGeneric6DofSpringConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA);
void enableSpring(int index, bool onOff);
void setStiffness(int index, btScalar stiffness);
void setDamping(int index, btScalar damping);
void setEquilibriumPoint(); // set the current constraint position/orientation as an equilibrium point for all DOF
void setEquilibriumPoint(int index); // set the current constraint position/orientation as an equilibrium point for given DOF
virtual void getInfo2 (btConstraintInfo2* info);
};
#endif //GENERIC_6DOF_CONSTRAINT_H #endif //GENERIC_6DOF_CONSTRAINT_H

View File

@@ -490,7 +490,7 @@ void btSequentialImpulseConstraintSolver::convertContact(btPersistentManifold* m
///warm starting (or zero if disabled) ///warm starting (or zero if disabled)
if (0)//infoGlobal.m_solverMode & SOLVER_USE_WARMSTARTING) if (infoGlobal.m_solverMode & SOLVER_USE_WARMSTARTING)
{ {
solverConstraint.m_appliedImpulse = cp.m_appliedImpulse * infoGlobal.m_warmstartingFactor; solverConstraint.m_appliedImpulse = cp.m_appliedImpulse * infoGlobal.m_warmstartingFactor;
if (rb0) if (rb0)
@@ -539,9 +539,6 @@ void btSequentialImpulseConstraintSolver::convertContact(btPersistentManifold* m
if (!(infoGlobal.m_solverMode & SOLVER_DISABLE_VELOCITY_DEPENDENT_FRICTION_DIRECTION) && lat_rel_vel > SIMD_EPSILON) if (!(infoGlobal.m_solverMode & SOLVER_DISABLE_VELOCITY_DEPENDENT_FRICTION_DIRECTION) && lat_rel_vel > SIMD_EPSILON)
{ {
cp.m_lateralFrictionDir1 /= btSqrt(lat_rel_vel); cp.m_lateralFrictionDir1 /= btSqrt(lat_rel_vel);
applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir1);
applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir1);
addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation);
if((infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS)) if((infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS))
{ {
cp.m_lateralFrictionDir2 = cp.m_lateralFrictionDir1.cross(cp.m_normalWorldOnB); cp.m_lateralFrictionDir2 = cp.m_lateralFrictionDir1.cross(cp.m_normalWorldOnB);
@@ -550,21 +547,26 @@ void btSequentialImpulseConstraintSolver::convertContact(btPersistentManifold* m
applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir2); applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir2);
addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation); addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation);
} }
applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir1);
applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir1);
addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation);
cp.m_lateralFrictionInitialized = true; cp.m_lateralFrictionInitialized = true;
} else } else
{ {
//re-calculate friction direction every frame, todo: check if this is really needed //re-calculate friction direction every frame, todo: check if this is really needed
btPlaneSpace1(cp.m_normalWorldOnB,cp.m_lateralFrictionDir1,cp.m_lateralFrictionDir2); btPlaneSpace1(cp.m_normalWorldOnB,cp.m_lateralFrictionDir1,cp.m_lateralFrictionDir2);
applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir1);
applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir1);
addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation);
if ((infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS)) if ((infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS))
{ {
applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir2); applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir2);
applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir2); applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir2);
addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation); addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation);
} }
applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir1);
applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir1);
addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation);
cp.m_lateralFrictionInitialized = true; cp.m_lateralFrictionInitialized = true;
} }

View File

@@ -18,14 +18,14 @@ Added by Roman Ponomarev (rponom@gmail.com)
April 04, 2008 April 04, 2008
*/ */
//-----------------------------------------------------------------------------
#include "btSliderConstraint.h" #include "btSliderConstraint.h"
#include "BulletDynamics/Dynamics/btRigidBody.h" #include "BulletDynamics/Dynamics/btRigidBody.h"
#include "LinearMath/btTransformUtil.h" #include "LinearMath/btTransformUtil.h"
#include <new> #include <new>
//-----------------------------------------------------------------------------
void btSliderConstraint::initParams() void btSliderConstraint::initParams()
{ {
@@ -62,9 +62,9 @@ void btSliderConstraint::initParams()
m_maxAngMotorForce = btScalar(0.); m_maxAngMotorForce = btScalar(0.);
m_accumulatedAngMotorImpulse = btScalar(0.0); m_accumulatedAngMotorImpulse = btScalar(0.0);
} // btSliderConstraint::initParams() }
//-----------------------------------------------------------------------------
btSliderConstraint::btSliderConstraint() btSliderConstraint::btSliderConstraint()
:btTypedConstraint(SLIDER_CONSTRAINT_TYPE), :btTypedConstraint(SLIDER_CONSTRAINT_TYPE),
@@ -73,9 +73,9 @@ btSliderConstraint::btSliderConstraint()
// m_useSolveConstraintObsolete(true) // m_useSolveConstraintObsolete(true)
{ {
initParams(); initParams();
} // btSliderConstraint::btSliderConstraint() }
//-----------------------------------------------------------------------------
btSliderConstraint::btSliderConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB, bool useLinearReferenceFrameA) btSliderConstraint::btSliderConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB, bool useLinearReferenceFrameA)
: btTypedConstraint(SLIDER_CONSTRAINT_TYPE, rbA, rbB) : btTypedConstraint(SLIDER_CONSTRAINT_TYPE, rbA, rbB)
@@ -86,9 +86,25 @@ btSliderConstraint::btSliderConstraint(btRigidBody& rbA, btRigidBody& rbB, const
// m_useSolveConstraintObsolete(true) // m_useSolveConstraintObsolete(true)
{ {
initParams(); initParams();
} // btSliderConstraint::btSliderConstraint() }
static btRigidBody s_fixed(0, 0, 0);
btSliderConstraint::btSliderConstraint(btRigidBody& rbB, const btTransform& frameInB, bool useLinearReferenceFrameB)
: btTypedConstraint(SLIDER_CONSTRAINT_TYPE, s_fixed, rbB)
,
m_frameInB(frameInB),
m_useLinearReferenceFrameA(useLinearReferenceFrameB),
m_useSolveConstraintObsolete(false)
// m_useSolveConstraintObsolete(true)
{
///not providing rigidbody B means implicitly using worldspace for body B
// m_frameInA.getOrigin() = m_rbA.getCenterOfMassTransform()(m_frameInA.getOrigin());
initParams();
}
//-----------------------------------------------------------------------------
void btSliderConstraint::buildJacobian() void btSliderConstraint::buildJacobian()
{ {
@@ -104,9 +120,9 @@ void btSliderConstraint::buildJacobian()
{ {
buildJacobianInt(m_rbB, m_rbA, m_frameInB, m_frameInA); buildJacobianInt(m_rbB, m_rbA, m_frameInB, m_frameInA);
} }
} // btSliderConstraint::buildJacobian() }
//-----------------------------------------------------------------------------
void btSliderConstraint::buildJacobianInt(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB) void btSliderConstraint::buildJacobianInt(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB)
{ {
@@ -159,9 +175,9 @@ void btSliderConstraint::buildJacobianInt(btRigidBody& rbA, btRigidBody& rbB, co
// clear accumulator for motors // clear accumulator for motors
m_accumulatedLinMotorImpulse = btScalar(0.0); m_accumulatedLinMotorImpulse = btScalar(0.0);
m_accumulatedAngMotorImpulse = btScalar(0.0); m_accumulatedAngMotorImpulse = btScalar(0.0);
} // btSliderConstraint::buildJacobianInt() }
//-----------------------------------------------------------------------------
void btSliderConstraint::getInfo1(btConstraintInfo1* info) void btSliderConstraint::getInfo1(btConstraintInfo1* info)
{ {
@@ -189,9 +205,9 @@ void btSliderConstraint::getInfo1(btConstraintInfo1* info)
info->nub--; info->nub--;
} }
} }
} // btSliderConstraint::getInfo1() }
//-----------------------------------------------------------------------------
void btSliderConstraint::getInfo2(btConstraintInfo2* info) void btSliderConstraint::getInfo2(btConstraintInfo2* info)
{ {
@@ -499,9 +515,9 @@ void btSliderConstraint::getInfo2(btConstraintInfo2* info)
info->m_constraintError[srow] *= getSoftnessLimAng(); info->m_constraintError[srow] *= getSoftnessLimAng();
} // if(limit) } // if(limit)
} // if angular limit or powered } // if angular limit or powered
} // btSliderConstraint::getInfo2() }
//-----------------------------------------------------------------------------
void btSliderConstraint::solveConstraintObsolete(btSolverBody& bodyA,btSolverBody& bodyB,btScalar timeStep) void btSliderConstraint::solveConstraintObsolete(btSolverBody& bodyA,btSolverBody& bodyB,btScalar timeStep)
{ {
@@ -517,9 +533,9 @@ void btSliderConstraint::solveConstraintObsolete(btSolverBody& bodyA,btSolverBod
solveConstraintInt(m_rbB,bodyB, m_rbA,bodyA); solveConstraintInt(m_rbB,bodyB, m_rbA,bodyA);
} }
} }
} // btSliderConstraint::solveConstraint() }
//-----------------------------------------------------------------------------
void btSliderConstraint::solveConstraintInt(btRigidBody& rbA, btSolverBody& bodyA,btRigidBody& rbB, btSolverBody& bodyB) void btSliderConstraint::solveConstraintInt(btRigidBody& rbA, btSolverBody& bodyA,btRigidBody& rbB, btSolverBody& bodyB)
{ {
@@ -703,11 +719,11 @@ void btSliderConstraint::solveConstraintInt(btRigidBody& rbA, btSolverBody& body
bodyB.applyImpulse(btVector3(0,0,0), rbB.getInvInertiaTensorWorld()*axisA,-angImpulse); bodyB.applyImpulse(btVector3(0,0,0), rbB.getInvInertiaTensorWorld()*axisA,-angImpulse);
} }
} }
} // btSliderConstraint::solveConstraint() }
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void btSliderConstraint::calculateTransforms(void){ void btSliderConstraint::calculateTransforms(void){
if(m_useLinearReferenceFrameA || (!m_useSolveConstraintObsolete)) if(m_useLinearReferenceFrameA || (!m_useSolveConstraintObsolete))
@@ -740,9 +756,9 @@ void btSliderConstraint::calculateTransforms(void){
normalWorld = m_calculatedTransformA.getBasis().getColumn(i); normalWorld = m_calculatedTransformA.getBasis().getColumn(i);
m_depth[i] = m_delta.dot(normalWorld); m_depth[i] = m_delta.dot(normalWorld);
} }
} // btSliderConstraint::calculateTransforms() }
//-----------------------------------------------------------------------------
void btSliderConstraint::testLinLimits(void) void btSliderConstraint::testLinLimits(void)
{ {
@@ -769,9 +785,9 @@ void btSliderConstraint::testLinLimits(void)
{ {
m_depth[0] = btScalar(0.); m_depth[0] = btScalar(0.);
} }
} // btSliderConstraint::testLinLimits() }
//-----------------------------------------------------------------------------
void btSliderConstraint::testAngLimits(void) void btSliderConstraint::testAngLimits(void)
{ {
@@ -795,9 +811,9 @@ void btSliderConstraint::testAngLimits(void)
m_solveAngLim = true; m_solveAngLim = true;
} }
} }
} // btSliderConstraint::testAngLimits() }
//-----------------------------------------------------------------------------
btVector3 btSliderConstraint::getAncorInA(void) btVector3 btSliderConstraint::getAncorInA(void)
{ {
@@ -805,13 +821,13 @@ btVector3 btSliderConstraint::getAncorInA(void)
ancorInA = m_realPivotAInW + (m_lowerLinLimit + m_upperLinLimit) * btScalar(0.5) * m_sliderAxis; ancorInA = m_realPivotAInW + (m_lowerLinLimit + m_upperLinLimit) * btScalar(0.5) * m_sliderAxis;
ancorInA = m_rbA.getCenterOfMassTransform().inverse() * ancorInA; ancorInA = m_rbA.getCenterOfMassTransform().inverse() * ancorInA;
return ancorInA; return ancorInA;
} // btSliderConstraint::getAncorInA() }
//-----------------------------------------------------------------------------
btVector3 btSliderConstraint::getAncorInB(void) btVector3 btSliderConstraint::getAncorInB(void)
{ {
btVector3 ancorInB; btVector3 ancorInB;
ancorInB = m_frameInB.getOrigin(); ancorInB = m_frameInB.getOrigin();
return ancorInB; return ancorInB;
} // btSliderConstraint::getAncorInB(); }

View File

@@ -25,23 +25,23 @@ TODO:
#ifndef SLIDER_CONSTRAINT_H #ifndef SLIDER_CONSTRAINT_H
#define SLIDER_CONSTRAINT_H #define SLIDER_CONSTRAINT_H
//-----------------------------------------------------------------------------
#include "LinearMath/btVector3.h" #include "LinearMath/btVector3.h"
#include "btJacobianEntry.h" #include "btJacobianEntry.h"
#include "btTypedConstraint.h" #include "btTypedConstraint.h"
//-----------------------------------------------------------------------------
class btRigidBody; class btRigidBody;
//-----------------------------------------------------------------------------
#define SLIDER_CONSTRAINT_DEF_SOFTNESS (btScalar(1.0)) #define SLIDER_CONSTRAINT_DEF_SOFTNESS (btScalar(1.0))
#define SLIDER_CONSTRAINT_DEF_DAMPING (btScalar(1.0)) #define SLIDER_CONSTRAINT_DEF_DAMPING (btScalar(1.0))
#define SLIDER_CONSTRAINT_DEF_RESTITUTION (btScalar(0.7)) #define SLIDER_CONSTRAINT_DEF_RESTITUTION (btScalar(0.7))
//-----------------------------------------------------------------------------
class btSliderConstraint : public btTypedConstraint class btSliderConstraint : public btTypedConstraint
{ {
@@ -126,6 +126,7 @@ protected:
public: public:
// constructors // constructors
btSliderConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA); btSliderConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA);
btSliderConstraint(btRigidBody& rbB, const btTransform& frameInB, bool useLinearReferenceFrameB);
btSliderConstraint(); btSliderConstraint();
// overrides // overrides
virtual void buildJacobian(); virtual void buildJacobian();
@@ -223,7 +224,7 @@ public:
btVector3 getAncorInB(void); btVector3 getAncorInB(void);
}; };
//-----------------------------------------------------------------------------
#endif //SLIDER_CONSTRAINT_H #endif //SLIDER_CONSTRAINT_H

View File

@@ -1 +1,4 @@
SUBDIRS( BulletCollision BulletDynamics LinearMath BulletSoftBody ) ADD_SUBDIRECTORY(BulletCollision)
ADD_SUBDIRECTORY(BulletDynamics)
ADD_SUBDIRECTORY(LinearMath)
ADD_SUBDIRECTORY(BulletSoftBody )

View File

@@ -168,8 +168,12 @@ inline int btGetVersion()
///The btScalar type abstracts floating point numbers, to easily switch between double and single floating point precision. ///The btScalar type abstracts floating point numbers, to easily switch between double and single floating point precision.
#if defined(BT_USE_DOUBLE_PRECISION) #if defined(BT_USE_DOUBLE_PRECISION)
typedef double btScalar; typedef double btScalar;
//this number could be bigger in double precision
#define BT_LARGE_FLOAT 1e30
#else #else
typedef float btScalar; typedef float btScalar;
//keep BT_LARGE_FLOAT*BT_LARGE_FLOAT < FLT_MAX
#define BT_LARGE_FLOAT 1e18f
#endif #endif

View File

@@ -561,6 +561,7 @@ opj_image_t* jp2_decode(opj_jp2_t *jp2, opj_cio_t *cio, opj_codestream_info_t *c
image = j2k_decode(jp2->j2k, cio, cstr_info); image = j2k_decode(jp2->j2k, cio, cstr_info);
if(!image) { if(!image) {
opj_event_msg(cinfo, EVT_ERROR, "Failed to decode J2K image\n"); opj_event_msg(cinfo, EVT_ERROR, "Failed to decode J2K image\n");
return NULL;
} }
/* Set Image Color Space */ /* Set Image Color Space */

View File

@@ -24,10 +24,20 @@
# #
# ***** END GPL LICENSE BLOCK ***** # ***** END GPL LICENSE BLOCK *****
SUBDIRS(SoundSystem string ghost guardedalloc moto container memutil decimation iksolver boolop opennl) ADD_SUBDIRECTORY(SoundSystem)
ADD_SUBDIRECTORY(string)
ADD_SUBDIRECTORY(ghost)
ADD_SUBDIRECTORY(guardedalloc)
ADD_SUBDIRECTORY(moto)
ADD_SUBDIRECTORY(container)
ADD_SUBDIRECTORY(memutil)
ADD_SUBDIRECTORY(decimation)
ADD_SUBDIRECTORY(iksolver)
ADD_SUBDIRECTORY(boolop)
ADD_SUBDIRECTORY(opennl)
IF(WITH_ELBEEM) IF(WITH_ELBEEM)
SUBDIRS(elbeem) ADD_SUBDIRECTORY(elbeem)
ENDIF(WITH_ELBEEM) ENDIF(WITH_ELBEEM)
SUBDIRS(bsp) ADD_SUBDIRECTORY(bsp)

View File

@@ -1,43 +0,0 @@
#
# $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 *****
#
#
LIBNAME = FmodSoundSystem
DIR = $(OCGDIR)/intern/$(LIBNAME)
include nan_compile.mk
CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
CPPFLAGS += -I$(NAN_FMOD)/include
CPPFLAGS += -I$(NAN_STRING)/include
CPPFLAGS += -I$(NAN_MOTO)/include
CPPFLAGS += -I../intern
CPPFLAGS += -I..
CPPFLAGS += -I.

View File

@@ -1,574 +0,0 @@
/*
* $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 *****
* SND_FmodDevice derived from SND_IAudioDevice
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef WIN32
#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
#endif //WIN32
#include "SND_FmodDevice.h"
#include "SoundDefines.h"
#include "SND_Utils.h"
SND_FmodDevice::SND_FmodDevice()
{
/* Removed the functionality for checking if noaudio was provided on */
/* the commandline. */
m_dspunit = NULL;
m_audio = true;
// let's check if we can get fmod to initialize...
if (m_audio)
{
signed char MinHardwareChannels = FSOUND_SetMinHardwareChannels(NUM_FMOD_MIN_HW_CHANNELS);
signed char MaxHardwareChannels = FSOUND_SetMaxHardwareChannels(NUM_FMOD_MAX_HW_CHANNELS);
if (FSOUND_Init(MIXRATE, NUM_SOURCES, 0))
{
m_max_channels = FSOUND_GetMaxChannels();
m_num_hardware_channels = FSOUND_GetNumHardwareChannels();
m_num_software_channels = NUM_SOURCES;
// let's get us a wavecache
m_wavecache = new SND_WaveCache();
int i;
for (i = 0; i < NUM_BUFFERS; i++)
m_buffers[i] = NULL;
for (i = 0; i < NUM_SOURCES; i++)
{
m_sources[i] = NULL;
m_frequencies[i] = 0;
m_channels[i] = 0;
}
}
else
{
m_audio = false;
}
}
#ifdef ONTKEVER
int numdrivers = FSOUND_GetNumDrivers();
int output = FSOUND_GetOutput();
int oputputrate = FSOUND_GetOutputRate();
int mixer = FSOUND_GetMixer();
printf("maxchannels is: %d\n", m_max_channels);
printf("num hw channels is: %d\n", m_num_hardware_channels);
printf("num sw channels is: %d\n", m_num_software_channels);
printf("numdrivers is: %d\n", numdrivers);
printf("output is: %d\n", output);
printf("oputputrate is: %d\n", oputputrate);
printf("mixer is: %d\n", mixer);
#endif
}
SND_FmodDevice::~SND_FmodDevice()
{
// let's see if we used the cd. if not, just leave it alone
SND_CDObject* pCD = SND_CDObject::Instance();
if (pCD)
{
this->StopCD();
SND_CDObject::DisposeSystem();
}
StopUsingDSP();
FSOUND_Close();
}
void SND_FmodDevice::UseCD() const
{
// only fmod has CD support, so only create it here
SND_CDObject::CreateSystem();
}
void SND_FmodDevice::MakeCurrent() const
{
// empty
}
SND_WaveSlot* SND_FmodDevice::LoadSample(const STR_String& name,
void* memlocation,
int size)
{
SND_WaveSlot* waveslot = NULL;
STR_String samplename = name;
if (m_audio)
{
/* first check if the sample is supported */
if (SND_IsSampleValid(name, memlocation))
{
/* create the waveslot */
waveslot = m_wavecache->GetWaveSlot(samplename);
if (waveslot)
{
int buffer = waveslot->GetBuffer();
/* load the sample from memory? */
if (size && memlocation)
{
m_buffers[buffer] = FSOUND_Sample_Load(buffer, (char*)memlocation, FSOUND_LOADMEMORY, size);
/* if the loading succeeded, fill the waveslot with info */
if (m_buffers[buffer])
{
int sampleformat = SND_GetSampleFormat(memlocation);
int numberofchannels = SND_GetNumberOfChannels(memlocation);
int samplerate = SND_GetSampleRate(memlocation);
int bitrate = SND_GetBitRate(memlocation);
int numberofsamples = SND_GetNumberOfSamples(memlocation, size);
waveslot->SetFileSize(size);
waveslot->SetData(memlocation);
waveslot->SetSampleFormat(sampleformat);
waveslot->SetNumberOfChannels(numberofchannels);
waveslot->SetSampleRate(samplerate);
waveslot->SetBitRate(bitrate);
waveslot->SetNumberOfSamples(numberofsamples);
}
}
/* or from file? */
else
{
m_buffers[buffer] = FSOUND_Sample_Load(buffer, samplename.Ptr(), FSOUND_LOOP_NORMAL, NULL);
}
#ifdef ONTKEVER
int error = FSOUND_GetError();
printf("sample load: errornumber is: %d\n", error);
#endif
/* if the loading succeeded, mark the waveslot */
if (m_buffers[buffer])
{
waveslot->SetLoaded(true);
}
/* or when it failed, free the waveslot */
else
{
m_wavecache->RemoveSample(waveslot->GetSampleName(), waveslot->GetBuffer());
waveslot = NULL;
}
}
}
}
return waveslot;
}
// listener's and general stuff //////////////////////////////////////////////////////
/* sets the global dopplervelocity */
void SND_FmodDevice::SetDopplerVelocity(MT_Scalar dopplervelocity) const
{
/* not supported by fmod */
FSOUND_3D_Listener_SetDopplerFactor(dopplervelocity);
}
/* sets the global dopplerfactor */
void SND_FmodDevice::SetDopplerFactor(MT_Scalar dopplerfactor) const
{
FSOUND_3D_Listener_SetDopplerFactor(dopplerfactor);
}
/* sets the global rolloff factor */
void SND_FmodDevice::SetListenerRollOffFactor(MT_Scalar rollofffactor) const
{
// not implemented in openal
}
void SND_FmodDevice::NextFrame() const
{
FSOUND_3D_Update();
}
// set the gain for the listener
void SND_FmodDevice::SetListenerGain(float gain) const
{
int fmod_gain = (int)(gain * 255);
FSOUND_SetSFXMasterVolume(fmod_gain);
}
void SND_FmodDevice::InitListener()
{
// initialize the listener with these values that won't change
// (as long as we can have only one listener)
// now we can superimpose all listeners on each other (for they
// have the same settings)
float lispos[3] = {0,0,0};
float lisvel[3] = {0,0,0};
FSOUND_3D_Listener_SetAttributes(lispos, lisvel, 0, -1, 0, 0, 0, 1);
}
// source playstate stuff ////////////////////////////////////////////////////////////
// check if the sound's still playing
int SND_FmodDevice::GetPlayState(int id)
{
int result = SND_STOPPED;
// klopt niet, fixen
signed char isplaying = FSOUND_IsPlaying(id);
if (isplaying)
{
result = SND_PLAYING;
}
/* hi reevan, just swap // of these 2 lines */
// return result;
return 0;
}
/* sets the buffer */
void SND_FmodDevice::SetObjectBuffer(int id, unsigned int buffer)
{
m_sources[id] = m_buffers[buffer];
}
// make the source play
void SND_FmodDevice::PlayObject(int id)
{
m_channels[id] = FSOUND_PlaySound(FSOUND_FREE, m_sources[id]);
m_frequencies[id] = FSOUND_GetFrequency(m_channels[id]);
// printf("fmod: play \n");
}
// make the source stop
void SND_FmodDevice::StopObject(int id) const
{
FSOUND_StopSound(m_channels[id]);
// printf("fmod: stop \n");
}
// stop all sources
void SND_FmodDevice::StopAllObjects()
{
FSOUND_StopSound(FSOUND_ALL);
}
// pause the source
void SND_FmodDevice::PauseObject(int id) const
{
FSOUND_StopSound(m_channels[id]);
}
// source properties stuff ////////////////////////////////////////////////////////////
// give openal the object's pitch
void SND_FmodDevice::SetObjectPitch(int id, MT_Scalar pitch) const
{
pitch = pitch * m_frequencies[id];
char result = FSOUND_SetFrequency(m_channels[id], (int)pitch);
}
// give openal the object's gain
void SND_FmodDevice::SetObjectGain(int id, MT_Scalar gain) const
{
int vol = (int)(gain * 255);
FSOUND_SetVolume(m_channels[id], vol);
}
// give openal the object's looping
void SND_FmodDevice::SetObjectLoop(int id, unsigned int loopmode) const
{
// printf("loopmode: %d\n", loopmode);
switch (loopmode)
{
case SND_LOOP_OFF:
{
#ifndef __APPLE__
char result = FSOUND_Sample_SetLoopMode(m_sources[id], FSOUND_LOOP_OFF);
#else
char result = FSOUND_SetLoopMode(m_sources[id], FSOUND_LOOP_OFF);
#endif
// char result = FSOUND_SetLoopMode(m_channels[id], FSOUND_LOOP_OFF);
break;
}
case SND_LOOP_NORMAL:
{
#ifndef __APPLE__
char result = FSOUND_Sample_SetLoopMode(m_sources[id], FSOUND_LOOP_NORMAL);
#else
char result = FSOUND_SetLoopMode(m_sources[id], FSOUND_LOOP_NORMAL);
#endif
// char result = FSOUND_SetLoopMode(m_channels[id], FSOUND_LOOP_NORMAL);
break;
}
case SND_LOOP_BIDIRECTIONAL:
{
#ifndef __APPLE__
char result = FSOUND_Sample_SetLoopMode(m_sources[id], FSOUND_LOOP_BIDI);
#else
char result = FSOUND_SetLoopMode(m_sources[id], FSOUND_LOOP_BIDI);
#endif
// char result = FSOUND_SetLoopMode(m_channels[id], FSOUND_LOOP_NORMAL);
break;
}
default:
break;
}
}
void SND_FmodDevice::SetObjectLoopPoints(int id, unsigned int loopstart, unsigned int loopend) const
{
FSOUND_Sample_SetLoopPoints(m_sources[id], loopstart, loopend);
}
void SND_FmodDevice::SetObjectMinGain(int id, MT_Scalar mingain) const
{
/* not supported by fmod */
}
void SND_FmodDevice::SetObjectMaxGain(int id, MT_Scalar maxgain) const
{
/* not supported by fmod */
}
void SND_FmodDevice::SetObjectRollOffFactor(int id, MT_Scalar rollofffactor) const
{
/* not supported by fmod */
}
void SND_FmodDevice::SetObjectReferenceDistance(int id, MT_Scalar referencedistance) const
{
/* not supported by fmod */
}
// give openal the object's position
void SND_FmodDevice::ObjectIs2D(int id) const
{
float obpos[3] = {0,0,0};
float obvel[3] = {0,0,0};
FSOUND_3D_SetAttributes(m_channels[id], obpos, obvel);
}
void SND_FmodDevice::SetObjectTransform(int id,
const MT_Vector3& position,
const MT_Vector3& velocity,
const MT_Matrix3x3& orientation,
const MT_Vector3& lisposition,
const MT_Scalar& rollofffactor) const
{
float obpos[3];
float obvel[3];
obpos[0] = (float)position[0] * (float)rollofffactor; //x (l/r)
obpos[1] = (float)position[1] * (float)rollofffactor;
obpos[2] = (float)position[2] * (float)rollofffactor;
velocity.getValue(obvel);
FSOUND_3D_SetAttributes(m_channels[id], obpos, obvel);
}
// cd support stuff ////////////////////////////////////////////////////////////
void SND_FmodDevice::PlayCD(int track) const
{
#ifndef __APPLE__
signed char result = FSOUND_CD_Play(track);
#else
signed char result = FSOUND_CD_Play(0, track);
#endif
#ifdef ONTKEVER
printf("SND_FmodDevice::PlayCD(): track=%d, result=%d\n", track, (int)result);
#endif
}
void SND_FmodDevice::PauseCD(bool pause) const
{
#ifndef __APPLE__
signed char result = FSOUND_CD_SetPaused(pause);
#else
signed char result = FSOUND_CD_SetPaused(0, pause);
#endif
#ifdef ONTKEVER
printf("SND_FmodDevice::PauseCD(): pause=%d, result=%d\n", pause, (int)result);
#endif
}
void SND_FmodDevice::StopCD() const
{
SND_CDObject* pCD = SND_CDObject::Instance();
if (pCD)
{
if (pCD->GetUsed())
{
#ifndef __APPLE__
signed char result = FSOUND_CD_Stop();
#else
signed char result = FSOUND_CD_Stop(0);
#endif
#ifdef ONTKEVER
printf("SND_FmodDevice::StopCD(): result=%d\n", (int)result);
#endif
}
}
}
void SND_FmodDevice::SetCDPlaymode(int playmode) const
{
#ifndef __APPLE__
FSOUND_CD_SetPlayMode(playmode);
#else
FSOUND_CD_SetPlayMode(0, playmode);
#endif
#ifdef ONTKEVER
printf("SND_FmodDevice::SetCDPlaymode(): playmode=%d,\n", playmode);
#endif
}
void SND_FmodDevice::SetCDGain(MT_Scalar gain) const
{
int volume = gain * 255;
#ifndef __APPLE__
signed char result = FSOUND_CD_SetVolume(volume);
#else
signed char result = FSOUND_CD_SetVolume(0, volume);
#endif
#ifdef ONTKEVER
printf("SND_FmodDevice::SetCDGain(): gain=%f, volume=%d, result=%d\n", gain, volume, (int)result);
#endif
}
void SND_FmodDevice::StartUsingDSP()
{
m_dspunit = FSOUND_DSP_GetFFTUnit();
FSOUND_DSP_SetActive(m_dspunit, true);
}
float* SND_FmodDevice::GetSpectrum()
{
m_spectrum = FSOUND_DSP_GetSpectrum();
return m_spectrum;
}
void SND_FmodDevice::StopUsingDSP()
{
if (m_dspunit)
FSOUND_DSP_SetActive(m_dspunit, false);
}

View File

@@ -1,103 +0,0 @@
/**
* $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 SND_FMODDEVICE
#define SND_FMODDEVICE
#include "fmod.h"
#include "SND_AudioDevice.h"
#include "SoundDefines.h"
class SND_FmodDevice : public SND_AudioDevice
{
public:
SND_FmodDevice();
~SND_FmodDevice();
SND_WaveSlot* LoadSample(const STR_String& samplename,
void* memlocation,
int size);
void InitListener();
void SetListenerGain(float gain) const;
void SetDopplerVelocity(MT_Scalar dopplervelocity) const;
void SetDopplerFactor(MT_Scalar dopplerfactor) const;
void SetListenerRollOffFactor(MT_Scalar rollofffactor) const;
void MakeCurrent() const;
void NextFrame() const;
void UseCD() const;
void SetObjectBuffer(int id, unsigned int buffer);
int GetPlayState(int id);
void PlayObject(int id);
void StopObject(int id) const;
void StopAllObjects();
void PauseObject(int id) const;
void SetObjectLoop(int id, unsigned int loopmode) const;
void SetObjectLoopPoints(int id, unsigned int loopstart, unsigned int loopend) const;
void SetObjectPitch(int id, MT_Scalar pitch) const;
void SetObjectGain(int id, MT_Scalar gain) const;
void SetObjectMinGain(int id, MT_Scalar mingain) const;
void SetObjectMaxGain(int id, MT_Scalar maxgain) const;
void SetObjectRollOffFactor(int id, MT_Scalar rolloff) const;
void SetObjectReferenceDistance(int id, MT_Scalar distance) const;
void SetObjectTransform(int id,
const MT_Vector3& position,
const MT_Vector3& velocity,
const MT_Matrix3x3& orientation,
const MT_Vector3& lisposition,
const MT_Scalar& rollofffactor) const;
void ObjectIs2D(int id) const;
void PlayCD(int track) const;
void PauseCD(bool pause) const;
void StopCD() const;
void SetCDPlaymode(int playmode) const;
void SetCDGain(MT_Scalar gain) const;
void StartUsingDSP();
float* GetSpectrum();
void StopUsingDSP();
private:
FSOUND_SAMPLE* m_buffers[NUM_BUFFERS];
FSOUND_SAMPLE* m_sources[NUM_SOURCES];
FSOUND_DSPUNIT* m_dspunit;
int m_frequencies[NUM_SOURCES];
int m_max_channels;
int m_num_hardware_channels;
int m_num_software_channels;
int m_channels[NUM_SOURCES];
float* m_spectrum;
};
#endif //SND_FMODDEVICE

View File

@@ -43,11 +43,9 @@
#ifdef APPLE_FRAMEWORK_FIX #ifdef APPLE_FRAMEWORK_FIX
#include <al.h> #include <al.h>
#include <alc.h> #include <alc.h>
#include <alut.h>
#else #else
#include <AL/al.h> #include <AL/al.h>
#include <AL/alc.h> #include <AL/alc.h>
#include <AL/alut.h>
#endif #endif
#include <stdio.h> #include <stdio.h>
@@ -61,13 +59,12 @@
#include <signal.h> #include <signal.h>
/* untill openal gets unified we need this hack for non-windows systems */ /*************************** ALUT replacement *****************************/
#if !defined(WIN32) && !defined(ALC_MAJOR_VERSION)
#include <malloc.h> /* instead of relying on alut, we just implement our own
* WAV loading functions, hopefully more reliable */
ALvoid alutLoadWAVMemory(ALbyte *memory,ALenum *format,ALvoid **data,ALsizei *size,ALsizei *freq,ALboolean *loop); #include <stdlib.h>
ALvoid alutUnloadWAV(ALenum format,ALvoid *data,ALsizei size,ALsizei freq);
typedef struct /* WAV File-header */ typedef struct /* WAV File-header */
{ {
@@ -120,93 +117,189 @@ typedef struct /* WAV Chunk-header */
ALuint Size; ALuint Size;
} WAVChunkHdr_Struct; } WAVChunkHdr_Struct;
ALvoid alutLoadWAVMemory(ALbyte *memory,ALenum *format,ALvoid **data,ALsizei *size,ALsizei *freq,ALboolean *loop) static void *SND_loadFileIntoMemory(const char *filename, int *len_r)
{
FILE *fp= fopen(filename, "rb");
void *data;
if (!fp) {
*len_r= -1;
return NULL;
}
fseek(fp, 0L, SEEK_END);
*len_r= ftell(fp);
fseek(fp, 0L, SEEK_SET);
data= malloc(*len_r);
if (!data) {
*len_r= -1;
return NULL;
}
if (fread(data, *len_r, 1, fp)!=1) {
*len_r= -1;
free(data);
return NULL;
}
return data;
}
#define TEST_SWITCH_INT(a) if(big_endian) { \
char s_i, *p_i; \
p_i= (char *)&(a); \
s_i=p_i[0]; p_i[0]=p_i[3]; p_i[3]=s_i; \
s_i=p_i[1]; p_i[1]=p_i[2]; p_i[2]=s_i; }
#define TEST_SWITCH_SHORT(a) if(big_endian) { \
char s_i, *p_i; \
p_i= (char *)&(a); \
s_i=p_i[0]; p_i[0]=p_i[1]; p_i[1]=s_i; }
static int stream_read(void *out, ALbyte **stream, ALsizei size, ALsizei *memsize)
{
if(size <= *memsize) {
memcpy(out, *stream, size);
return 1;
}
else {
memset(out, 0, size);
return 0;
}
}
static int stream_skip(ALbyte **stream, ALsizei size, ALsizei *memsize)
{
if(size <= *memsize) {
*stream += size;
*memsize -= size;
return 1;
}
else
return 0;
}
ALvoid SND_alutLoadWAVMemory(ALbyte *memory,ALsizei memsize,ALenum *format,ALvoid **data,ALsizei *size,ALsizei *freq,ALboolean *loop)
{ {
WAVChunkHdr_Struct ChunkHdr; WAVChunkHdr_Struct ChunkHdr;
WAVFmtExHdr_Struct FmtExHdr; WAVFmtExHdr_Struct FmtExHdr;
WAVFileHdr_Struct FileHdr; WAVFileHdr_Struct FileHdr;
WAVSmplHdr_Struct SmplHdr; WAVSmplHdr_Struct SmplHdr;
WAVFmtHdr_Struct FmtHdr; WAVFmtHdr_Struct FmtHdr;
ALbyte *Stream; ALbyte *Stream= memory;
int test_endian= 1;
int big_endian= !((char*)&test_endian)[0];
*format=AL_FORMAT_MONO16; *format=AL_FORMAT_MONO16;
*data=NULL; *data=NULL;
*size=0; *size=0;
*freq=22050; *freq=22050;
*loop=AL_FALSE; *loop=AL_FALSE;
if (memory)
if(!Stream)
return;
stream_read(&FileHdr,&Stream,sizeof(WAVFileHdr_Struct),&memsize);
stream_skip(&Stream,sizeof(WAVFileHdr_Struct),&memsize);
TEST_SWITCH_INT(FileHdr.Size);
FileHdr.Size=((FileHdr.Size+1)&~1)-4;
while((FileHdr.Size!=0) && stream_read(&ChunkHdr,&Stream,sizeof(WAVChunkHdr_Struct),&memsize))
{ {
Stream=memory; TEST_SWITCH_INT(ChunkHdr.Size);
if (Stream) stream_skip(&Stream,sizeof(WAVChunkHdr_Struct),&memsize);
if (!memcmp(ChunkHdr.Id,"fmt ",4))
{ {
memcpy(&FileHdr,Stream,sizeof(WAVFileHdr_Struct)); stream_read(&FmtHdr,&Stream,sizeof(WAVFmtHdr_Struct),&memsize);
Stream+=sizeof(WAVFileHdr_Struct);
FileHdr.Size=((FileHdr.Size+1)&~1)-4; TEST_SWITCH_SHORT(FmtHdr.Format);
while ((FileHdr.Size!=0)&&(memcpy(&ChunkHdr,Stream,sizeof(WAVChunkHdr_Struct)))) TEST_SWITCH_SHORT(FmtHdr.Channels);
TEST_SWITCH_INT(FmtHdr.SamplesPerSec);
TEST_SWITCH_INT(FmtHdr.BytesPerSec);
TEST_SWITCH_SHORT(FmtHdr.BlockAlign);
TEST_SWITCH_SHORT(FmtHdr.BitsPerSample);
if (FmtHdr.Format==0x0001)
{ {
Stream+=sizeof(WAVChunkHdr_Struct); *format=(FmtHdr.Channels==1?
if (!memcmp(ChunkHdr.Id,"fmt ",4)) (FmtHdr.BitsPerSample==8?AL_FORMAT_MONO8:AL_FORMAT_MONO16):
{ (FmtHdr.BitsPerSample==8?AL_FORMAT_STEREO8:AL_FORMAT_STEREO16));
memcpy(&FmtHdr,Stream,sizeof(WAVFmtHdr_Struct)); *freq=FmtHdr.SamplesPerSec;
if (FmtHdr.Format==0x0001) }
{ else
*format=(FmtHdr.Channels==1? {
(FmtHdr.BitsPerSample==8?AL_FORMAT_MONO8:AL_FORMAT_MONO16): stream_read(&FmtExHdr,&Stream,sizeof(WAVFmtExHdr_Struct),&memsize);
(FmtHdr.BitsPerSample==8?AL_FORMAT_STEREO8:AL_FORMAT_STEREO16)); TEST_SWITCH_SHORT(FmtExHdr.Size);
*freq=FmtHdr.SamplesPerSec; TEST_SWITCH_SHORT(FmtExHdr.SamplesPerBlock);
Stream+=ChunkHdr.Size;
}
else
{
memcpy(&FmtExHdr,Stream,sizeof(WAVFmtExHdr_Struct));
Stream+=ChunkHdr.Size;
}
}
else if (!memcmp(ChunkHdr.Id,"data",4))
{
if (FmtHdr.Format==0x0001)
{
*size=ChunkHdr.Size;
*data=malloc(ChunkHdr.Size+31);
if (*data) memcpy(*data,Stream,ChunkHdr.Size);
memset(((char *)*data)+ChunkHdr.Size,0,31);
Stream+=ChunkHdr.Size;
}
else if (FmtHdr.Format==0x0011)
{
//IMA ADPCM
}
else if (FmtHdr.Format==0x0055)
{
//MP3 WAVE
}
}
else if (!memcmp(ChunkHdr.Id,"smpl",4))
{
memcpy(&SmplHdr,Stream,sizeof(WAVSmplHdr_Struct));
*loop = (SmplHdr.Loops ? AL_TRUE : AL_FALSE);
Stream+=ChunkHdr.Size;
}
else Stream+=ChunkHdr.Size;
Stream+=ChunkHdr.Size&1;
FileHdr.Size-=(((ChunkHdr.Size+1)&~1)+8);
} }
} }
else if (!memcmp(ChunkHdr.Id,"data",4))
{
if (FmtHdr.Format==0x0001)
{
if((ALsizei)ChunkHdr.Size <= memsize)
{
*size=ChunkHdr.Size;
*data=malloc(ChunkHdr.Size+31);
if (*data) {
stream_read(*data,&Stream,ChunkHdr.Size,&memsize);
memset(((char *)*data)+ChunkHdr.Size,0,31);
if(FmtHdr.BitsPerSample == 16 && big_endian) {
int a, len= *size/2;
short *samples= (short*)*data;
for(a=0; a<len; a++) {
TEST_SWITCH_SHORT(samples[a])
}
}
}
}
}
else if (FmtHdr.Format==0x0011)
{
//IMA ADPCM
}
else if (FmtHdr.Format==0x0055)
{
//MP3 WAVE
}
}
else if (!memcmp(ChunkHdr.Id,"smpl",4))
{
stream_read(&SmplHdr,&Stream,sizeof(WAVSmplHdr_Struct),&memsize);
TEST_SWITCH_INT(SmplHdr.Manufacturer);
TEST_SWITCH_INT(SmplHdr.Product);
TEST_SWITCH_INT(SmplHdr.SamplePeriod);
TEST_SWITCH_INT(SmplHdr.Note);
TEST_SWITCH_INT(SmplHdr.FineTune);
TEST_SWITCH_INT(SmplHdr.SMPTEFormat);
TEST_SWITCH_INT(SmplHdr.SMPTEOffest);
TEST_SWITCH_INT(SmplHdr.Loops);
TEST_SWITCH_INT(SmplHdr.SamplerData);
*loop = (SmplHdr.Loops ? AL_TRUE : AL_FALSE);
}
if(!stream_skip(&Stream, ChunkHdr.Size + (ChunkHdr.Size&1), &memsize))
break;
FileHdr.Size-=(((ChunkHdr.Size+1)&~1)+8);
} }
} }
ALvoid alutUnloadWAV(ALenum format,ALvoid *data,ALsizei size,ALsizei freq) ALvoid SND_alutUnloadWAV(ALenum format,ALvoid *data,ALsizei size,ALsizei freq)
{ {
if (data) if (data)
free(data); free(data);
} }
#endif /* WIN32 */ /************************ Device Implementation ****************************/
#ifdef __APPLE__
#define OUDE_OPENAL 1
#endif
SND_OpenALDevice::SND_OpenALDevice() SND_OpenALDevice::SND_OpenALDevice()
: SND_AudioDevice(), : SND_AudioDevice(),
@@ -223,10 +316,6 @@ SND_OpenALDevice::SND_OpenALDevice()
// let's check if we can get openal to initialize... // let's check if we can get openal to initialize...
if (m_audio) if (m_audio)
{ {
#ifdef OUDE_OPENAL
m_audio = true; // openal_2.12
alutInit(NULL, NULL); // openal_2.12
#else
m_audio = false; m_audio = false;
ALCdevice *dev = alcOpenDevice(NULL); ALCdevice *dev = alcOpenDevice(NULL);
@@ -236,7 +325,6 @@ SND_OpenALDevice::SND_OpenALDevice()
if (m_context) { if (m_context) {
#ifdef AL_VERSION_1_1 #ifdef AL_VERSION_1_1
alcMakeContextCurrent((ALCcontext*)m_context); alcMakeContextCurrent((ALCcontext*)m_context);
alutInitWithoutContext(NULL, NULL); /* in this case we dont want alut to initialize the context, see above */
#else #else
alcMakeContextCurrent(m_context); alcMakeContextCurrent(m_context);
#endif #endif
@@ -259,7 +347,6 @@ SND_OpenALDevice::SND_OpenALDevice()
} }
} }
#endif
} }
// then try to generate some buffers // then try to generate some buffers
@@ -283,7 +370,7 @@ SND_OpenALDevice::SND_OpenALDevice()
// next: the sources // next: the sources
if (m_audio) if (m_audio)
{ {
#ifdef OUDE_OPENAL #ifdef __APPLE__
ALenum alc_error = ALC_NO_ERROR; // openal_2.12 ALenum alc_error = ALC_NO_ERROR; // openal_2.12
#elif defined(_WIN32) #elif defined(_WIN32)
// alcGetError has no arguments on windows // alcGetError has no arguments on windows
@@ -375,20 +462,11 @@ SND_OpenALDevice::~SND_OpenALDevice()
if (m_cdrom) if (m_cdrom)
delete m_cdrom; delete m_cdrom;
#endif #endif
#ifdef OUDE_OPENAL
if (m_audio)
alutExit();
#else
if (m_device) if (m_device)
alcCloseDevice((ALCdevice*) m_device); alcCloseDevice((ALCdevice*) m_device);
#ifdef AL_VERSION_1_1
alutExit();
#endif
#endif
} }
SND_WaveSlot* SND_OpenALDevice::LoadSample(const STR_String& name, SND_WaveSlot* SND_OpenALDevice::LoadSample(const STR_String& name,
void* memlocation, void* memlocation,
int size) int size)
@@ -406,23 +484,22 @@ SND_WaveSlot* SND_OpenALDevice::LoadSample(const STR_String& name,
{ {
if (waveslot) if (waveslot)
{ {
bool freemem = false;
int buffer = waveslot->GetBuffer(); int buffer = waveslot->GetBuffer();
void* data = NULL; void* data = NULL;
#ifndef __APPLE__
char loop = 'a'; char loop = 'a';
#endif
int sampleformat, bitrate, numberofchannels; int sampleformat, bitrate, numberofchannels;
ALenum al_error = alGetError(); ALenum al_error = alGetError();
ALsizei samplerate, numberofsamples; // openal_2.14+
#ifdef OUDE_OPENAL
ALsizei samplerate, numberofsamples; // openal_2.12
#else
int samplerate, numberofsamples; // openal_2.14+
#endif
/* Give them some safe defaults just incase */ /* Give them some safe defaults just incase */
bitrate = numberofchannels = 0; bitrate = numberofchannels = 0;
if (!(size && memlocation)) {
memlocation = SND_loadFileIntoMemory(samplename.Ptr(), &size);
freemem = true;
}
/* load the sample from memory? */ /* load the sample from memory? */
if (size && memlocation) if (size && memlocation)
{ {
@@ -437,33 +514,14 @@ SND_WaveSlot* SND_OpenALDevice::LoadSample(const STR_String& name,
bitrate = SND_GetBitRate(memlocation); bitrate = SND_GetBitRate(memlocation);
/* load the sample into openal */ /* load the sample into openal */
#if defined(OUDE_OPENAL) || defined (__APPLE__) SND_alutLoadWAVMemory((ALbyte*)memlocation, size, &sampleformat, &data, &numberofsamples, &samplerate, &loop);
alutLoadWAVMemory((char*)memlocation, &sampleformat, &data, &numberofsamples, &samplerate); // openal_2.12
#else
#ifdef AL_VERSION_1_1
float frequency = 0.0f;
data = alutLoadMemoryFromFileImage(memlocation, size, &sampleformat, &numberofsamples, &frequency);
samplerate = (int)frequency;
#else
alutLoadWAVMemory((signed char*)memlocation, &sampleformat, &data, &numberofsamples, &samplerate, &loop);// openal_2.14+
#endif
#endif
/* put it in the buffer */
alBufferData(m_buffers[buffer], sampleformat, data, numberofsamples, samplerate);
}
/* or from file? */
else
{
#ifdef __APPLE__
alutLoadWAVFile((ALbyte *)samplename.Ptr(), &sampleformat, &data, &numberofsamples, &samplerate);
#else
alutLoadWAVFile((ALbyte *)samplename.Ptr(), &sampleformat, &data, &numberofsamples, &samplerate, &loop);
#endif
/* put it in the buffer */ /* put it in the buffer */
alBufferData(m_buffers[buffer], sampleformat, data, numberofsamples, samplerate); alBufferData(m_buffers[buffer], sampleformat, data, numberofsamples, samplerate);
} }
if(freemem)
free(memlocation);
/* fill the waveslot with info */ /* fill the waveslot with info */
al_error = alGetError(); al_error = alGetError();
if (al_error == AL_NO_ERROR && m_buffers[buffer]) if (al_error == AL_NO_ERROR && m_buffers[buffer])
@@ -486,11 +544,7 @@ SND_WaveSlot* SND_OpenALDevice::LoadSample(const STR_String& name,
} }
/* and free the original stuff (copy was made in openal) */ /* and free the original stuff (copy was made in openal) */
#if defined(OUDE_OPENAL) || defined (__APPLE__) || !defined(AL_VERSION_1_1) SND_alutUnloadWAV(sampleformat, data, numberofsamples, samplerate);
alutUnloadWAV(sampleformat, data, numberofsamples, samplerate);
#else
free(data);
#endif
} }
} }
else else
@@ -594,7 +648,7 @@ int SND_OpenALDevice::GetPlayState(int id)
#ifdef __APPLE__ #ifdef __APPLE__
alGetSourcei(m_sources[id], AL_SOURCE_STATE, &alstate); alGetSourcei(m_sources[id], AL_SOURCE_STATE, &alstate);
#else #else
alGetSourceiv(m_sources[id], AL_SOURCE_STATE, &alstate); alGetSourceiv(m_sources[id], AL_SOURCE_STATE, &alstate);
#endif #endif
switch(alstate) switch(alstate)

View File

@@ -43,6 +43,8 @@
#ifndef DISABLE_SDL #ifndef DISABLE_SDL
#include <SDL.h> #include <SDL.h>
#else
#include <stdio.h>
#endif #endif
SND_SDLCDDevice::SND_SDLCDDevice() : SND_SDLCDDevice::SND_SDLCDDevice() :

View File

@@ -34,7 +34,6 @@
* @date May 7, 2001 * @date May 7, 2001
*/ */
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#include <ApplicationServices/ApplicationServices.h> #include <ApplicationServices/ApplicationServices.h>
#include "GHOST_SystemCarbon.h" #include "GHOST_SystemCarbon.h"
@@ -430,6 +429,29 @@ GHOST_IWindow* GHOST_SystemCarbon::createWindow(
return window; return window;
} }
GHOST_TSuccess GHOST_SystemCarbon::beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window, const bool stereoVisual)
{
GHOST_TSuccess success = GHOST_kFailure;
// need yo make this Carbon all on 10.5 for fullscreen to work correctly
CGCaptureAllDisplays();
success = GHOST_System::beginFullScreen( setting, window, stereoVisual);
if( success != GHOST_kSuccess ) {
// fullscreen failed for other reasons, release
CGReleaseAllDisplays();
}
return success;
}
GHOST_TSuccess GHOST_SystemCarbon::endFullScreen(void)
{
CGReleaseAllDisplays();
return GHOST_System::endFullScreen();
}
/* this is an old style low level event queue. /* this is an old style low level event queue.
As we want to handle our own timers, this is ok. As we want to handle our own timers, this is ok.
the full screen hack should be removed */ the full screen hack should be removed */

View File

@@ -118,6 +118,14 @@ public:
const GHOST_TEmbedderWindowID parentWindow = 0 const GHOST_TEmbedderWindowID parentWindow = 0
); );
virtual GHOST_TSuccess beginFullScreen(
const GHOST_DisplaySetting& setting,
GHOST_IWindow** window,
const bool stereoVisual
);
virtual GHOST_TSuccess endFullScreen( void );
/*************************************************************************************** /***************************************************************************************
** Event management functionality ** Event management functionality
***************************************************************************************/ ***************************************************************************************/

View File

@@ -117,16 +117,18 @@ GHOST_WindowWin32::GHOST_WindowWin32(
m_maxPressure(0) m_maxPressure(0)
{ {
if (state != GHOST_kWindowStateFullScreen) { if (state != GHOST_kWindowStateFullScreen) {
/* Convert client size into window size */ // take taskbar into account
width += GetSystemMetrics(SM_CXSIZEFRAME)*2; RECT rect;
height += GetSystemMetrics(SM_CYSIZEFRAME)*2 + GetSystemMetrics(SM_CYCAPTION); SystemParametersInfo(SPI_GETWORKAREA,0,&rect,0);
height = rect.bottom - rect.top;
width = rect.right - rect.left;
m_hWnd = ::CreateWindow( m_hWnd = ::CreateWindow(
s_windowClassName, // pointer to registered class name s_windowClassName, // pointer to registered class name
title, // pointer to window name title, // pointer to window name
WS_OVERLAPPEDWINDOW, // window style WS_OVERLAPPEDWINDOW, // window style
left, // horizontal position of window rect.left, // horizontal position of window
top, // vertical position of window rect.top, // vertical position of window
width, // window width width, // window width
height, // window height height, // window height
0, // handle to parent or owner window 0, // handle to parent or owner window
@@ -239,7 +241,7 @@ GHOST_WindowWin32::~GHOST_WindowWin32()
if (m_wintab) { if (m_wintab) {
GHOST_WIN32_WTClose fpWTClose = ( GHOST_WIN32_WTClose ) ::GetProcAddress( m_wintab, "WTClose" ); GHOST_WIN32_WTClose fpWTClose = ( GHOST_WIN32_WTClose ) ::GetProcAddress( m_wintab, "WTClose" );
if (fpWTClose) { if (fpWTClose) {
if (m_tablet) if (m_tablet)
fpWTClose(m_tablet); fpWTClose(m_tablet);
if (m_tabletData) if (m_tabletData)
delete m_tabletData; delete m_tabletData;
@@ -297,15 +299,17 @@ void GHOST_WindowWin32::getWindowBounds(GHOST_Rect& bounds) const
void GHOST_WindowWin32::getClientBounds(GHOST_Rect& bounds) const void GHOST_WindowWin32::getClientBounds(GHOST_Rect& bounds) const
{ {
RECT rect; RECT rect;
::GetWindowRect(m_hWnd, &rect);
LONG_PTR result = ::GetWindowLongPtr(m_hWnd, GWL_STYLE); LONG_PTR result = ::GetWindowLongPtr(m_hWnd, GWL_STYLE);
::GetWindowRect(m_hWnd, &rect);
if((result & (WS_POPUP | WS_MAXIMIZE)) != (WS_POPUP | WS_MAXIMIZE)) { if((result & (WS_POPUP | WS_MAXIMIZE)) != (WS_POPUP | WS_MAXIMIZE)) {
bounds.m_b = rect.bottom-GetSystemMetrics(SM_CYCAPTION)-GetSystemMetrics(SM_CYSIZEFRAME)*2; bounds.m_b = rect.bottom-GetSystemMetrics(SM_CYCAPTION)-GetSystemMetrics(SM_CYSIZEFRAME)*2;
bounds.m_l = rect.left; bounds.m_l = rect.left;
bounds.m_r = rect.right-GetSystemMetrics(SM_CYSIZEFRAME)*2; bounds.m_r = rect.right-GetSystemMetrics(SM_CYSIZEFRAME)*2;
bounds.m_t = rect.top; bounds.m_t = rect.top;
} else { } else {
::GetWindowRect(m_hWnd, &rect);
bounds.m_b = rect.bottom; bounds.m_b = rect.bottom;
bounds.m_l = rect.left; bounds.m_l = rect.left;
bounds.m_r = rect.right; bounds.m_r = rect.right;
@@ -415,12 +419,12 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state)
wp.length = sizeof(WINDOWPLACEMENT); wp.length = sizeof(WINDOWPLACEMENT);
::GetWindowPlacement(m_hWnd, &wp); ::GetWindowPlacement(m_hWnd, &wp);
switch (state) { switch (state) {
case GHOST_kWindowStateMinimized: case GHOST_kWindowStateMinimized:
wp.showCmd = SW_SHOWMINIMIZED; wp.showCmd = SW_SHOWMINIMIZED;
break; break;
case GHOST_kWindowStateMaximized: case GHOST_kWindowStateMaximized:
ShowWindow(m_hWnd, SW_HIDE); ShowWindow(m_hWnd, SW_HIDE);
wp.showCmd = SW_SHOWMAXIMIZED; wp.showCmd = SW_SHOWMAXIMIZED;
SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW); SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW);
break; break;
case GHOST_kWindowStateFullScreen: case GHOST_kWindowStateFullScreen:
@@ -429,10 +433,10 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state)
wp.ptMaxPosition.y = 0; wp.ptMaxPosition.y = 0;
SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_POPUP | WS_MAXIMIZE); SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_POPUP | WS_MAXIMIZE);
break; break;
case GHOST_kWindowStateNormal: case GHOST_kWindowStateNormal:
default: default:
ShowWindow(m_hWnd, SW_HIDE); ShowWindow(m_hWnd, SW_HIDE);
wp.showCmd = SW_SHOWNORMAL; wp.showCmd = SW_SHOWNORMAL;
SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW); SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW);
break; break;
} }
@@ -490,7 +494,7 @@ GHOST_TSuccess GHOST_WindowWin32::installDrawingContext(GHOST_TDrawingContextTyp
switch (type) { switch (type) {
case GHOST_kDrawingContextTypeOpenGL: case GHOST_kDrawingContextTypeOpenGL:
{ {
if(m_stereoVisual) if(m_stereoVisual)
sPreferredFormat.dwFlags |= PFD_STEREO; sPreferredFormat.dwFlags |= PFD_STEREO;
// Attempt to match device context pixel format to the preferred format // Attempt to match device context pixel format to the preferred format
@@ -627,7 +631,7 @@ void GHOST_WindowWin32::loadCursor(bool visible, GHOST_TStandardCursor cursor) c
default: default:
success = false; success = false;
} }
if (success) { if (success) {
::SetCursor(::LoadCursor(0, id)); ::SetCursor(::LoadCursor(0, id));
} }
@@ -660,7 +664,7 @@ void GHOST_WindowWin32::processWin32TabletInitEvent()
{ {
if (m_wintab) { if (m_wintab) {
GHOST_WIN32_WTInfo fpWTInfo = ( GHOST_WIN32_WTInfo ) ::GetProcAddress( m_wintab, "WTInfoA" ); GHOST_WIN32_WTInfo fpWTInfo = ( GHOST_WIN32_WTInfo ) ::GetProcAddress( m_wintab, "WTInfoA" );
// let's see if we can initialize tablet here // let's see if we can initialize tablet here
/* check if WinTab available. */ /* check if WinTab available. */
if (fpWTInfo) { if (fpWTInfo) {
@@ -671,7 +675,7 @@ void GHOST_WindowWin32::processWin32TabletInitEvent()
m_maxPressure = Pressure.axMax; m_maxPressure = Pressure.axMax;
else else
m_maxPressure = 0; m_maxPressure = 0;
BOOL tiltSupport = fpWTInfo (WTI_DEVICES, DVC_ORIENTATION, &Orientation); BOOL tiltSupport = fpWTInfo (WTI_DEVICES, DVC_ORIENTATION, &Orientation);
if (tiltSupport) { if (tiltSupport) {
/* does the tablet support azimuth ([0]) and altitude ([1]) */ /* does the tablet support azimuth ([0]) and altitude ([1]) */
@@ -737,7 +741,7 @@ void GHOST_WindowWin32::processWin32TabletEvent(WPARAM wParam, LPARAM lParam)
WACOM uses negative altitude values to show that the pen is inverted; WACOM uses negative altitude values to show that the pen is inverted;
therefore we cast .orAltitude as an (int) and then use the absolute value. therefore we cast .orAltitude as an (int) and then use the absolute value.
*/ */
/* convert raw fixed point data to radians */ /* convert raw fixed point data to radians */
altRad = (float)((fabs((float)ort.orAltitude)/(float)m_maxAltitude) * M_PI/2.0); altRad = (float)((fabs((float)ort.orAltitude)/(float)m_maxAltitude) * M_PI/2.0);
azmRad = (float)(((float)ort.orAzimuth/(float)m_maxAzimuth) * M_PI*2.0); azmRad = (float)(((float)ort.orAzimuth/(float)m_maxAzimuth) * M_PI*2.0);
@@ -777,25 +781,25 @@ static GHOST_TUns16 uns16ReverseBits(GHOST_TUns16 shrt)
shrt= ((shrt>>8)&0x00FF) | ((shrt<<8)&0xFF00); shrt= ((shrt>>8)&0x00FF) | ((shrt<<8)&0xFF00);
return shrt; return shrt;
} }
GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
GHOST_TUns8 mask[16][2], int hotX, int hotY) GHOST_TUns8 mask[16][2], int hotX, int hotY)
{ {
return setWindowCustomCursorShape((GHOST_TUns8*)bitmap, (GHOST_TUns8*)mask, return setWindowCustomCursorShape((GHOST_TUns8*)bitmap, (GHOST_TUns8*)mask,
16, 16, hotX, hotY, 0, 1); 16, 16, hotX, hotY, 0, 1);
} }
GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask, int sizeX, int sizeY, int hotX, int hotY, GHOST_TUns8 *mask, int sizeX, int sizeY, int hotX, int hotY,
int fg_color, int bg_color) int fg_color, int bg_color)
{ {
GHOST_TUns32 andData[32]; GHOST_TUns32 andData[32];
GHOST_TUns32 xorData[32]; GHOST_TUns32 xorData[32];
GHOST_TUns32 fullBitRow, fullMaskRow; GHOST_TUns32 fullBitRow, fullMaskRow;
int x, y, cols; int x, y, cols;
cols=sizeX/8; /* Num of whole bytes per row (width of bm/mask) */ cols=sizeX/8; /* Num of whole bytes per row (width of bm/mask) */
if (sizeX%8) cols++; if (sizeX%8) cols++;
if (m_customCursor) { if (m_customCursor) {
DestroyCursor(m_customCursor); DestroyCursor(m_customCursor);
m_customCursor = NULL; m_customCursor = NULL;
@@ -835,9 +839,9 @@ GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(GHOST_TUns8 *bitmap
static int WeightPixelFormat(PIXELFORMATDESCRIPTOR& pfd) { static int WeightPixelFormat(PIXELFORMATDESCRIPTOR& pfd) {
int weight = 0; int weight = 0;
/* assume desktop color depth is 32 bits per pixel */ /* assume desktop color depth is 32 bits per pixel */
/* cull unusable pixel formats */ /* cull unusable pixel formats */
/* if no formats can be found, can we determine why it was rejected? */ /* if no formats can be found, can we determine why it was rejected? */
if( !(pfd.dwFlags & PFD_SUPPORT_OPENGL) || if( !(pfd.dwFlags & PFD_SUPPORT_OPENGL) ||
@@ -846,45 +850,45 @@ static int WeightPixelFormat(PIXELFORMATDESCRIPTOR& pfd) {
( pfd.cDepthBits <= 8 ) || ( pfd.cDepthBits <= 8 ) ||
!(pfd.iPixelType == PFD_TYPE_RGBA) ) !(pfd.iPixelType == PFD_TYPE_RGBA) )
return 0; return 0;
weight = 1; /* it's usable */ weight = 1; /* it's usable */
/* the bigger the depth buffer the better */ /* the bigger the depth buffer the better */
/* give no weight to a 16-bit depth buffer, because those are crap */ /* give no weight to a 16-bit depth buffer, because those are crap */
weight += pfd.cDepthBits - 16; weight += pfd.cDepthBits - 16;
weight += pfd.cColorBits - 8; weight += pfd.cColorBits - 8;
/* want swap copy capability -- it matters a lot */ /* want swap copy capability -- it matters a lot */
if(pfd.dwFlags & PFD_SWAP_COPY) weight += 16; if(pfd.dwFlags & PFD_SWAP_COPY) weight += 16;
/* but if it's a generic (not accelerated) view, it's really bad */ /* but if it's a generic (not accelerated) view, it's really bad */
if(pfd.dwFlags & PFD_GENERIC_FORMAT) weight /= 10; if(pfd.dwFlags & PFD_GENERIC_FORMAT) weight /= 10;
return weight; return weight;
} }
/* A modification of Ron Fosner's replacement for ChoosePixelFormat */ /* A modification of Ron Fosner's replacement for ChoosePixelFormat */
/* returns 0 on error, else returns the pixel format number to be used */ /* returns 0 on error, else returns the pixel format number to be used */
static int EnumPixelFormats(HDC hdc) { static int EnumPixelFormats(HDC hdc) {
int iPixelFormat; int iPixelFormat;
int i, n, w, weight = 0; int i, n, w, weight = 0;
PIXELFORMATDESCRIPTOR pfd; PIXELFORMATDESCRIPTOR pfd;
/* we need a device context to do anything */ /* we need a device context to do anything */
if(!hdc) return 0; if(!hdc) return 0;
iPixelFormat = 1; /* careful! PFD numbers are 1 based, not zero based */ iPixelFormat = 1; /* careful! PFD numbers are 1 based, not zero based */
/* obtain detailed information about /* obtain detailed information about
the device context's first pixel format */ the device context's first pixel format */
n = 1+::DescribePixelFormat(hdc, iPixelFormat, n = 1+::DescribePixelFormat(hdc, iPixelFormat,
sizeof(PIXELFORMATDESCRIPTOR), &pfd); sizeof(PIXELFORMATDESCRIPTOR), &pfd);
/* choose a pixel format using the useless Windows function in case /* choose a pixel format using the useless Windows function in case
we come up empty handed */ we come up empty handed */
iPixelFormat = ::ChoosePixelFormat( hdc, &sPreferredFormat ); iPixelFormat = ::ChoosePixelFormat( hdc, &sPreferredFormat );
if(!iPixelFormat) return 0; /* couldn't find one to use */ if(!iPixelFormat) return 0; /* couldn't find one to use */
for(i=1; i<=n; i++) { /* not the idiom, but it's right */ for(i=1; i<=n; i++) { /* not the idiom, but it's right */
@@ -899,7 +903,7 @@ static int EnumPixelFormats(HDC hdc) {
} }
} }
if (weight == 0) { if (weight == 0) {
// we could find the correct stereo setting, just find any suitable format // we could find the correct stereo setting, just find any suitable format
for(i=1; i<=n; i++) { /* not the idiom, but it's right */ for(i=1; i<=n; i++) { /* not the idiom, but it's right */
::DescribePixelFormat( hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd ); ::DescribePixelFormat( hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd );
w = WeightPixelFormat(pfd); w = WeightPixelFormat(pfd);

View File

@@ -162,6 +162,7 @@ intptr_t munmap(void *ptr, intptr_t size)
CloseHandle( mm->maphandle ); CloseHandle( mm->maphandle );
CloseHandle( mm->fhandle); CloseHandle( mm->fhandle);
mmap_remlink(mmapbase, mm); mmap_remlink(mmapbase, mm);
free(mm);
return 0; return 0;
} }

View File

@@ -479,10 +479,6 @@
RelativePath="..\..\..\source\gameengine\Converter\BL_ActionActuator.cpp" RelativePath="..\..\..\source\gameengine\Converter\BL_ActionActuator.cpp"
> >
</File> </File>
<File
RelativePath="..\..\..\source\gameengine\Converter\BL_ArmatureObject.cpp"
>
</File>
<File <File
RelativePath="..\..\..\source\gameengine\Converter\BL_BlenderDataConversion.cpp" RelativePath="..\..\..\source\gameengine\Converter\BL_BlenderDataConversion.cpp"
> >
@@ -495,6 +491,10 @@
RelativePath="..\..\..\source\gameengine\Converter\BL_MeshDeformer.cpp" RelativePath="..\..\..\source\gameengine\Converter\BL_MeshDeformer.cpp"
> >
</File> </File>
<File
RelativePath="..\..\..\source\gameengine\Converter\BL_ModifierDeformer.cpp"
>
</File>
<File <File
RelativePath="..\..\..\source\gameengine\Converter\BL_ShapeActionActuator.cpp" RelativePath="..\..\..\source\gameengine\Converter\BL_ShapeActionActuator.cpp"
> >
@@ -552,6 +552,10 @@
RelativePath="..\..\..\source\gameengine\Converter\BL_ActionActuator.h" RelativePath="..\..\..\source\gameengine\Converter\BL_ActionActuator.h"
> >
</File> </File>
<File
RelativePath="..\..\..\source\gameengine\Converter\BL_ArmatureObject.cpp"
>
</File>
<File <File
RelativePath="..\..\..\source\gameengine\Converter\BL_ArmatureObject.h" RelativePath="..\..\..\source\gameengine\Converter\BL_ArmatureObject.h"
> >
@@ -568,6 +572,10 @@
RelativePath="..\..\..\source\gameengine\Converter\BL_MeshDeformer.h" RelativePath="..\..\..\source\gameengine\Converter\BL_MeshDeformer.h"
> >
</File> </File>
<File
RelativePath="..\..\..\source\gameengine\Converter\BL_ModifierDeformer.h"
>
</File>
<File <File
RelativePath="..\..\..\source\gameengine\Converter\BL_ShapeActionActuator.h" RelativePath="..\..\..\source\gameengine\Converter\BL_ShapeActionActuator.h"
> >

View File

@@ -4,6 +4,7 @@
Version="9,00" Version="9,00"
Name="EXP_expressions" Name="EXP_expressions"
ProjectGUID="{EADC3C5A-6C51-4F03-8038-1553E7D7F740}" ProjectGUID="{EADC3C5A-6C51-4F03-8038-1553E7D7F740}"
RootNamespace="EXP_expressions"
TargetFrameworkVersion="131072" TargetFrameworkVersion="131072"
> >
<Platforms> <Platforms>
@@ -42,7 +43,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\blender\makesdna" AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\blender\makesdna;..\..\..\source\gameengine\SceneGraph"
PreprocessorDefinitions="WIN32;_LIB;EXP_PYTHON_EMBEDDING;_DEBUG" PreprocessorDefinitions="WIN32;_LIB;EXP_PYTHON_EMBEDDING;_DEBUG"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
@@ -117,7 +118,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\blender\makesdna" AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\blender\makesdna;..\..\..\source\gameengine\SceneGraph"
PreprocessorDefinitions="WIN32,_LIB,EXP_PYTHON_EMBEDDING,_DEBUG" PreprocessorDefinitions="WIN32,_LIB,EXP_PYTHON_EMBEDDING,_DEBUG"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@@ -192,7 +193,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\blender\makesdna" AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\blender\makesdna;..\..\..\source\gameengine\SceneGraph"
PreprocessorDefinitions="NDEBUG,WIN32,_LIB,EXP_PYTHON_EMBEDDING" PreprocessorDefinitions="NDEBUG,WIN32,_LIB,EXP_PYTHON_EMBEDDING"
StringPooling="true" StringPooling="true"
RuntimeLibrary="2" RuntimeLibrary="2"
@@ -267,7 +268,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\blender\makesdna" AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\blender\makesdna;..\..\..\source\gameengine\SceneGraph"
PreprocessorDefinitions="NDEBUG,WIN32,_LIB,EXP_PYTHON_EMBEDDING" PreprocessorDefinitions="NDEBUG,WIN32,_LIB,EXP_PYTHON_EMBEDDING"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"
@@ -342,7 +343,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\blender\makesdna" AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\blender\makesdna;..\..\..\source\gameengine\SceneGraph"
PreprocessorDefinitions="WIN32;_LIB;EXP_PYTHON_EMBEDDING;_DEBUG" PreprocessorDefinitions="WIN32;_LIB;EXP_PYTHON_EMBEDDING;_DEBUG"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
@@ -417,7 +418,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\blender\makesdna" AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\blender\makesdna;..\..\..\source\gameengine\SceneGraph"
PreprocessorDefinitions="NDEBUG,WIN32,_LIB,EXP_PYTHON_EMBEDDING" PreprocessorDefinitions="NDEBUG,WIN32,_LIB,EXP_PYTHON_EMBEDDING"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"

View File

@@ -4,6 +4,7 @@
Version="9,00" Version="9,00"
Name="SCA_GameLogic" Name="SCA_GameLogic"
ProjectGUID="{32CC75E2-EE85-45E6-8E3D-513F58464F43}" ProjectGUID="{32CC75E2-EE85-45E6-8E3D-513F58464F43}"
RootNamespace="SCA_GameLogic"
TargetFrameworkVersion="131072" TargetFrameworkVersion="131072"
> >
<Platforms> <Platforms>
@@ -42,7 +43,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\lib\windows\sdl\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\Rasterizer;..\..\..\source\blender\makesdna" AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\lib\windows\sdl\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\Rasterizer;..\..\..\source\blender\makesdna;..\..\..\source\gameengine\Scenegraph"
PreprocessorDefinitions="WIN32;_LIB;EXP_PYTHON_EMBEDDING;_DEBUG" PreprocessorDefinitions="WIN32;_LIB;EXP_PYTHON_EMBEDDING;_DEBUG"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
@@ -117,7 +118,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\lib\windows\sdl\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\Rasterizer;..\..\..\source\blender\makesdna" AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\lib\windows\sdl\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\Rasterizer;..\..\..\source\blender\makesdna;..\..\..\source\gameengine\Scenegraph"
PreprocessorDefinitions="NDEBUG,WIN32,_LIB,EXP_PYTHON_EMBEDDING" PreprocessorDefinitions="NDEBUG,WIN32,_LIB,EXP_PYTHON_EMBEDDING"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"
@@ -192,7 +193,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\lib\windows\sdl\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\Rasterizer;..\..\..\source\blender\makesdna" AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\lib\windows\sdl\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\Rasterizer;..\..\..\source\blender\makesdna;..\..\..\source\gameengine\Scenegraph"
PreprocessorDefinitions="NDEBUG,WIN32,_LIB,EXP_PYTHON_EMBEDDING" PreprocessorDefinitions="NDEBUG,WIN32,_LIB,EXP_PYTHON_EMBEDDING"
StringPooling="true" StringPooling="true"
RuntimeLibrary="2" RuntimeLibrary="2"
@@ -267,7 +268,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\lib\windows\sdl\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\Rasterizer;..\..\..\source\blender\makesdna" AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\lib\windows\sdl\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\Rasterizer;..\..\..\source\blender\makesdna;..\..\..\source\gameengine\Scenegraph"
PreprocessorDefinitions="WIN32,_LIB,EXP_PYTHON_EMBEDDING,_DEBUG" PreprocessorDefinitions="WIN32,_LIB,EXP_PYTHON_EMBEDDING,_DEBUG"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@@ -342,7 +343,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\lib\windows\sdl\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\Rasterizer;..\..\..\source\blender\makesdna" AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\lib\windows\sdl\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\Rasterizer;..\..\..\source\blender\makesdna;..\..\..\source\gameengine\Scenegraph"
PreprocessorDefinitions="WIN32;_LIB;EXP_PYTHON_EMBEDDING;_DEBUG" PreprocessorDefinitions="WIN32;_LIB;EXP_PYTHON_EMBEDDING;_DEBUG"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
@@ -417,7 +418,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\lib\windows\sdl\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\Rasterizer;..\..\..\source\blender\makesdna" AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\lib\windows\sdl\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\Rasterizer;..\..\..\source\blender\makesdna;..\..\..\source\gameengine\Scenegraph"
PreprocessorDefinitions="NDEBUG,WIN32,_LIB,EXP_PYTHON_EMBEDDING" PreprocessorDefinitions="NDEBUG,WIN32,_LIB,EXP_PYTHON_EMBEDDING"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"

View File

@@ -166,12 +166,13 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386" AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odelib.lib fmodvc.lib ws2_32.lib vfw32.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib openal_static.lib libjpeg.lib dxguid.lib libeay32.lib libpng.lib libz.lib qtmlClient.lib SDL.lib freetype2ST.lib python25.lib pthreadVSE2.lib pthreadVC2.lib Half.lib Iex.lib IlmImf.lib IlmThread.lib Imath.lib avcodec-52.lib avformat-52.lib avutil-50.lib swscale-0.lib avdevice-52.lib" AdditionalDependencies="odelib.lib ws2_32.lib vfw32.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib openal_static.lib libjpeg.lib dxguid.lib libeay32.lib libpng.lib libz.lib qtmlClient.lib SDL.lib freetype2ST.lib python25.lib pthreadVSE2.lib pthreadVC2.lib Half.lib Iex.lib IlmImf.lib IlmThread.lib Imath.lib avcodec-52.lib avformat-52.lib avutil-50.lib swscale-0.lib avdevice-52.lib"
OutputFile="..\..\..\..\bin\blenderplayer.exe" OutputFile="..\..\..\..\bin\blenderplayer.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\..\..\..\lib\windows\sdl\lib;..\..\..\..\..\lib\windows\zlib\lib;..\..\..\..\..\lib\windows\ode\lib;..\..\..\..\..\lib\windows\png\lib;..\..\..\..\..\lib\windows\jpeg\lib;..\..\..\..\..\lib\windows\fmod\lib;..\..\..\..\..\lib\windows\openal\lib;..\..\..\..\..\lib\windows\freetype\lib;..\..\..\..\..\lib\windows\openexr\lib_vs2008;..\..\..\..\..\lib\windows\python\lib\lib25_vs2008;..\..\..\..\..\lib\windows\openssl\lib;..\..\..\..\..\lib\windows\QTDevWin\Libraries;..\..\..\..\..\lib\windows\pthreads\lib;..\..\..\..\..\lib\windows\ffmpeg\lib" AdditionalLibraryDirectories="..\..\..\..\..\lib\windows\sdl\lib;..\..\..\..\..\lib\windows\zlib\lib;..\..\..\..\..\lib\windows\ode\lib;..\..\..\..\..\lib\windows\png\lib;..\..\..\..\..\lib\windows\jpeg\lib;..\..\..\..\..\lib\windows\fmod\lib;..\..\..\..\..\lib\windows\openal\lib;..\..\..\..\..\lib\windows\freetype\lib;..\..\..\..\..\lib\windows\openexr\lib_vs2008;..\..\..\..\..\lib\windows\python\lib\lib25_vs2008;..\..\..\..\..\lib\windows\openssl\lib;..\..\..\..\..\lib\windows\QTDevWin\Libraries;..\..\..\..\..\lib\windows\pthreads\lib;..\..\..\..\..\lib\windows\ffmpeg\lib"
IgnoreDefaultLibraryNames="libc.lib, msvcrt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib" IgnoreDefaultLibraryNames="libc.lib, msvcrt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib"
GenerateDebugInformation="true"
ProgramDatabaseFile="..\..\..\..\..\build\msvc_9\libs\blenderplayer.pdb" ProgramDatabaseFile="..\..\..\..\..\build\msvc_9\libs\blenderplayer.pdb"
SubSystem="1" SubSystem="1"
RandomizedBaseAddress="1" RandomizedBaseAddress="1"

View File

@@ -581,6 +581,10 @@
RelativePath="..\..\..\source\gameengine\Ketsji\KX_PythonInitTypes.cpp" RelativePath="..\..\..\source\gameengine\Ketsji\KX_PythonInitTypes.cpp"
> >
</File> </File>
<File
RelativePath="..\..\..\source\gameengine\Ketsji\KX_PythonSeq.cpp"
>
</File>
<File <File
RelativePath="..\..\..\source\gameengine\Ketsji\KX_RayCast.cpp" RelativePath="..\..\..\source\gameengine\Ketsji\KX_RayCast.cpp"
> >
@@ -890,6 +894,10 @@
RelativePath="..\..\..\source\gameengine\Ketsji\KX_PythonInitTypes.h" RelativePath="..\..\..\source\gameengine\Ketsji\KX_PythonInitTypes.h"
> >
</File> </File>
<File
RelativePath="..\..\..\source\gameengine\Ketsji\KX_PythonSeq.h"
>
</File>
<File <File
RelativePath="..\..\..\source\gameengine\Ketsji\KX_RayCast.h" RelativePath="..\..\..\source\gameengine\Ketsji\KX_RayCast.h"
> >

View File

@@ -4,6 +4,7 @@
Version="9,00" Version="9,00"
Name="KX_network" Name="KX_network"
ProjectGUID="{6E24BF09-9653-4166-A871-F65CC9E98A9B}" ProjectGUID="{6E24BF09-9653-4166-A871-F65CC9E98A9B}"
RootNamespace="KX_network"
TargetFrameworkVersion="131072" TargetFrameworkVersion="131072"
> >
<Platforms> <Platforms>
@@ -42,7 +43,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\ketsji;..\..\..\..\source\gameengine\Network;..\..\..\..\source\gameengine\expressions;..\..\..\..\source\gameengine\GameLogic" AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\ketsji;..\..\..\..\source\gameengine\Network;..\..\..\..\source\gameengine\expressions;..\..\..\..\source\gameengine\GameLogic;..\..\..\..\source\gameengine\Scenegraph"
PreprocessorDefinitions="NDEBUG,WIN32,_LIB" PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"
@@ -117,7 +118,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\ketsji;..\..\..\..\source\gameengine\Network;..\..\..\..\source\gameengine\expressions;..\..\..\..\source\gameengine\GameLogic" AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\ketsji;..\..\..\..\source\gameengine\Network;..\..\..\..\source\gameengine\expressions;..\..\..\..\source\gameengine\GameLogic;..\..\..\..\source\gameengine\Scenegraph"
PreprocessorDefinitions="WIN32,_LIB,_DEBUG" PreprocessorDefinitions="WIN32,_LIB,_DEBUG"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
@@ -192,7 +193,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\ketsji;..\..\..\..\source\gameengine\Network;..\..\..\..\source\gameengine\expressions;..\..\..\..\source\gameengine\GameLogic" AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\ketsji;..\..\..\..\source\gameengine\Network;..\..\..\..\source\gameengine\expressions;..\..\..\..\source\gameengine\GameLogic;..\..\..\..\source\gameengine\Scenegraph"
PreprocessorDefinitions="NDEBUG,WIN32,_LIB" PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
StringPooling="true" StringPooling="true"
RuntimeLibrary="2" RuntimeLibrary="2"
@@ -267,7 +268,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\ketsji;..\..\..\..\source\gameengine\Network;..\..\..\..\source\gameengine\expressions;..\..\..\..\source\gameengine\GameLogic" AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\ketsji;..\..\..\..\source\gameengine\Network;..\..\..\..\source\gameengine\expressions;..\..\..\..\source\gameengine\GameLogic;..\..\..\..\source\gameengine\Scenegraph"
PreprocessorDefinitions="WIN32,_LIB,_DEBUG" PreprocessorDefinitions="WIN32,_LIB,_DEBUG"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@@ -342,7 +343,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\ketsji;..\..\..\..\source\gameengine\Network;..\..\..\..\source\gameengine\expressions;..\..\..\..\source\gameengine\GameLogic" AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\ketsji;..\..\..\..\source\gameengine\Network;..\..\..\..\source\gameengine\expressions;..\..\..\..\source\gameengine\GameLogic;..\..\..\..\source\gameengine\Scenegraph"
PreprocessorDefinitions="WIN32,_LIB,_DEBUG" PreprocessorDefinitions="WIN32,_LIB,_DEBUG"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
@@ -417,7 +418,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\ketsji;..\..\..\..\source\gameengine\Network;..\..\..\..\source\gameengine\expressions;..\..\..\..\source\gameengine\GameLogic" AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\ketsji;..\..\..\..\source\gameengine\Network;..\..\..\..\source\gameengine\expressions;..\..\..\..\source\gameengine\GameLogic;..\..\..\..\source\gameengine\Scenegraph"
PreprocessorDefinitions="NDEBUG,WIN32,_LIB" PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"

View File

@@ -42,7 +42,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\..\..\build\msvc_9\intern\SoundSystem\include;..\..\..\..\..\source\gameengine\Physics\common;..\..\..\..\..\source\gameengine\Physics\Bullet;..\..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\..\source\gameengine\Ketsji;..\..\..\..\..\source\gameengine\Expressions;..\..\..\..\..\source\gameengine\GameLogic;..\..\..\..\..\source\gameengine\SceneGraph;..\..\..\..\..\source\kernel\gen_system;..\..\..\..\..\source\blender\makesdna" AdditionalIncludeDirectories="..\..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\..\..\build\msvc_9\intern\SoundSystem\include;..\..\..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\..\source\gameengine\Physics\common;..\..\..\..\..\source\gameengine\Physics\Bullet;..\..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\..\source\gameengine\Ketsji;..\..\..\..\..\source\gameengine\Expressions;..\..\..\..\..\source\gameengine\GameLogic;..\..\..\..\..\source\gameengine\SceneGraph;..\..\..\..\..\source\kernel\gen_system;..\..\..\..\..\source\blender\makesdna;..\..\..\..\..\source\blender\blenkernel;..\..\..\..\..\source\blender\blenlib"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB" PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="false" MinimalRebuild="false"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@@ -110,7 +110,7 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\..\..\build\msvc_9\intern\SoundSystem\include;..\..\..\..\..\source\gameengine\Physics\common;..\..\..\..\..\source\gameengine\Physics\Bullet;..\..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\..\source\gameengine\Ketsji;..\..\..\..\..\source\gameengine\Expressions;..\..\..\..\..\source\gameengine\GameLogic;..\..\..\..\..\source\gameengine\SceneGraph;..\..\..\..\..\source\kernel\gen_system;..\..\..\..\..\source\blender\makesdna" AdditionalIncludeDirectories="..\..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\..\..\build\msvc_9\intern\SoundSystem\include;..\..\..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\..\source\gameengine\Physics\common;..\..\..\..\..\source\gameengine\Physics\Bullet;..\..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\..\source\gameengine\Ketsji;..\..\..\..\..\source\gameengine\Expressions;..\..\..\..\..\source\gameengine\GameLogic;..\..\..\..\..\source\gameengine\SceneGraph;..\..\..\..\..\source\kernel\gen_system;..\..\..\..\..\source\blender\makesdna;..\..\..\..\..\source\blender\blenkernel;..\..\..\..\..\source\blender\blenlib"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB" PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
RuntimeLibrary="0" RuntimeLibrary="0"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
@@ -176,7 +176,7 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\..\..\build\msvc_9\intern\SoundSystem\include;..\..\..\..\..\source\gameengine\Physics\common;..\..\..\..\..\source\gameengine\Physics\Bullet;..\..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\..\source\gameengine\Ketsji;..\..\..\..\..\source\gameengine\Expressions;..\..\..\..\..\source\gameengine\GameLogic;..\..\..\..\..\source\gameengine\SceneGraph;..\..\..\..\..\source\kernel\gen_system;..\..\..\..\..\source\blender\makesdna" AdditionalIncludeDirectories="..\..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\..\..\build\msvc_9\intern\SoundSystem\include;..\..\..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\..\source\gameengine\Physics\common;..\..\..\..\..\source\gameengine\Physics\Bullet;..\..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\..\source\gameengine\Ketsji;..\..\..\..\..\source\gameengine\Expressions;..\..\..\..\..\source\gameengine\GameLogic;..\..\..\..\..\source\gameengine\SceneGraph;..\..\..\..\..\source\kernel\gen_system;..\..\..\..\..\source\blender\makesdna;..\..\..\..\..\source\blender\blenkernel;..\..\..\..\..\source\blender\blenlib"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB" PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
RuntimeLibrary="0" RuntimeLibrary="0"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
@@ -243,7 +243,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\..\..\build\msvc_9\intern\SoundSystem\include;..\..\..\..\..\source\gameengine\Physics\common;..\..\..\..\..\source\gameengine\Physics\Bullet;..\..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\..\source\gameengine\Ketsji;..\..\..\..\..\source\gameengine\Expressions;..\..\..\..\..\source\gameengine\GameLogic;..\..\..\..\..\source\gameengine\SceneGraph;..\..\..\..\..\source\kernel\gen_system;..\..\..\..\..\source\blender\makesdna" AdditionalIncludeDirectories="..\..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\..\..\build\msvc_9\intern\SoundSystem\include;..\..\..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\..\source\gameengine\Physics\common;..\..\..\..\..\source\gameengine\Physics\Bullet;..\..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\..\source\gameengine\Ketsji;..\..\..\..\..\source\gameengine\Expressions;..\..\..\..\..\source\gameengine\GameLogic;..\..\..\..\..\source\gameengine\SceneGraph;..\..\..\..\..\source\kernel\gen_system;..\..\..\..\..\source\blender\makesdna;..\..\..\..\..\source\blender\blenkernel;..\..\..\..\..\source\blender\blenlib"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB" PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="false" MinimalRebuild="false"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@@ -312,7 +312,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\..\..\build\msvc_9\intern\SoundSystem\include;..\..\..\..\..\source\gameengine\Physics\common;..\..\..\..\..\source\gameengine\Physics\Bullet;..\..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\..\source\gameengine\Ketsji;..\..\..\..\..\source\gameengine\Expressions;..\..\..\..\..\source\gameengine\GameLogic;..\..\..\..\..\source\gameengine\SceneGraph;..\..\..\..\..\source\kernel\gen_system;..\..\..\..\..\source\blender\makesdna" AdditionalIncludeDirectories="..\..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\..\..\build\msvc_9\intern\SoundSystem\include;..\..\..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\..\source\gameengine\Physics\common;..\..\..\..\..\source\gameengine\Physics\Bullet;..\..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\..\source\gameengine\Ketsji;..\..\..\..\..\source\gameengine\Expressions;..\..\..\..\..\source\gameengine\GameLogic;..\..\..\..\..\source\gameengine\SceneGraph;..\..\..\..\..\source\kernel\gen_system;..\..\..\..\..\source\blender\makesdna;..\..\..\..\..\source\blender\blenkernel;..\..\..\..\..\source\blender\blenlib"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB" PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="false" MinimalRebuild="false"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@@ -380,7 +380,7 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\..\..\build\msvc_9\intern\SoundSystem\include;..\..\..\..\..\source\gameengine\Physics\common;..\..\..\..\..\source\gameengine\Physics\Bullet;..\..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\..\source\gameengine\Ketsji;..\..\..\..\..\source\gameengine\Expressions;..\..\..\..\..\source\gameengine\GameLogic;..\..\..\..\..\source\gameengine\SceneGraph;..\..\..\..\..\source\kernel\gen_system;..\..\..\..\..\source\blender\makesdna" AdditionalIncludeDirectories="..\..\..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\..\..\build\msvc_9\intern\SoundSystem\include;..\..\..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\..\source\gameengine\Physics\common;..\..\..\..\..\source\gameengine\Physics\Bullet;..\..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\..\source\gameengine\Ketsji;..\..\..\..\..\source\gameengine\Expressions;..\..\..\..\..\source\gameengine\GameLogic;..\..\..\..\..\source\gameengine\SceneGraph;..\..\..\..\..\source\kernel\gen_system;..\..\..\..\..\source\blender\makesdna;..\..\..\..\..\source\blender\blenkernel;..\..\..\..\..\source\blender\blenlib"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB" PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
RuntimeLibrary="2" RuntimeLibrary="2"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"

View File

@@ -4,6 +4,7 @@
Version="9,00" Version="9,00"
Name="RAS_rasterizer" Name="RAS_rasterizer"
ProjectGUID="{51FB3D48-2467-4BFA-A321-D848252B437E}" ProjectGUID="{51FB3D48-2467-4BFA-A321-D848252B437E}"
RootNamespace="RAS_rasterizer"
TargetFrameworkVersion="131072" TargetFrameworkVersion="131072"
> >
<Platforms> <Platforms>
@@ -42,7 +43,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\..\lib\windows\python\include\python2.5" AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\source\gameengine\SceneGraph;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\makesdna"
PreprocessorDefinitions="_DEBUG;WIN32;_LIB;WITH_GLEXT" PreprocessorDefinitions="_DEBUG;WIN32;_LIB;WITH_GLEXT"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
@@ -117,7 +118,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system" AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\source\gameengine\SceneGraph;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\makesdna"
PreprocessorDefinitions="NDEBUG,WIN32,_LIB" PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
StringPooling="true" StringPooling="true"
RuntimeLibrary="2" RuntimeLibrary="2"
@@ -192,7 +193,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\..\lib\windows\python\include\python2.5" AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\source\gameengine\SceneGraph;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\makesdna"
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;WITH_GLEXT" PreprocessorDefinitions="NDEBUG;WIN32;_LIB;WITH_GLEXT"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"
@@ -267,7 +268,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system" AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\source\gameengine\SceneGraph;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\makesdna"
PreprocessorDefinitions="_DEBUG,WIN32,_LIB" PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@@ -342,7 +343,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\..\lib\windows\python\include\python2.5" AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\source\gameengine\SceneGraph;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\makesdna"
PreprocessorDefinitions="_DEBUG;WIN32;_LIB;WITH_GLEXT" PreprocessorDefinitions="_DEBUG;WIN32;_LIB;WITH_GLEXT"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
@@ -417,7 +418,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\..\lib\windows\python\include\python2.5" AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\source\gameengine\SceneGraph;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\makesdna"
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;WITH_GLEXT" PreprocessorDefinitions="NDEBUG;WIN32;_LIB;WITH_GLEXT"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"

View File

@@ -43,7 +43,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\source\blender\gpu" AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\source\gameengine\SceneGraph;..\..\..\..\source\blender\gpu;..\..\..\..\source\gameengine\Ketsji;..\..\..\..\source\blender\makesdna;..\..\..\..\source\blender\blenkernel;..\..\..\..\source\blender\blenlib"
PreprocessorDefinitions="_DEBUG,WIN32,_LIB" PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@@ -118,7 +118,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\source\blender\gpu" AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\source\gameengine\SceneGraph;..\..\..\..\source\blender\gpu;..\..\..\..\source\gameengine\Ketsji;..\..\..\..\source\blender\makesdna;..\..\..\..\source\blender\blenkernel;..\..\..\..\source\blender\blenlib"
PreprocessorDefinitions="_DEBUG;WIN32;_LIB;WITH_GLEXT" PreprocessorDefinitions="_DEBUG;WIN32;_LIB;WITH_GLEXT"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
@@ -193,7 +193,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\source\blender\gpu" AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\source\gameengine\SceneGraph;..\..\..\..\source\blender\gpu;..\..\..\..\source\gameengine\Ketsji;..\..\..\..\source\blender\makesdna;..\..\..\..\source\blender\blenkernel;..\..\..\..\source\blender\blenlib"
PreprocessorDefinitions="NDEBUG,WIN32,_LIB" PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
StringPooling="true" StringPooling="true"
RuntimeLibrary="2" RuntimeLibrary="2"
@@ -268,7 +268,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\source\blender\gpu" AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\source\gameengine\SceneGraph;..\..\..\..\source\blender\gpu;..\..\..\..\source\gameengine\Ketsji;..\..\..\..\source\blender\makesdna;..\..\..\..\source\blender\blenkernel;..\..\..\..\source\blender\blenlib"
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;WITH_GLEXT" PreprocessorDefinitions="NDEBUG;WIN32;_LIB;WITH_GLEXT"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"
@@ -343,7 +343,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\source\blender\gpu" AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\source\gameengine\SceneGraph;..\..\..\..\source\blender\gpu;..\..\..\..\source\gameengine\Ketsji;..\..\..\..\source\blender\makesdna;..\..\..\..\source\blender\blenkernel;..\..\..\..\source\blender\blenlib"
PreprocessorDefinitions="_DEBUG;WIN32;_LIB;WITH_GLEXT" PreprocessorDefinitions="_DEBUG;WIN32;_LIB;WITH_GLEXT"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
@@ -418,7 +418,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\source\blender\gpu" AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\source\gameengine\SceneGraph;..\..\..\..\source\blender\gpu;..\..\..\..\source\gameengine\Ketsji;..\..\..\..\source\blender\makesdna;..\..\..\..\source\blender\blenkernel;..\..\..\..\source\blender\blenlib"
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;WITH_GLEXT" PreprocessorDefinitions="NDEBUG;WIN32;_LIB;WITH_GLEXT"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"

View File

@@ -4,6 +4,7 @@
Version="9,00" Version="9,00"
Name="SG_SceneGraph" Name="SG_SceneGraph"
ProjectGUID="{09222F5E-1625-4FF3-A89A-384D16875EE5}" ProjectGUID="{09222F5E-1625-4FF3-A89A-384D16875EE5}"
RootNamespace="SG_SceneGraph"
TargetFrameworkVersion="131072" TargetFrameworkVersion="131072"
> >
<Platforms> <Platforms>
@@ -509,6 +510,10 @@
RelativePath="..\..\..\source\gameengine\SceneGraph\SG_Controller.h" RelativePath="..\..\..\source\gameengine\SceneGraph\SG_Controller.h"
> >
</File> </File>
<File
RelativePath="..\..\..\source\gameengine\SceneGraph\SG_DList.h"
>
</File>
<File <File
RelativePath="..\..\..\source\gameengine\SceneGraph\SG_IObject.h" RelativePath="..\..\..\source\gameengine\SceneGraph\SG_IObject.h"
> >
@@ -521,6 +526,10 @@
RelativePath="..\..\..\source\gameengine\SceneGraph\SG_ParentRelation.h" RelativePath="..\..\..\source\gameengine\SceneGraph\SG_ParentRelation.h"
> >
</File> </File>
<File
RelativePath="..\..\..\source\gameengine\SceneGraph\SG_QList.h"
>
</File>
<File <File
RelativePath="..\..\..\source\gameengine\SceneGraph\SG_Spatial.h" RelativePath="..\..\..\source\gameengine\SceneGraph\SG_Spatial.h"
> >

View File

@@ -126,7 +126,6 @@
ProgramDataBaseFileName="..\..\..\..\build\msvc_9\source\gameengine\videotexture\" ProgramDataBaseFileName="..\..\..\..\build\msvc_9\source\gameengine\videotexture\"
WarningLevel="2" WarningLevel="2"
Detect64BitPortabilityProblems="false" Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="0" CompileAs="0"
ShowIncludes="false" ShowIncludes="false"
/> />

View File

@@ -180,7 +180,7 @@ endif
else else
@strip -x $(DISTDIR)/blender$(EXT0) @strip -x $(DISTDIR)/blender$(EXT0)
@if [ -f $(DISTDIR)/blenderplayer$(EXTO) ]; then \ @if [ -f $(DISTDIR)/blenderplayer$(EXTO) ]; then \
strip -x $(DISTDIR)/blender$(EXT0) ; \ strip -x $(DISTDIR)/blenderplayer$(EXT0) ; \
fi fi
endif endif
endif endif

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 KiB

After

Width:  |  Height:  |  Size: 192 KiB

View File

@@ -7,7 +7,7 @@ Group: 'Export'
Tooltip: 'Export to 3DS file format (.3ds).' Tooltip: 'Export to 3DS file format (.3ds).'
""" """
__author__ = ["Campbell Barton", "Bob Holcomb", "Richard L<EFBFBD>rk<EFBFBD>ng", "Damien McGinnes", "Mark Stijnman"] __author__ = ["Campbell Barton", "Bob Holcomb", "Richard Lärkäng", "Damien McGinnes", "Mark Stijnman"]
__url__ = ("blenderartists.org", "www.blender.org", "www.gametutorials.com", "lib3ds.sourceforge.net/") __url__ = ("blenderartists.org", "www.blender.org", "www.gametutorials.com", "lib3ds.sourceforge.net/")
__version__ = "0.90a" __version__ = "0.90a"
__bpydoc__ = """\ __bpydoc__ = """\
@@ -50,7 +50,10 @@ import Blender
import bpy import bpy
from BPyMesh import getMeshFromObject from BPyMesh import getMeshFromObject
from BPyObject import getDerivedObjects from BPyObject import getDerivedObjects
import struct try:
import struct
except:
struct = None
# So 3ds max can open files, limit names to 12 in length # So 3ds max can open files, limit names to 12 in length
# this is verry annoying for filenames! # this is verry annoying for filenames!
@@ -1009,5 +1012,8 @@ def save_3ds(filename):
if __name__=='__main__': if __name__=='__main__':
Blender.Window.FileSelector(save_3ds, "Export 3DS", Blender.sys.makename(ext='.3ds')) if struct:
Blender.Window.FileSelector(save_3ds, "Export 3DS", Blender.sys.makename(ext='.3ds'))
else:
Blender.Draw.PupMenu("Error%t|This script requires a full python installation")
# save_3ds('/test_b.3ds') # save_3ds('/test_b.3ds')

View File

@@ -133,10 +133,12 @@ import BPyImage
import BPyMessages import BPyMessages
import struct try:
from struct import calcsize, unpack from struct import calcsize, unpack
except:
calcsize= unpack= None
import os
# If python version is less than 2.4, try to get set stuff from module # If python version is less than 2.4, try to get set stuff from module
try: try:
@@ -958,7 +960,10 @@ def load_3ds(filename, PREF_UI= True):
DEBUG= False DEBUG= False
if __name__=='__main__' and not DEBUG: if __name__=='__main__' and not DEBUG:
Blender.Window.FileSelector(load_3ds, 'Import 3DS', '*.3ds') if calcsize==None:
Blender.Draw.PupMenu('Error%t|a full python installation not found')
else:
Blender.Window.FileSelector(load_3ds, 'Import 3DS', '*.3ds')
# For testing compatibility # For testing compatibility
#load_3ds('/metavr/convert/vehicle/truck_002/TruckTanker1.3DS', False) #load_3ds('/metavr/convert/vehicle/truck_002/TruckTanker1.3DS', False)
@@ -966,6 +971,7 @@ if __name__=='__main__' and not DEBUG:
''' '''
else: else:
import os
# DEBUG ONLY # DEBUG ONLY
TIME= Blender.sys.time() TIME= Blender.sys.time()
import os import os

View File

@@ -45,7 +45,8 @@ from Blender import Types, Object, NMesh, Material,Armature,Mesh
from Blender.Mathutils import * from Blender.Mathutils import *
from Blender import Draw, BGL from Blender import Draw, BGL
from Blender.BGL import * from Blender.BGL import *
import math try: import math
except: math = None
global mat_flip,index_list,space,bone_list,mat_dict global mat_flip,index_list,space,bone_list,mat_dict
global anim,flip_norm,swap_zy,flip_z,speed,ticks,no_light,recalc_norm,Bl_norm global anim,flip_norm,swap_zy,flip_z,speed,ticks,no_light,recalc_norm,Bl_norm

View File

@@ -6,7 +6,8 @@ Group: 'AddMesh'
""" """
import BPyAddMesh import BPyAddMesh
import Blender import Blender
from math import cos, sin, pi try: from math import cos, sin, pi
except: math = None
def add_torus(PREF_MAJOR_RAD, PREF_MINOR_RAD, PREF_MAJOR_SEG, PREF_MINOR_SEG): def add_torus(PREF_MAJOR_RAD, PREF_MINOR_RAD, PREF_MAJOR_SEG, PREF_MINOR_SEG):
Vector = Blender.Mathutils.Vector Vector = Blender.Mathutils.Vector
@@ -61,5 +62,8 @@ def main():
BPyAddMesh.add_mesh_simple('Torus', verts, [], faces) BPyAddMesh.add_mesh_simple('Torus', verts, [], faces)
main() if cos and sin and pi:
main()
else:
Blender.Draw.PupMenu("Error%t|This script requires a full python installation")

View File

@@ -132,7 +132,6 @@ modified for Blender/Mathutils by Campell Barton
###################################################################### ######################################################################
# Public interface # Public interface
###################################################################### ######################################################################
from Blender.Mathutils import DotVecs
def convexHull(point_list_2d): def convexHull(point_list_2d):
"""Calculate the convex hull of a set of vectors """Calculate the convex hull of a set of vectors
The vectors can be 3 or 4d but only the Xand Y are used. The vectors can be 3 or 4d but only the Xand Y are used.
@@ -197,7 +196,7 @@ def plane2mat(plane, normalize= False):
up= cent - ((plane[0]+plane[1])/2.0) up= cent - ((plane[0]+plane[1])/2.0)
right= cent - ((plane[1]+plane[2])/2.0) right= cent - ((plane[1]+plane[2])/2.0)
z= CrossVecs(up, right) z= up.cross(right)
if normalize: if normalize:
up.normalize() up.normalize()

View File

@@ -569,12 +569,11 @@ def face_edges(me):
def facesPlanerIslands(me): def facesPlanerIslands(me):
DotVecs= Blender.Mathutils.DotVecs
def roundvec(v): def roundvec(v):
return round(v[0], 4), round(v[1], 4), round(v[2], 4) return round(v[0], 4), round(v[1], 4), round(v[2], 4)
face_props= [(cent, no, roundvec(no), DotVecs(cent, no)) for f in me.faces for no, cent in ((f.no, f.cent),)] face_props= [(cent, no, roundvec(no), cent.dot(no)) for f in me.faces for no, cent in ((f.no, f.cent),)]
face_edge_users= face_edges(me) face_edge_users= face_edges(me)
islands= [] islands= []
@@ -607,7 +606,7 @@ def facesPlanerIslands(me):
face_prop2= face_props[fidx2] face_prop2= face_props[fidx2]
# normals are the same? # normals are the same?
if face_prop1[2]==face_prop2[2]: if face_prop1[2]==face_prop2[2]:
if abs(face_prop1[3] - DotVecs(face_prop1[1], face_prop2[0])) < 0.000001: if abs(face_prop1[3] - face_prop1[1].dot(face_prop2[0])) < 0.000001:
used_faces[fidx2]= 1 used_faces[fidx2]= 1
island.append(fidx2) island.append(fidx2)
islands.append([me.faces[i] for i in island]) islands.append([me.faces[i] for i in island])
@@ -616,7 +615,6 @@ def facesPlanerIslands(me):
def facesUvIslands(me, PREF_IMAGE_DELIMIT=True): def facesUvIslands(me, PREF_IMAGE_DELIMIT=True):
DotVecs= Blender.Mathutils.DotVecs
def roundvec(v): def roundvec(v):
return round(v[0], 4), round(v[1], 4) return round(v[0], 4), round(v[1], 4)

View File

@@ -1,332 +0,0 @@
from Blender import *
try:
import psyco
psyco.full()
except:
print 'no psyco for you!'
DotVecs= Mathutils.DotVecs
#========================================================
# SPACIAL TREE - Seperate Class - use if you want to
# USed for getting vert is a proximity
LEAF_SIZE = 128
class octreeNode:
def __init__(self, verts, parent):
# Assunme we are a leaf node, until split is run.
self.verts = verts
self.children = []
if parent == None: # ROOT NODE, else set bounds when making children,
# BOUNDS
v= verts[0]
maxx,maxy,maxz= v.co
minx,miny,minz= maxx,maxy,maxz
for v in verts:
x,y,z= v.co
if x>maxx: maxx= x
if y>maxy: maxy= y
if z>maxz: maxz= z
if x<minx: minx= x
if y<miny: miny= y
if z<minz: minz= z
self.minx= minx
self.miny= miny
self.minz= minz
self.maxx= maxx
self.maxy= maxy
self.maxz= maxz
# We have no parent to split us so split ourselves.
#self.setCornerPoints()
self.splitNode()
def splitNode(self):
if len(self.verts) > LEAF_SIZE:
self.makeChildren() # 8 new children,
self.verts = None
# Alredy assumed a leaf not so dont do anything here.
def makeChildren(self):
verts= self.verts
# Devide into 8 children.
axisDividedVerts = [[],[],[],[],[],[],[],[]] # Verts Only
divx = (self.maxx + self.minx) / 2
divy = (self.maxy + self.miny) / 2
divz = (self.maxz + self.minz) / 2
# Sort into 8
for v in verts:
x,y,z = v.co
if x > divx:
if y > divy:
if z > divz:
axisDividedVerts[0].append(v)
else:
axisDividedVerts[1].append(v)
else:
if z > divz:
axisDividedVerts[2].append(v)
else:
axisDividedVerts[3].append(v)
else:
if y > divy:
if z > divz:
axisDividedVerts[4].append(v)
else:
axisDividedVerts[5].append(v)
else:
if z > divz:
axisDividedVerts[6].append(v)
else:
axisDividedVerts[7].append(v)
# populate self.children
for i in xrange(8):
octNode = octreeNode(axisDividedVerts[i], self)
# Set bounds manually
if i == 0:
octNode.minx = divx
octNode.maxx = self.maxx
octNode.miny = divy
octNode.maxy = self.maxy
octNode.minz = divz
octNode.maxz = self.maxz
elif i == 1:
octNode.minx = divx
octNode.maxx = self.maxx
octNode.miny = divy
octNode.maxy = self.maxy
octNode.minz = self.minz #
octNode.maxz = divz #
elif i == 2:
octNode.minx = divx
octNode.maxx = self.maxx
octNode.miny = self.miny #
octNode.maxy = divy #
octNode.minz = divz
octNode.maxz = self.maxz
elif i == 3:
octNode.minx = divx
octNode.maxx = self.maxx
octNode.miny = self.miny #
octNode.maxy = divy #
octNode.minz = self.minz #
octNode.maxz = divz #
elif i == 4:
octNode.minx = self.minx #
octNode.maxx = divx #
octNode.miny = divy
octNode.maxy = self.maxy
octNode.minz = divz
octNode.maxz = self.maxz
elif i == 5:
octNode.minx = self.minx #
octNode.maxx = divx #
octNode.miny = divy
octNode.maxy = self.maxy
octNode.minz = self.minz #
octNode.maxz = divz #
elif i == 6:
octNode.minx = self.minx #
octNode.maxx = divx #
octNode.miny = self.miny #
octNode.maxy = divy #
octNode.minz = divz
octNode.maxz = self.maxz
elif i == 7:
octNode.minx = self.minx #
octNode.maxx = divx #
octNode.miny = self.miny #
octNode.maxy = divy #
octNode.minz = self.minz #
octNode.maxz = divz #
#octNode.setCornerPoints()
octNode.splitNode() # Splits the node if it can.
self.children.append(octNode)
# GETS VERTS IN A Distance RANGE-
def getVertsInRange(self, loc, normal, range_val, vertList):
#loc= Mathutils.Vector(loc) # MUST BE VECTORS
#normal= Mathutils.Vector(normal)
'''
loc: Vector of the location to search from
normal: None or Vector - if a vector- will only get verts on this side of the vector
range_val: maximum distance. A negative value will fill the list with teh closest vert only.
vertList: starts as an empty list
list that this function fills with verts that match
'''
xloc,yloc,zloc= loc
if range_val<0:
range_val= -range_val
FIND_CLOSEST= True
vertList.append(None) # just update the 1 vertex
else:
FIND_CLOSEST= False
if self.children:
# Check if the bounds are in range_val,
for childNode in self.children:
# First test if we are surrounding the point.
if\
childNode.minx - range_val < xloc and\
childNode.maxx + range_val > xloc and\
childNode.miny - range_val < yloc and\
childNode.maxy + range_val > yloc and\
childNode.minz - range_val < zloc and\
childNode.maxz + range_val > zloc:
# Recurse down or get virts.
childNode.getVertsInRange(loc, normal, range_val, vertList)
#continue # Next please
else: # we are a leaf node. Test vert locations.
if not normal:
# Length only check
for v in self.verts:
length = (loc - v.co).length
if length < range_val:
if FIND_CLOSEST:
# Just update the 1 vert
vertList[0]= (v, length)
range_val= length # Shink the length so we only get verts from their.
else:
vertList.append((v, length))
else:
# Lengh and am I infront of the vert.
for v in self.verts:
length = (loc - v.co).length
if length < range_val:
# Check if the points in front
dot= DotVecs(normal, loc) - DotVecs(normal, v.co)
if dot<0:
vertList.append((v, length))
# END TREE
# EXAMPLE RADIO IN PYTHON USING THE ABOVE FUNCTION
"""
import BPyMesh
# Radio bake
def bake():
_AngleBetweenVecs_= Mathutils.AngleBetweenVecs
def AngleBetweenVecs(a1,a2):
try:
return _AngleBetweenVecs_(a1,a2)
except:
return 180
scn = Scene.GetCurrent()
ob = scn.getActiveObject()
me = ob.getData(mesh=1)
dist= Draw.PupFloatInput('MaxDist:', 2.0, 0.1, 20.0, 0.1, 3)
if dist==None:
return
# Make nice normals
BPyMesh.meshCalcNormals(me)
len_verts= len(me.verts)
#me.sel= False
meshOctTree = octreeNode(me.verts, None)
# Store face areas
vertex_areas= [0.0] * len_verts
# Get vertex areas - all areas of face users
for f in me.faces:
a= f.area
for v in f.v:
vertex_areas[v.index] += a
bias= 0.001
t= sys.time()
# Tone for the verts
vert_tones= [0.0] * len_verts
maxtone= 0.0
mintone= 100000000
for i, v in enumerate(me.verts):
if not i%10:
print 'verts to go', len_verts-i
v_co= v.co
v_no= v.no
verts_in_range= []
meshOctTree.getVertsInRange(v_co, v_no, dist, verts_in_range)
tone= 0.0
# These are verts in our range
for test_v, length in verts_in_range:
if bias<length:
try:
# Make sure this isnt a back facing vert
normal_diff= AngleBetweenVecs(test_v.no, v_no)
except:
continue
if normal_diff > 90: # were facing this vert
#if 1:
# Current value us between zz90 and 180
# make between 0 and 90
# so 0 is right angles and 90 is direct opposite vertex normal
normal_diff= (normal_diff-90)
# Vertex area needs to be taken into account so we dont have small faces over influencing.
vertex_area= vertex_areas[test_v.index]
# Get the angle the vertex is in location from the location and normal of the vert.
above_diff= AngleBetweenVecs(test_v.co-v.co, v_no)
## Result will be between 0 :above and 90: horizon.. invert this so horizon has littel effect
above_diff= 90-above_diff
# dist-length or 1.0/length both work well
tone= (dist-length) * vertex_area * above_diff * normal_diff
vert_tones[i] += tone
if maxtone<vert_tones[i]:
maxtone= vert_tones[i]
if mintone>vert_tones[i]:
mintone= vert_tones[i]
if not maxtone:
Draw.PupMenu('No verts in range, use a larger range')
return
# Apply tones
for f in me.faces:
f_col= f.col
for i, v in enumerate(f.v):
c= f_col[i]
v_index= v.index
tone= int(((maxtone - vert_tones[v.index]) / maxtone) * 255 )
#print tone
c.r= c.g= c.b= tone
print 'time', sys.time()-t
if __name__=="__main__":
bake()
"""

View File

@@ -25,7 +25,6 @@ import Blender
import bpy import bpy
Vector= Blender.Mathutils.Vector Vector= Blender.Mathutils.Vector
Ang= Blender.Mathutils.AngleBetweenVecs Ang= Blender.Mathutils.AngleBetweenVecs
CrossVecs= Blender.Mathutils.CrossVecs
MidpointVecs= Blender.Mathutils.MidpointVecs MidpointVecs= Blender.Mathutils.MidpointVecs
import BPyMesh import BPyMesh
@@ -198,8 +197,8 @@ def redux(ob, REDUX=0.5, BOUNDRY_WEIGHT=2.0, REMOVE_DOUBLES=False, FACE_AREA_WEI
# the point of collapsing. # the point of collapsing.
# Enlarge so we know they intersect: self.length*2 # Enlarge so we know they intersect: self.length*2
cv1= CrossVecs(v1no, CrossVecs(v1no, v1co-v2co)) cv1= v1no.cross(v1no.cross(v1co-v2co))
cv2= CrossVecs(v2no, CrossVecs(v2no, v2co-v1co)) cv2= v2no.cross(v2no.cross(v2co-v1co))
# Scale to be less then the edge lengths. # Scale to be less then the edge lengths.
cv2.length = cv1.length = 1 cv2.length = cv1.length = 1

View File

@@ -1,6 +1,6 @@
import Blender import Blender
from Blender import Mathutils, Window, Scene, Draw, Mesh from Blender import Mathutils, Window, Scene, Draw, Mesh
from Blender.Mathutils import CrossVecs, Matrix, Vector, Intersect from Blender.Mathutils import Matrix, Vector, Intersect
# DESCRIPTION: # DESCRIPTION:
# screen_x, screen_y the origin point of the pick ray # screen_x, screen_y the origin point of the pick ray

View File

@@ -1,6 +1,6 @@
#dxfLibrary.py : provides functions for generating DXF files #dxfLibrary.py : provides functions for generating DXF files
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
__version__ = "v1.29beta - 2008.12.28" __version__ = "v1.32 - 2009.06.06"
__author__ = "Stani Michiels(Stani), Remigiusz Fiedler(migius)" __author__ = "Stani Michiels(Stani), Remigiusz Fiedler(migius)"
__license__ = "GPL" __license__ = "GPL"
__url__ = "http://wiki.blender.org/index.php/Scripts/Manual/Export/autodesk_dxf" __url__ = "http://wiki.blender.org/index.php/Scripts/Manual/Export/autodesk_dxf"
@@ -18,31 +18,39 @@ IDEAs:
- -
TODO: TODO:
- add support for SPLINEs, (bad idea, cause DXF r14 object :( - add support for DXFr14 (needs extended file header)
- add support for SPLINEs (possible first in DXFr14 version)
History History
v1.32 - 2009.06.06 by migius
- modif Style class: changed defaults to widthFactor=1.0, obliqueAngle=0.0
- modif Text class: alignment parameter reactivated
v1.31 - 2009.06.02 by migius
- modif _Entity class: added paperspace,elevation
v1.30 - 2009.05.28 by migius
- bugfix 3dPOLYLINE/POLYFACE: VERTEX needs x,y,z coordinates, index starts with 1 not 0
v1.29 - 2008.12.28 by Yorik v1.29 - 2008.12.28 by Yorik
- modif POLYLINE to support bulge segments - modif POLYLINE to support bulge segments
v1.28 - 2008.12.13 by Steeve/BlenderArtists v1.28 - 2008.12.13 by Steeve/BlenderArtists
- bugfix for EXTMIN/EXTMAX to suit Cycas-CAD - bugfix for EXTMIN/EXTMAX to suit Cycas-CAD
v1.27 - 2008.10.07 by migius v1.27 - 2008.10.07 by migius
- beautifying output code: keys whitespace prefix - beautifying output code: keys whitespace prefix
- refactoring DXF-strings format: NewLine moved to the end of - refactoring DXF-strings format: NewLine moved to the end of
v1.26 - 2008.10.05 by migius v1.26 - 2008.10.05 by migius
- modif POLYLINE to support POLYFACE - modif POLYLINE to support POLYFACE
v1.25 - 2008.09.28 by migius v1.25 - 2008.09.28 by migius
- modif FACE class for r12 - modif FACE class for r12
v1.24 - 2008.09.27 by migius v1.24 - 2008.09.27 by migius
- modif POLYLINE class for r12 - modif POLYLINE class for r12
- changing output format from r9 to r12(AC1009) - changing output format from r9 to r12(AC1009)
v1.1 (20/6/2005) by www.stani.be/python/sdxf v1.1 (20/6/2005) by www.stani.be/python/sdxf
- Python library to generate dxf drawings - Python library to generate dxf drawings
______________________________________________________________ ______________________________________________________________
""" % (__author__,__version__,__license__,__url__) """ % (__author__,__version__,__license__,__url__)
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# DXF Library: copyright (C) 2005 by Stani Michiels (AKA Stani) # DXF Library: copyright (C) 2005 by Stani Michiels (AKA Stani)
# 2008 modif by Remigiusz Fiedler (AKA migius) # 2008/2009 modif by Remigiusz Fiedler (AKA migius)
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# ***** BEGIN GPL LICENSE BLOCK ***** # ***** BEGIN GPL LICENSE BLOCK *****
# #
@@ -85,7 +93,6 @@ def _point(x,index=0):
def _points(plist): def _points(plist):
"""Convert a list of tuples to dxf points""" """Convert a list of tuples to dxf points"""
out = '\n'.join([_point(plist[i],i)for i in range(len(plist))]) out = '\n'.join([_point(plist[i],i)for i in range(len(plist))])
#print 'deb: points=\n', out #-------------------
return out return out
#---base classes---------------------------------------- #---base classes----------------------------------------
@@ -104,17 +111,21 @@ class _Call:
#------------------------------------------------------- #-------------------------------------------------------
class _Entity(_Call): class _Entity(_Call):
"""Base class for _common group codes for entities.""" """Base class for _common group codes for entities."""
def __init__(self,color=None,extrusion=None,layer='0', def __init__(self,paperspace=None,color=None,layer='0',
lineType=None,lineTypeScale=None,lineWeight=None, lineType=None,lineTypeScale=None,lineWeight=None,
thickness=None,parent=None): extrusion=None,elevation=None,thickness=None,
parent=None):
"""None values will be omitted.""" """None values will be omitted."""
self.paperspace = paperspace
self.color = color self.color = color
self.extrusion = extrusion
self.layer = layer self.layer = layer
self.lineType = lineType self.lineType = lineType
self.lineTypeScale = lineTypeScale self.lineTypeScale = lineTypeScale
self.lineWeight = lineWeight self.lineWeight = lineWeight
self.extrusion = extrusion
self.elevation = elevation
self.thickness = thickness self.thickness = thickness
#self.visible = visible
self.parent = parent self.parent = parent
def _common(self): def _common(self):
@@ -122,13 +133,16 @@ class _Entity(_Call):
if self.parent:parent=self.parent if self.parent:parent=self.parent
else:parent=self else:parent=self
result ='' result =''
if parent.paperspace==1: result+=' 67\n1\n'
if parent.layer!=None: result+=' 8\n%s\n'%parent.layer if parent.layer!=None: result+=' 8\n%s\n'%parent.layer
if parent.color!=None: result+=' 62\n%s\n'%parent.color if parent.color!=None: result+=' 62\n%s\n'%parent.color
if parent.extrusion!=None: result+='%s\n'%_point(parent.extrusion,200)
if parent.lineType!=None: result+=' 6\n%s\n'%parent.lineType if parent.lineType!=None: result+=' 6\n%s\n'%parent.lineType
#TODO: if parent.lineWeight!=None: result+='370\n%s\n'%parent.lineWeight #TODO: if parent.lineWeight!=None: result+='370\n%s\n'%parent.lineWeight
#TODO: if parent.visible!=None: result+='60\n%s\n'%parent.visible
if parent.lineTypeScale!=None: result+=' 48\n%s\n'%parent.lineTypeScale if parent.lineTypeScale!=None: result+=' 48\n%s\n'%parent.lineTypeScale
if parent.elevation!=None: result+=' 38\n%s\n'%parent.elevation
if parent.thickness!=None: result+=' 39\n%s\n'%parent.thickness if parent.thickness!=None: result+=' 39\n%s\n'%parent.thickness
if parent.extrusion!=None: result+='%s\n'%_point(parent.extrusion,200)
return result return result
#-------------------------- #--------------------------
@@ -307,6 +321,10 @@ class PolyLine(_Entity):
self.points=points self.points=points
self.org_point=org_point self.org_point=org_point
self.flag=flag self.flag=flag
self.polyface = False
self.polyline2d = False
self.faces = [] # dummy value
self.width= None # dummy value
if self.flag & POLYFACE_MESH: if self.flag & POLYFACE_MESH:
self.polyface=True self.polyface=True
self.points=points[0] self.points=points[0]
@@ -322,21 +340,21 @@ class PolyLine(_Entity):
def __str__(self): def __str__(self):
result= ' 0\nPOLYLINE\n%s 70\n%s\n' %(self._common(),self.flag) result= ' 0\nPOLYLINE\n%s 70\n%s\n' %(self._common(),self.flag)
#print 'deb: self._common()', self._common() #----------
result+=' 66\n1\n' result+=' 66\n1\n'
result+='%s\n' %_point(self.org_point) result+='%s\n' %_point(self.org_point)
if self.polyface: if self.polyface:
result+=' 71\n%s\n' %self.p_count result+=' 71\n%s\n' %self.p_count
result+=' 72\n%s\n' %self.f_count result+=' 72\n%s\n' %self.f_count
elif self.polyline2d: elif self.polyline2d:
if self.width: result+=' 40\n%s\n 41\n%s\n' %(self.width[0],self.width[1]) if self.width!=None: result+=' 40\n%s\n 41\n%s\n' %(self.width[0],self.width[1])
for point in self.points: for point in self.points:
result+=' 0\nVERTEX\n' result+=' 0\nVERTEX\n'
result+=' 8\n%s\n' %self.layer result+=' 8\n%s\n' %self.layer
result+='%s\n' %_point(point[0:2])
if self.polyface: if self.polyface:
result+='%s\n' %_point(point[0:3])
result+=' 70\n192\n' result+=' 70\n192\n'
elif self.polyline2d: elif self.polyline2d:
result+='%s\n' %_point(point[0:2])
if len(point)>4: if len(point)>4:
width1, width2 = point[3], point[4] width1, width2 = point[3], point[4]
if width1!=None: result+=' 40\n%s\n' %width1 if width1!=None: result+=' 40\n%s\n' %width1
@@ -344,6 +362,8 @@ class PolyLine(_Entity):
if len(point)==6: if len(point)==6:
bulge = point[5] bulge = point[5]
if bulge: result+=' 42\n%s\n' %bulge if bulge: result+=' 42\n%s\n' %bulge
else:
result+='%s\n' %_point(point[0:3])
for face in self.faces: for face in self.faces:
result+=' 0\nVERTEX\n' result+=' 0\nVERTEX\n'
result+=' 8\n%s\n' %self.layer result+=' 8\n%s\n' %self.layer
@@ -407,7 +427,7 @@ class Text(_Entity):
if self.style: result+=' 7\n%s\n'%self.style if self.style: result+=' 7\n%s\n'%self.style
if self.flag: result+=' 71\n%s\n'%self.flag if self.flag: result+=' 71\n%s\n'%self.flag
if self.justifyhor: result+=' 72\n%s\n'%self.justifyhor if self.justifyhor: result+=' 72\n%s\n'%self.justifyhor
#TODO: if self.alignment: result+='%s\n'%_point(self.alignment,1) if self.alignment: result+='%s\n'%_point(self.alignment,1)
if self.justifyver: result+=' 73\n%s\n'%self.justifyver if self.justifyver: result+=' 73\n%s\n'%self.justifyver
return result return result
@@ -528,7 +548,7 @@ class LineType(_Call):
#----------------------------------------------- #-----------------------------------------------
class Style(_Call): class Style(_Call):
"""Text style""" """Text style"""
def __init__(self,name='standard',flag=0,height=0,widthFactor=40,obliqueAngle=50, def __init__(self,name='standard',flag=0,height=0,widthFactor=1.0,obliqueAngle=0.0,
mirror=0,lastHeight=1,font='arial.ttf',bigFont=''): mirror=0,lastHeight=1,font='arial.ttf',bigFont=''):
self.name=name self.name=name
self.flag=flag self.flag=flag

View File

@@ -6,7 +6,7 @@ import BPyWindow
mouseViewRay= BPyWindow.mouseViewRay mouseViewRay= BPyWindow.mouseViewRay
from Blender import Mathutils, Window, Scene, Draw, sys from Blender import Mathutils, Window, Scene, Draw, sys
from Blender.Mathutils import CrossVecs, Vector, Intersect, LineIntersect, AngleBetweenVecs from Blender.Mathutils import Vector, Intersect, LineIntersect, AngleBetweenVecs
LMB= Window.MButs['L'] LMB= Window.MButs['L']
def mouseup(): def mouseup():
@@ -101,11 +101,11 @@ def vertexGradientPick(ob, MODE):
# make a line 90d to the grad in screenspace. # make a line 90d to the grad in screenspace.
if (OriginA-OriginB).length <= eps: # Persp view. same origin different direction if (OriginA-OriginB).length <= eps: # Persp view. same origin different direction
cross_grad= CrossVecs(DirectionA, DirectionB) cross_grad= DirectionA.cross(DirectionB)
ORTHO= False ORTHO= False
else: # Ortho - Same direction, different origin else: # Ortho - Same direction, different origin
cross_grad= CrossVecs(DirectionA, OriginA-OriginB) cross_grad= DirectionA.cross(OriginA-OriginB)
ORTHO= True ORTHO= True
cross_grad.normalize() cross_grad.normalize()

View File

@@ -1,7 +1,7 @@
# -*- coding: latin-1 -*- # -*- coding: latin-1 -*-
""" """
SVG 2 OBJ translater, 0.5.9n SVG 2 OBJ translater, 0.5.9o
Copyright (c) jm soler juillet/novembre 2004-february 2009, Copyright (c) jm soler juillet/novembre 2004-april 2009,
# --------------------------------------------------------------- # ---------------------------------------------------------------
released under GNU Licence released under GNU Licence
for the Blender 2.42 Python Scripts Bundle. for the Blender 2.42 Python Scripts Bundle.
@@ -255,7 +255,7 @@ Changelog:
- removed all debug statements - removed all debug statements
- correction of a zero division error in the calc_arc function. - correction of a zero division error in the calc_arc function.
0.5.9f: - 2007/15/7 0.5.9f: - 2007/15/7
- Correction de plusieurs bugs sur l'attributions des couleurs et le nommage - Correction de plusieurs bugs sur l'attributions des couleurs et le nommage
des courbes des courbes
@@ -266,6 +266,8 @@ Changelog:
0.5.9k : - 14/01/2009 0.5.9k : - 14/01/2009
0.5.9l : - 31/01/2009 0.5.9l : - 31/01/2009
0.5.9n : - 01/02/2009 0.5.9n : - 01/02/2009
0.5.9o : - 04/04/2009, remove pattern if it made with path.
================================================================================== ==================================================================================
==================================================================================""" =================================================================================="""
@@ -280,6 +282,7 @@ LAST_ID=''
LAST_COLOR=[0.0,0.0,0.0,0.0] LAST_COLOR=[0.0,0.0,0.0,0.0]
SEPARATE_CURVES=0 SEPARATE_CURVES=0
USE_COLORS=0 USE_COLORS=0
PATTERN=0
SVGCOLORNAMELIST={ 'aliceblue':[240, 248, 255] ,'antiquewhite':[250, 235, 215] SVGCOLORNAMELIST={ 'aliceblue':[240, 248, 255] ,'antiquewhite':[250, 235, 215]
,'aqua':[ 0, 255, 255], 'aquamarine':[127, 255, 212] ,'aqua':[ 0, 255, 255], 'aquamarine':[127, 255, 212]
@@ -787,6 +790,7 @@ def polygon(prp):
D.append('Z') D.append('Z')
return D return D
#-------------------- #--------------------
# 0.5.8, to remove exec # 0.5.8, to remove exec
#-------------------- #--------------------
@@ -1462,13 +1466,13 @@ def collect_ATTRIBUTS(data):
# -------------------------------------------- # --------------------------------------------
def build_HIERARCHY(t): def build_HIERARCHY(t):
global CP, curves, SCALE, DEBUG, BOUNDINGBOX, scale_, tagTRANSFORM global CP, curves, SCALE, DEBUG, BOUNDINGBOX, scale_, tagTRANSFORM
global LAST_ID global LAST_ID, PATTERN
TRANSFORM=0 TRANSFORM=0
t=t.replace('\t',' ') t=t.replace('\t',' ')
while t.find(' ')!=-1: t=t.replace(' ',' ') while t.find(' ')!=-1: t=t.replace(' ',' ')
n0=0 n0=0
t0=t1=0 t0=t1=0
baliste=[] #baliste=[]
balisetype=['?','?','/','/','!','!'] balisetype=['?','?','/','/','!','!']
BALISES=['D', #DECL_TEXTE', BALISES=['D', #DECL_TEXTE',
'D', #DECL_TEXTE', 'D', #DECL_TEXTE',
@@ -1490,26 +1494,37 @@ def build_HIERARCHY(t):
if t0>-1 and t1>-1: if t0>-1 and t1>-1:
if t[t0+1] in balisetype: if t[t0+1] in balisetype:
b=balisetype.index(t[t0+1]) b=balisetype.index(t[t0+1])
if t[t0+2]=='-': if t[t0+2]=='-':
b=balisetype.index(t[t0+1])+1 b=balisetype.index(t[t0+1])+1
balise=BALISES[b] balise=BALISES[b]
if b==2: if b==2:
parent=STACK.pop(-1) parent=STACK.pop(-1)
if parent!=None and TRANSFORM>0: if parent!=None and TRANSFORM>0:
TRANSFORM-=1 TRANSFORM-=1
elif t[t1-1] in balisetype: elif t[t1-1] in balisetype:
balise=BALISES[balisetype.index(t[t1-1])+1] balise=BALISES[balisetype.index(t[t1-1])+1]
else: else:
t2=t.find(' ',t0) t2=t.find(' ',t0)
if t2>t1: t2=t1 if t2>t1: t2=t1
ouvrante=1 ouvrante=1
NOM=t[t0+1:t2] NOM=t[t0+1:t2]
if '</'+NOM in t: #.find('</'+NOM)>-1: if '</'+NOM in t: #.find('</'+NOM)>-1:
balise=BALISES[-1] balise=BALISES[-1]
if NOM=='pattern' and not PATTERN:
t1=t.find('</'+NOM+'>',t0)+len('</'+NOM+'>')
balise=BALISES[-3]
else: else:
balise=BALISES[-2] balise=BALISES[-2]
if balise=='E' or balise=='O': if balise=='E' or balise=='O':
proprietes=collect_ATTRIBUTS(t[t0:t1+ouvrante]) proprietes=collect_ATTRIBUTS(t[t0:t1+ouvrante])
if 'id' in proprietes: if 'id' in proprietes:
@@ -1532,6 +1547,11 @@ def build_HIERARCHY(t):
# 0.5.8, to remove exec # 0.5.8, to remove exec
#-------------------- #--------------------
D=OTHERSSHAPES[proprietes['TYPE']](proprietes) D=OTHERSSHAPES[proprietes['TYPE']](proprietes)
#elif proprietes['TYPE'] in ['pattern']:
# print 'pattern'
# D=''
CP=[0.0,0.0] CP=[0.0,0.0]
if len(D)>0: if len(D)>0:
cursor=0 cursor=0
@@ -1567,7 +1587,7 @@ def build_HIERARCHY(t):
def scan_FILE(nom): def scan_FILE(nom):
global CP, curves, SCALE, DEBUG, BOUNDINGBOX, scale_, tagTRANSFORM global CP, curves, SCALE, DEBUG, BOUNDINGBOX, scale_, tagTRANSFORM
global SEPARATE_CURVES, USE_COLORS global SEPARATE_CURVES, USE_COLORS, PATTERN
dir,name=split(nom) dir,name=split(nom)
name=name.split('.') name=name.split('.')
@@ -1583,13 +1603,14 @@ def scan_FILE(nom):
togAS = Blender.Draw.Create(0) togAS = Blender.Draw.Create(0)
togSP = Blender.Draw.Create(0) togSP = Blender.Draw.Create(0)
togCOL = Blender.Draw.Create(0) togCOL = Blender.Draw.Create(0)
Pattern= Blender.Draw.Create(0)
block=[\ block=[\
("Clamp Width 1", togW, "Rescale the import with a Width of one unit"),\ ("Clamp Width 1", togW, "Rescale the import with a Width of one unit"),\
("Clamp Height 1", togH, "Rescale the import with a Heightof one unit"),\ ("Clamp Height 1", togH, "Rescale the import with a Heightof one unit"),\
("No Rescaling", togAS, "No rescaling, the result can be very large"),\ ("No Rescaling", togAS, "No rescaling, the result can be very large"),\
("Separate Curves", togSP, "Create an object for each curve, Slower. May manage colors"),\ ("Separate Curves", togSP, "Create an object for each curve, Slower. May manage colors"),\
("Import Colors", togCOL, "try to import color if the path is set as 'fill'. Only With separate option")] ("Import Colors", togCOL, "try to import color if the path is set as 'fill'. Only With separate option"),\
("Import Patterns", Pattern, "import pattern content if it is made with paths.")]
retval = Blender.Draw.PupBlock("Import Options", block) retval = Blender.Draw.PupBlock("Import Options", block)
if togW.val: scale_=1 if togW.val: scale_=1
elif togH.val: scale_=2 elif togH.val: scale_=2
@@ -1598,6 +1619,8 @@ def scan_FILE(nom):
if togSP.val: SEPARATE_CURVES=1 if togSP.val: SEPARATE_CURVES=1
if togCOL.val and SEPARATE_CURVES : USE_COLORS=1 if togCOL.val and SEPARATE_CURVES : USE_COLORS=1
if Pattern.val : PATTERN =1
t1=Blender.sys.time() t1=Blender.sys.time()
# 0.4.1 : to avoid to use sax and the xml # 0.4.1 : to avoid to use sax and the xml
@@ -1625,4 +1648,4 @@ def functionSELECT(nom):
if __name__=='__main__': if __name__=='__main__':
Blender.Window.FileSelector (functionSELECT, 'SELECT an .SVG FILE', '*.svg') Blender.Window.FileSelector (functionSELECT, 'SELECT an .SVG FILE', '*.svg')

View File

@@ -527,9 +527,10 @@ def setupAnim(StartFrame, EndFrame, VideoFrameRate):
if VideoFrameRate>120: VideoFrameRate=120 if VideoFrameRate>120: VideoFrameRate=120
# set up anim panel for them # set up anim panel for them
context=scn.getRenderingContext() context=scn.getRenderingContext()
context.startFrame(StartFrame) context.sFrame=StartFrame
context.endFrame(EndFrame) context.eFrame=EndFrame
context.framesPerSec(int(VideoFrameRate)) context.fps=int(VideoFrameRate)
Blender.Set("curframe",StartFrame) Blender.Set("curframe",StartFrame)
Blender.Redraw() Blender.Redraw()
return return

View File

@@ -708,20 +708,23 @@ def draw_gui():
# Fixed margin. use a margin since 0 margin can be hard to seewhen close to a crt's edge. # Fixed margin. use a margin since 0 margin can be hard to seewhen close to a crt's edge.
margin = 4 margin = 4
# Convenience
FNT_NAME, FNT_HEIGHT = __FONT_SIZES__[__FONT_SIZE__]
# Draw cursor location colour # Draw cursor location colour
if __CONSOLE_LINE_OFFSET__ == 0: if __CONSOLE_LINE_OFFSET__ == 0:
cmd2curWidth = Draw.GetStringWidth(cmdBuffer[-1].cmd[:cursor], __FONT_SIZES__[__FONT_SIZE__][0]) cmd2curWidth = Draw.GetStringWidth(cmdBuffer[-1].cmd[:cursor], FNT_NAME)
BGL.glColor3f(0.8, 0.2, 0.2) BGL.glColor3f(0.8, 0.2, 0.2)
if cmd2curWidth == 0: if cmd2curWidth == 0:
BGL.glRecti(margin,2,margin+2, __FONT_SIZES__[__FONT_SIZE__][1]+2) BGL.glRecti(margin,2,margin+2, FNT_HEIGHT+2)
else: else:
BGL.glRecti(margin + cmd2curWidth-2,2, margin+cmd2curWidth, __FONT_SIZES__[__FONT_SIZE__][1]+2) BGL.glRecti(margin + cmd2curWidth-2,2, margin+cmd2curWidth, FNT_HEIGHT+2)
BGL.glColor3f(1,1,1) BGL.glColor3f(1,1,1)
# Draw the set of cammands to the buffer # Draw the set of cammands to the buffer
consoleLineIdx = __CONSOLE_LINE_OFFSET__ + 1 consoleLineIdx = __CONSOLE_LINE_OFFSET__ + 1
wrapLineIndex = 0 wrapLineIndex = 0
while consoleLineIdx < len(cmdBuffer) and __CONSOLE_RECT__[3] > (consoleLineIdx - __CONSOLE_LINE_OFFSET__) * __FONT_SIZES__[__FONT_SIZE__][1]: while consoleLineIdx < len(cmdBuffer) and __CONSOLE_RECT__[3] > (consoleLineIdx - __CONSOLE_LINE_OFFSET__) * FNT_HEIGHT:
if cmdBuffer[-consoleLineIdx].type == 0: if cmdBuffer[-consoleLineIdx].type == 0:
BGL.glColor3f(1, 1, 1) BGL.glColor3f(1, 1, 1)
elif cmdBuffer[-consoleLineIdx].type == 1: elif cmdBuffer[-consoleLineIdx].type == 1:
@@ -734,53 +737,41 @@ def draw_gui():
BGL.glColor3f(1, 1, 0) BGL.glColor3f(1, 1, 0)
if consoleLineIdx == 1: # user input if consoleLineIdx == 1: # user input
BGL.glRasterPos2i(margin, (__FONT_SIZES__[__FONT_SIZE__][1] * (consoleLineIdx-__CONSOLE_LINE_OFFSET__)) - 8) BGL.glRasterPos2i(margin, (FNT_HEIGHT * (consoleLineIdx-__CONSOLE_LINE_OFFSET__)) - 8)
Draw.Text(cmdBuffer[-consoleLineIdx].cmd, __FONT_SIZES__[__FONT_SIZE__][0]) Draw.Text(cmdBuffer[-consoleLineIdx].cmd, FNT_NAME)
else: else: # WRAP
BGL.glRasterPos2i(margin, (__FONT_SIZES__[__FONT_SIZE__][1] * ((consoleLineIdx-__CONSOLE_LINE_OFFSET__)+wrapLineIndex)) - 8) lwid = Draw.GetStringWidth(cmdBuffer[-consoleLineIdx].cmd, FNT_NAME)
Draw.Text(cmdBuffer[-consoleLineIdx].cmd, __FONT_SIZES__[__FONT_SIZE__][0]) if margin + lwid > __CONSOLE_RECT__[2]:
# Wrapping is totally slow, can even hang blender - dont do it!
'''
if consoleLineIdx == 1: # NEVER WRAP THE USER INPUT
BGL.glRasterPos2i(margin, (__FONT_SIZES__[__FONT_SIZE__][1] * (consoleLineIdx-__CONSOLE_LINE_OFFSET__)) - 8)
# BUG, LARGE TEXT DOSENT DISPLAY
Draw.Text(cmdBuffer[-consoleLineIdx].cmd, __FONT_SIZES__[__FONT_SIZE__][0])
else: # WRAP?
# LINE WRAP
if Draw.GetStringWidth(cmdBuffer[-consoleLineIdx].cmd, __FONT_SIZES__[__FONT_SIZE__][0]) > __CONSOLE_RECT__[2]:
wrapLineList = [] wrapLineList = []
copyCmd = [cmdBuffer[-consoleLineIdx].cmd, ''] wtext = cmdBuffer[-consoleLineIdx].cmd
while copyCmd != ['','']: wlimit = len(wtext)
while margin + Draw.GetStringWidth(copyCmd[0], __FONT_SIZES__[__FONT_SIZE__][0]) > __CONSOLE_RECT__[2]: chunksz = int(( __CONSOLE_RECT__[2] - margin ) / (lwid / len(wtext)))
#print copyCmd lstart = 0
copyCmd[1] = '%s%s'% (copyCmd[0][-1], copyCmd[1]) # Add the char on the end fsize = FNT_NAME
copyCmd[0] = copyCmd[0][:-1]# remove last chat while lstart < wlimit:
lend = min(lstart+chunksz,wlimit)
# Now we have copyCmd[0] at a good length we can print it. ttext = wtext[lstart:lend]
if copyCmd[0] != '': while lend < wlimit and Draw.GetStringWidth(ttext, fsize) + margin < __CONSOLE_RECT__[2]:
wrapLineList.append(copyCmd[0]) lend += 1
ttext = wtext[lstart:lend]
copyCmd[0]='' while lend > lstart+1 and Draw.GetStringWidth(ttext, fsize) + margin > __CONSOLE_RECT__[2]:
copyCmd = [copyCmd[1], copyCmd[0]] lend -= 1
ttext = wtext[lstart:lend]
wrapLineList.append(ttext)
lstart = lend
# Now we have a list of lines, draw them (OpenGLs reverse ordering requires this odd change) # Now we have a list of lines, draw them (OpenGLs reverse ordering requires this odd change)
wrapLineList.reverse() wrapLineList.reverse()
for wline in wrapLineList: for wline in wrapLineList:
BGL.glRasterPos2i(margin, (__FONT_SIZES__[__FONT_SIZE__][1]*((consoleLineIdx-__CONSOLE_LINE_OFFSET__) + wrapLineIndex)) - 8) BGL.glRasterPos2i(margin, (FNT_HEIGHT*((consoleLineIdx-__CONSOLE_LINE_OFFSET__) + wrapLineIndex)) - 8)
Draw.Text(wline, __FONT_SIZES__[__FONT_SIZE__][0]) Draw.Text(wline, FNT_NAME)
wrapLineIndex += 1 wrapLineIndex += 1
wrapLineIndex-=1 # otherwise we get a silly extra line. wrapLineIndex-=1 # otherwise we get a silly extra line.
else: # no wrapping. else: # no wrapping.
BGL.glRasterPos2i(margin, (__FONT_SIZES__[__FONT_SIZE__][1] * ((consoleLineIdx-__CONSOLE_LINE_OFFSET__)+wrapLineIndex)) - 8) BGL.glRasterPos2i(margin, (FNT_HEIGHT * ((consoleLineIdx-__CONSOLE_LINE_OFFSET__)+wrapLineIndex)) - 8)
Draw.Text(cmdBuffer[-consoleLineIdx].cmd, __FONT_SIZES__[__FONT_SIZE__][0]) Draw.Text(cmdBuffer[-consoleLineIdx].cmd, FNT_NAME)
'''
consoleLineIdx += 1 consoleLineIdx += 1
# This recieves the event index, call a function from here depending on the event. # This recieves the event index, call a function from here depending on the event.
def handle_button_event(evt): def handle_button_event(evt):

View File

@@ -4,7 +4,7 @@
Name: 'Envelope Symmetry' Name: 'Envelope Symmetry'
Blender: 234 Blender: 234
Group: 'Animation' Group: 'Animation'
Tooltip: 'Make envelope symetrical' Tooltip: 'Make envelope symmetrical'
""" """
__author__ = "Jonas Petersen" __author__ = "Jonas Petersen"

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +1,13 @@
#!BPY #!BPY
""" """
Name: 'Autodesk FBX (.fbx)...' Name: 'Autodesk FBX (.fbx)...'
Blender: 244 Blender: 249
Group: 'Export' Group: 'Export'
Tooltip: 'Selection to an ASCII Autodesk FBX ' Tooltip: 'Selection to an ASCII Autodesk FBX '
""" """
__author__ = "Campbell Barton" __author__ = "Campbell Barton"
__url__ = ['www.blender.org', 'blenderartists.org'] __url__ = ['www.blender.org', 'blenderartists.org']
__version__ = "1.1" __version__ = "1.2"
__bpydoc__ = """\ __bpydoc__ = """\
This script is an exporter to the FBX file format. This script is an exporter to the FBX file format.
@@ -93,8 +93,8 @@ def copy_images(dest_dir, textures):
dest_dir += Blender.sys.sep dest_dir += Blender.sys.sep
image_paths = set() image_paths = set()
for img in textures: for tex in textures:
image_paths.add(Blender.sys.expandpath(img.filename)) image_paths.add(Blender.sys.expandpath(tex.filename))
# Now copy images # Now copy images
copyCount = 0 copyCount = 0
@@ -157,14 +157,29 @@ def increment_string(t):
# todo - Disallow the name 'Scene' and 'blend_root' - it will bugger things up. # todo - Disallow the name 'Scene' and 'blend_root' - it will bugger things up.
def sane_name(data, dct): def sane_name(data, dct):
#if not data: return None #if not data: return None
name = data.name
if type(data)==tuple: # materials are paired up with images
data, other = data
use_other = True
else:
other = None
use_other = False
if data: name = data.name
else: name = None
orig_name = name
if other:
orig_name_other = other.name
name = '%s #%s' % (name, orig_name_other)
else:
orig_name_other = None
# dont cache, only ever call once for each data type now, # dont cache, only ever call once for each data type now,
# so as to avoid namespace collision between types - like with objects <-> bones # so as to avoid namespace collision between types - like with objects <-> bones
#try: return dct[name] #try: return dct[name]
#except: pass #except: pass
orig_name = name
if not name: if not name:
name = 'unnamed' # blank string, ASKING FOR TROUBLE! name = 'unnamed' # blank string, ASKING FOR TROUBLE!
else: else:
@@ -173,7 +188,11 @@ def sane_name(data, dct):
while name in dct.itervalues(): name = increment_string(name) while name in dct.itervalues(): name = increment_string(name)
dct[orig_name] = name if use_other: # even if other is None - orig_name_other will be a string or None
dct[orig_name, orig_name_other] = name
else:
dct[orig_name] = name
return name return name
def sane_obname(data): return sane_name(data, sane_name_mapping_ob) def sane_obname(data): return sane_name(data, sane_name_mapping_ob)
@@ -511,7 +530,7 @@ def write(filename, batch_objects = None, \
if time: if time:
curtime = time.localtime()[0:6] curtime = time.localtime()[0:6]
else: else:
curtime = [0,0,0,0,0,0] curtime = (0,0,0,0,0,0)
# #
file.write(\ file.write(\
'''FBXHeaderExtension: { '''FBXHeaderExtension: {
@@ -983,7 +1002,7 @@ def write(filename, batch_objects = None, \
#eDIRECTIONAL #eDIRECTIONAL
#eSPOT #eSPOT
light_type = light.type light_type = light.type
if light_type > 3: light_type = 0 if light_type > 2: light_type = 1 # hemi and area lights become directional
mode = light.mode mode = light.mode
if mode & Blender.Lamp.Modes.RayShadow or mode & Blender.Lamp.Modes.Shadows: if mode & Blender.Lamp.Modes.RayShadow or mode & Blender.Lamp.Modes.Shadows:
@@ -1333,17 +1352,20 @@ def write(filename, batch_objects = None, \
me = my_mesh.blenData me = my_mesh.blenData
# if there are non NULL materials on this mesh # if there are non NULL materials on this mesh
if [mat for mat in my_mesh.blenMaterials if mat]: do_materials = True if my_mesh.blenMaterials: do_materials = True
else: do_materials = False else: do_materials = False
if my_mesh.blenTextures: do_textures = True if my_mesh.blenTextures: do_textures = True
else: do_textures = False else: do_textures = False
do_uvs = me.faceUV
file.write('\n\tModel: "Model::%s", "Mesh" {' % my_mesh.fbxName) file.write('\n\tModel: "Model::%s", "Mesh" {' % my_mesh.fbxName)
file.write('\n\t\tVersion: 232') # newline is added in write_object_props file.write('\n\t\tVersion: 232') # newline is added in write_object_props
write_object_props(my_mesh.blenObject, None, my_mesh.parRelMatrix()) poseMatrix = write_object_props(my_mesh.blenObject, None, my_mesh.parRelMatrix())[3]
pose_items.append((my_mesh.fbxName, poseMatrix))
file.write('\n\t\t}') file.write('\n\t\t}')
file.write('\n\t\tMultiLayer: 0') file.write('\n\t\tMultiLayer: 0')
@@ -1385,22 +1407,18 @@ def write(filename, batch_objects = None, \
else: file.write(',%i,%i,%i,%i' % fi ) else: file.write(',%i,%i,%i,%i' % fi )
i+=1 i+=1
ed_val = [None, None] file.write('\n\t\tEdges: ')
LOOSE = Blender.Mesh.EdgeFlags.LOOSE i=-1
for ed in me.edges: for ed in me.edges:
if ed.flag & LOOSE:
ed_val[0] = ed.v1.index
ed_val[1] = -(ed.v2.index+1)
if i==-1: if i==-1:
file.write('%i,%i' % tuple(ed_val) ) file.write('%i,%i' % (ed.v1.index, ed.v2.index))
i=0 i=0
else: else:
if i==13: if i==13:
file.write('\n\t\t') file.write('\n\t\t')
i=0 i=0
file.write(',%i,%i' % tuple(ed_val) ) file.write(',%i,%i' % (ed.v1.index, ed.v2.index))
i+=1 i+=1
del LOOSE
file.write('\n\t\tGeometryVersion: 124') file.write('\n\t\tGeometryVersion: 124')
@@ -1423,6 +1441,51 @@ def write(filename, batch_objects = None, \
i+=1 i+=1
file.write('\n\t\t}') file.write('\n\t\t}')
# Write Face Smoothing
file.write('''
LayerElementSmoothing: 0 {
Version: 102
Name: ""
MappingInformationType: "ByPolygon"
ReferenceInformationType: "Direct"
Smoothing: ''')
i=-1
for f in me.faces:
if i==-1:
file.write('%i' % f.smooth); i=0
else:
if i==54:
file.write('\n '); i=0
file.write(',%i' % f.smooth)
i+=1
file.write('\n\t\t}')
# Write Edge Smoothing
file.write('''
LayerElementSmoothing: 0 {
Version: 101
Name: ""
MappingInformationType: "ByEdge"
ReferenceInformationType: "Direct"
Smoothing: ''')
SHARP = Blender.Mesh.EdgeFlags.SHARP
i=-1
for ed in me.edges:
if i==-1:
file.write('%i' % ((ed.flag&SHARP)!=0)); i=0
else:
if i==54:
file.write('\n '); i=0
file.write(',%i' % ((ed.flag&SHARP)!=0))
i+=1
file.write('\n\t\t}')
del SHARP
# Write VertexColor Layers # Write VertexColor Layers
# note, no programs seem to use this info :/ # note, no programs seem to use this info :/
collayers = [] collayers = []
@@ -1475,7 +1538,7 @@ def write(filename, batch_objects = None, \
# Write UV and texture layers. # Write UV and texture layers.
uvlayers = [] uvlayers = []
if me.faceUV: if do_uvs:
uvlayers = me.getUVLayerNames() uvlayers = me.getUVLayerNames()
uvlayer_orig = me.activeUVLayer uvlayer_orig = me.activeUVLayer
for uvindex, uvlayer in enumerate(uvlayers): for uvindex, uvlayer in enumerate(uvlayers):
@@ -1538,13 +1601,13 @@ def write(filename, batch_objects = None, \
if len(my_mesh.blenTextures) == 1: if len(my_mesh.blenTextures) == 1:
file.write('0') file.write('0')
else: else:
#texture_mapping_local = {None:0}
texture_mapping_local = {None:-1} texture_mapping_local = {None:-1}
i = 0 # 1 for dummy i = 0 # 1 for dummy
for tex in my_mesh.blenTextures: for tex in my_mesh.blenTextures:
texture_mapping_local[tex] = i if tex: # None is set above
i+=1 texture_mapping_local[tex] = i
i+=1
i=-1 i=-1
for f in me.faces: for f in me.faces:
@@ -1594,32 +1657,32 @@ def write(filename, batch_objects = None, \
file.write('0') file.write('0')
else: else:
# Build a material mapping for this # Build a material mapping for this
#material_mapping_local = [0] * 16 # local-index : global index. material_mapping_local = {} # local-mat & tex : global index.
material_mapping_local = [-1] * 16 # local-index : global index.
i= 0 # 1 for j, mat_tex_pair in enumerate(my_mesh.blenMaterials):
for j, mat in enumerate(my_mesh.blenMaterials): material_mapping_local[mat_tex_pair] = j
if mat:
material_mapping_local[j] = i
i+=1
# else leave as -1
len_material_mapping_local = len(material_mapping_local) len_material_mapping_local = len(material_mapping_local)
mats = my_mesh.blenMaterialList
i=-1 i=-1
for f in me.faces: for f in me.faces:
f_mat = f.mat try: mat = mats[f.mat]
if f_mat >= len_material_mapping_local: except:mat = None
f_mat = 0
if do_uvs: tex = f.image # WARNING - MULTI UV LAYER IMAGES NOT SUPPORTED :/
else: tex = None
if i==-1: if i==-1:
i=0 i=0
file.write( '%s' % (material_mapping_local[f_mat])) file.write( '%s' % (material_mapping_local[mat, tex])) # None for mat or tex is ok
else: else:
if i==55: if i==55:
file.write('\n\t\t\t\t') file.write('\n\t\t\t\t')
i=0 i=0
file.write(',%s' % (material_mapping_local[f_mat])) file.write(',%s' % (material_mapping_local[mat, tex]))
i+=1 i+=1
file.write('\n\t\t}') file.write('\n\t\t}')
@@ -1654,7 +1717,7 @@ def write(filename, batch_objects = None, \
TypedIndex: 0 TypedIndex: 0
}''') }''')
if me.faceUV: if do_uvs: # same as me.faceUV
file.write(''' file.write('''
LayerElement: { LayerElement: {
Type: "LayerElementUV" Type: "LayerElementUV"
@@ -1736,8 +1799,8 @@ def write(filename, batch_objects = None, \
ob_all_typegroups = [ob_meshes, ob_lights, ob_cameras, ob_arms, ob_null] ob_all_typegroups = [ob_meshes, ob_lights, ob_cameras, ob_arms, ob_null]
groups = [] # blender groups, only add ones that have objects in the selections groups = [] # blender groups, only add ones that have objects in the selections
materials = {} materials = {} # (mat, image) keys, should be a set()
textures = {} textures = {} # should be a set()
tmp_ob_type = ob_type = None # incase no objects are exported, so as not to raise an error tmp_ob_type = ob_type = None # incase no objects are exported, so as not to raise an error
@@ -1837,30 +1900,34 @@ def write(filename, batch_objects = None, \
if EXP_MESH_HQ_NORMALS: if EXP_MESH_HQ_NORMALS:
BPyMesh.meshCalcNormals(me) # high quality normals nice for realtime engines. BPyMesh.meshCalcNormals(me) # high quality normals nice for realtime engines.
for mat in mats:
# 2.44 use mat.lib too for uniqueness
if mat: materials[mat] = mat
texture_mapping_local = {} texture_mapping_local = {}
material_mapping_local = {}
if me.faceUV: if me.faceUV:
uvlayer_orig = me.activeUVLayer uvlayer_orig = me.activeUVLayer
for uvlayer in me.getUVLayerNames(): for uvlayer in me.getUVLayerNames():
me.activeUVLayer = uvlayer me.activeUVLayer = uvlayer
for f in me.faces: for f in me.faces:
img = f.image tex = f.image
textures[img] = texture_mapping_local[img] = img textures[tex] = texture_mapping_local[tex] = None
try: mat = mats[f.mat]
except: mat = None
materials[mat, tex] = material_mapping_local[mat, tex] = None # should use sets, wait for blender 2.5
me.activeUVLayer = uvlayer_orig me.activeUVLayer = uvlayer_orig
else:
for mat in mats:
# 2.44 use mat.lib too for uniqueness
materials[mat, None] = material_mapping_local[mat, None] = None
else:
materials[None, None] = None
if EXP_ARMATURE: if EXP_ARMATURE:
armob = BPyObject.getObjectArmature(ob) armob = BPyObject.getObjectArmature(ob)
blenParentBoneName = None blenParentBoneName = None
# Note - Fixed in BPyObject but for now just copy the function because testers wont have up to date modukes,
# TODO - remove this for 2.45 release since getObjectArmature has been fixed
if (not armob) and ob.parent and ob.parent.type == 'Armature' and ob.parentType == Blender.Object.ParentTypes.ARMATURE:
armob = ob.parent
# parent bone - special case # parent bone - special case
if (not armob) and ob.parent and ob.parent.type == 'Armature' and ob.parentType == Blender.Object.ParentTypes.BONE: if (not armob) and ob.parent and ob.parent.type == 'Armature' and ob.parentType == Blender.Object.ParentTypes.BONE:
armob = ob.parent armob = ob.parent
@@ -1876,8 +1943,9 @@ def write(filename, batch_objects = None, \
my_mesh = my_object_generic(ob, mtx) my_mesh = my_object_generic(ob, mtx)
my_mesh.blenData = me my_mesh.blenData = me
my_mesh.origData = origData my_mesh.origData = origData
my_mesh.blenMaterials = mats my_mesh.blenMaterials = material_mapping_local.keys()
my_mesh.blenTextures = texture_mapping_local.values() my_mesh.blenMaterialList = mats
my_mesh.blenTextures = texture_mapping_local.keys()
# if only 1 null texture then empty the list # if only 1 null texture then empty the list
if len(my_mesh.blenTextures) == 1 and my_mesh.blenTextures[0] == None: if len(my_mesh.blenTextures) == 1 and my_mesh.blenTextures[0] == None:
@@ -1996,8 +2064,8 @@ def write(filename, batch_objects = None, \
# Finished finding groups we use # Finished finding groups we use
materials = [(sane_matname(mat), mat) for mat in materials.itervalues() if mat] materials = [(sane_matname(mat_tex_pair), mat_tex_pair) for mat_tex_pair in materials.iterkeys()]
textures = [(sane_texname(img), img) for img in textures.itervalues() if img] textures = [(sane_texname(tex), tex) for tex in textures.iterkeys() if tex]
materials.sort() # sort by name materials.sort() # sort by name
textures.sort() textures.sort()
@@ -2126,8 +2194,8 @@ Objects: {''')
write_camera_default() write_camera_default()
for matname, mat in materials: for matname, (mat, tex) in materials:
write_material(matname, mat) write_material(matname, mat) # We only need to have a material per image pair, but no need to write any image info into the material (dumb fbx standard)
# each texture uses a video, odd # each texture uses a video, odd
for texname, tex in textures: for texname, tex in textures:
@@ -2247,7 +2315,7 @@ Relations: {''')
Model: "Model::Camera Switcher", "CameraSwitcher" { Model: "Model::Camera Switcher", "CameraSwitcher" {
}''') }''')
for matname, mat in materials: for matname, (mat, tex) in materials:
file.write('\n\tMaterial: "Material::%s", "" {\n\t}' % matname) file.write('\n\tMaterial: "Material::%s", "" {\n\t}' % matname)
if textures: if textures:
@@ -2299,9 +2367,14 @@ Connections: {''')
if materials: if materials:
for my_mesh in ob_meshes: for my_mesh in ob_meshes:
# Connect all materials to all objects, not good form but ok for now. # Connect all materials to all objects, not good form but ok for now.
for mat in my_mesh.blenMaterials: for mat, tex in my_mesh.blenMaterials:
if mat: if mat: mat_name = mat.name
file.write('\n\tConnect: "OO", "Material::%s", "Model::%s"' % (sane_name_mapping_mat[mat.name], my_mesh.fbxName)) else: mat_name = None
if tex: tex_name = tex.name
else: tex_name = None
file.write('\n\tConnect: "OO", "Material::%s", "Model::%s"' % (sane_name_mapping_mat[mat_name, tex_name], my_mesh.fbxName))
if textures: if textures:
for my_mesh in ob_meshes: for my_mesh in ob_meshes:
@@ -2519,8 +2592,18 @@ Takes: {''')
for TX_LAYER, TX_CHAN in enumerate('TRS'): # transform, rotate, scale for TX_LAYER, TX_CHAN in enumerate('TRS'): # transform, rotate, scale
if TX_CHAN=='T': context_bone_anim_vecs = [mtx[0].translationPart() for mtx in context_bone_anim_mats] if TX_CHAN=='T': context_bone_anim_vecs = [mtx[0].translationPart() for mtx in context_bone_anim_mats]
elif TX_CHAN=='R': context_bone_anim_vecs = [mtx[1].toEuler() for mtx in context_bone_anim_mats] elif TX_CHAN=='S': context_bone_anim_vecs = [mtx[0].scalePart() for mtx in context_bone_anim_mats]
else: context_bone_anim_vecs = [mtx[0].scalePart() for mtx in context_bone_anim_mats] elif TX_CHAN=='R':
# Was....
# elif TX_CHAN=='R': context_bone_anim_vecs = [mtx[1].toEuler() for mtx in context_bone_anim_mats]
#
# ...but we need to use the previous euler for compatible conversion.
context_bone_anim_vecs = []
prev_eul = None
for mtx in context_bone_anim_mats:
if prev_eul: prev_eul = mtx[1].toEuler(prev_eul)
else: prev_eul = mtx[1].toEuler()
context_bone_anim_vecs.append(prev_eul)
file.write('\n\t\t\t\tChannel: "%s" {' % TX_CHAN) # translation file.write('\n\t\t\t\tChannel: "%s" {' % TX_CHAN) # translation
@@ -2539,10 +2622,9 @@ Takes: {''')
if frame!=act_start: if frame!=act_start:
file.write(',') file.write(',')
# Curve types are # Curve types are 'C,n' for constant, 'L' for linear
# C,n is for bezier? - linear is best for now so we can do simple keyframe removal # C,n is for bezier? - linear is best for now so we can do simple keyframe removal
file.write('\n\t\t\t\t\t\t\t%i,%.15f,C,n' % (fbx_time(frame-1), context_bone_anim_vecs[frame-act_start][i] )) file.write('\n\t\t\t\t\t\t\t%i,%.15f,L' % (fbx_time(frame-1), context_bone_anim_vecs[frame-act_start][i] ))
#file.write('\n\t\t\t\t\t\t\t%i,%.15f,L' % (fbx_time(frame-1), context_bone_anim_vecs[frame-act_start][i] ))
frame+=1 frame+=1
else: else:
# remove unneeded keys, j is the frame, needed when some frames are removed. # remove unneeded keys, j is the frame, needed when some frames are removed.
@@ -2550,11 +2632,32 @@ Takes: {''')
# last frame to fisrt frame, missing 1 frame on either side. # last frame to fisrt frame, missing 1 frame on either side.
# removeing in a backwards loop is faster # removeing in a backwards loop is faster
for j in xrange( (act_end-act_start)-1, 0, -1 ): #for j in xrange( (act_end-act_start)-1, 0, -1 ):
# Is this key reduenant? # j = (act_end-act_start)-1
if abs(context_bone_anim_keys[j][0] - context_bone_anim_keys[j-1][0]) < ANIM_OPTIMIZE_PRECISSION_FLOAT and\ j = len(context_bone_anim_keys)-2
abs(context_bone_anim_keys[j][0] - context_bone_anim_keys[j+1][0]) < ANIM_OPTIMIZE_PRECISSION_FLOAT: while j > 0 and len(context_bone_anim_keys) > 2:
# print j, len(context_bone_anim_keys)
# Is this key the same as the ones next to it?
# co-linear horizontal...
if abs(context_bone_anim_keys[j][0] - context_bone_anim_keys[j-1][0]) < ANIM_OPTIMIZE_PRECISSION_FLOAT and\
abs(context_bone_anim_keys[j][0] - context_bone_anim_keys[j+1][0]) < ANIM_OPTIMIZE_PRECISSION_FLOAT:
del context_bone_anim_keys[j] del context_bone_anim_keys[j]
else:
frame_range = float(context_bone_anim_keys[j+1][1] - context_bone_anim_keys[j-1][1])
frame_range_fac1 = (context_bone_anim_keys[j+1][1] - context_bone_anim_keys[j][1]) / frame_range
frame_range_fac2 = 1.0 - frame_range_fac1
if abs(((context_bone_anim_keys[j-1][0]*frame_range_fac1 + context_bone_anim_keys[j+1][0]*frame_range_fac2)) - context_bone_anim_keys[j][0]) < ANIM_OPTIMIZE_PRECISSION_FLOAT:
del context_bone_anim_keys[j]
else:
j-=1
# keep the index below the list length
if j > len(context_bone_anim_keys)-2:
j = len(context_bone_anim_keys)-2
if len(context_bone_anim_keys) == 2 and context_bone_anim_keys[0][0] == context_bone_anim_keys[1][0]: if len(context_bone_anim_keys) == 2 and context_bone_anim_keys[0][0] == context_bone_anim_keys[1][0]:
# This axis has no moton, its okay to skip KeyCount and Keys in this case # This axis has no moton, its okay to skip KeyCount and Keys in this case
@@ -2567,8 +2670,7 @@ Takes: {''')
if frame != context_bone_anim_keys[0][1]: # not the first if frame != context_bone_anim_keys[0][1]: # not the first
file.write(',') file.write(',')
# frame is alredy one less then blenders frame # frame is alredy one less then blenders frame
file.write('\n\t\t\t\t\t\t\t%i,%.15f,C,n' % (fbx_time(frame), val )) file.write('\n\t\t\t\t\t\t\t%i,%.15f,L' % (fbx_time(frame), val ))
#file.write('\n\t\t\t\t\t\t\t%i,%.15f,L' % (fbx_time(frame), val ))
if i==0: file.write('\n\t\t\t\t\t\tColor: 1,0,0') if i==0: file.write('\n\t\t\t\t\t\tColor: 1,0,0')
elif i==1: file.write('\n\t\t\t\t\t\tColor: 0,1,0') elif i==1: file.write('\n\t\t\t\t\t\tColor: 0,1,0')
@@ -2734,15 +2836,16 @@ def fbx_ui_exit(e,v):
GLOBALS['EVENT'] = e GLOBALS['EVENT'] = e
def do_help(e,v): def do_help(e,v):
url = 'http://wiki.blender.org/index.php/Scripts/Manual/Export/autodesk_fbx' url = 'http://wiki.blender.org/index.php/Scripts/Manual/Export/autodesk_fbx'
print 'Trying to open web browser with documentation at this address...' print 'Trying to open web browser with documentation at this address...'
print '\t' + url print '\t' + url
try: try:
import webbrowser import webbrowser
webbrowser.open(url) webbrowser.open(url)
except: except:
print '...could not open a browser window.' Blender.Draw.PupMenu("Error%t|Opening a webbrowser requires a full python installation")
print '...could not open a browser window.'
@@ -2846,7 +2949,7 @@ def fbx_ui():
Draw.BeginAlign() Draw.BeginAlign()
GLOBALS['ANIM_OPTIMIZE'] = Draw.Toggle('Optimize Keyframes', EVENT_REDRAW, x+20, y+0, 160, 20, GLOBALS['ANIM_OPTIMIZE'].val, 'Remove double keyframes', do_redraw) GLOBALS['ANIM_OPTIMIZE'] = Draw.Toggle('Optimize Keyframes', EVENT_REDRAW, x+20, y+0, 160, 20, GLOBALS['ANIM_OPTIMIZE'].val, 'Remove double keyframes', do_redraw)
if GLOBALS['ANIM_OPTIMIZE'].val: if GLOBALS['ANIM_OPTIMIZE'].val:
GLOBALS['ANIM_OPTIMIZE_PRECISSION'] = Draw.Number('Precission: ', EVENT_NONE, x+180, y+0, 160, 20, GLOBALS['ANIM_OPTIMIZE_PRECISSION'].val, 3, 16, 'Tolerence for comparing double keyframes (higher for greater accuracy)') GLOBALS['ANIM_OPTIMIZE_PRECISSION'] = Draw.Number('Precission: ', EVENT_NONE, x+180, y+0, 160, 20, GLOBALS['ANIM_OPTIMIZE_PRECISSION'].val, 1, 16, 'Tolerence for comparing double keyframes (higher for greater accuracy)')
Draw.EndAlign() Draw.EndAlign()
Draw.BeginAlign() Draw.BeginAlign()
@@ -2924,7 +3027,7 @@ def write_ui():
# animation opts # animation opts
GLOBALS['ANIM_ENABLE'] = Draw.Create(1) GLOBALS['ANIM_ENABLE'] = Draw.Create(1)
GLOBALS['ANIM_OPTIMIZE'] = Draw.Create(1) GLOBALS['ANIM_OPTIMIZE'] = Draw.Create(1)
GLOBALS['ANIM_OPTIMIZE_PRECISSION'] = Draw.Create(6) # decimal places GLOBALS['ANIM_OPTIMIZE_PRECISSION'] = Draw.Create(4) # decimal places
GLOBALS['ANIM_ACTION_ALL'] = [Draw.Create(0), Draw.Create(1)] # not just the current action GLOBALS['ANIM_ACTION_ALL'] = [Draw.Create(0), Draw.Create(1)] # not just the current action
# batch export options # batch export options

View File

@@ -7,9 +7,9 @@ Group: 'Export'
Tooltip: 'Save a Wavefront OBJ File' Tooltip: 'Save a Wavefront OBJ File'
""" """
__author__ = "Campbell Barton, Jiri Hnidek" __author__ = "Campbell Barton, Jiri Hnidek, Paolo Ciccone"
__url__ = ['http://wiki.blender.org/index.php/Scripts/Manual/Export/wavefront_obj', 'www.blender.org', 'blenderartists.org'] __url__ = ['http://wiki.blender.org/index.php/Scripts/Manual/Export/wavefront_obj', 'www.blender.org', 'blenderartists.org']
__version__ = "1.2" __version__ = "1.21"
__bpydoc__ = """\ __bpydoc__ = """\
This script is an exporter to OBJ file format. This script is an exporter to OBJ file format.
@@ -185,7 +185,8 @@ def write(filename, objects,\
EXPORT_TRI=False, EXPORT_EDGES=False, EXPORT_NORMALS=False, EXPORT_NORMALS_HQ=False,\ EXPORT_TRI=False, EXPORT_EDGES=False, EXPORT_NORMALS=False, EXPORT_NORMALS_HQ=False,\
EXPORT_UV=True, EXPORT_MTL=True, EXPORT_COPY_IMAGES=False,\ EXPORT_UV=True, EXPORT_MTL=True, EXPORT_COPY_IMAGES=False,\
EXPORT_APPLY_MODIFIERS=True, EXPORT_ROTX90=True, EXPORT_BLEN_OBS=True,\ EXPORT_APPLY_MODIFIERS=True, EXPORT_ROTX90=True, EXPORT_BLEN_OBS=True,\
EXPORT_GROUP_BY_OB=False, EXPORT_GROUP_BY_MAT=False, EXPORT_KEEP_VERT_ORDER=False): EXPORT_GROUP_BY_OB=False, EXPORT_GROUP_BY_MAT=False, EXPORT_KEEP_VERT_ORDER=False,\
EXPORT_POLYGROUPS=False):
''' '''
Basic write function. The context and options must be alredy set Basic write function. The context and options must be alredy set
This can be accessed externaly This can be accessed externaly
@@ -199,6 +200,29 @@ EXPORT_GROUP_BY_OB=False, EXPORT_GROUP_BY_MAT=False, EXPORT_KEEP_VERT_ORDER=Fal
def veckey2d(v): def veckey2d(v):
return round(v.x, 6), round(v.y, 6) return round(v.x, 6), round(v.y, 6)
def findVertexGroupName(face, vWeightMap):
"""
Searches the vertexDict to see what groups is assigned to a given face.
We use a frequency system in order to sort out the name because a given vetex can
belong to two or more groups at the same time. To find the right name for the face
we list all the possible vertex group names with their frequency and then sort by
frequency in descend order. The top element is the one shared by the highest number
of vertices is the face's group
"""
weightDict = {}
for vert in face:
vWeights = vWeightMap[vert.index]
for vGroupName, weight in vWeights:
weightDict[vGroupName] = weightDict.get(vGroupName, 0) + weight
if weightDict:
alist = [(weight,vGroupName) for vGroupName, weight in weightDict.iteritems()] # sort least to greatest amount of weight
alist.sort()
return(alist[-1][1]) # highest value last
else:
return '(null)'
print 'OBJ Export path: "%s"' % filename print 'OBJ Export path: "%s"' % filename
temp_mesh_name = '~tmp-mesh' temp_mesh_name = '~tmp-mesh'
@@ -239,12 +263,12 @@ EXPORT_GROUP_BY_OB=False, EXPORT_GROUP_BY_MAT=False, EXPORT_KEEP_VERT_ORDER=Fal
globalNormals = {} globalNormals = {}
# Get all meshs # Get all meshes
for ob_main in objects: for ob_main in objects:
for ob, ob_mat in BPyObject.getDerivedObjects(ob_main): for ob, ob_mat in BPyObject.getDerivedObjects(ob_main):
# Will work for non meshes now! :) # Will work for non meshes now! :)
# getMeshFromObject(ob, container_mesh=None, apply_modifiers=True, vgroups=True, scn=None) # getMeshFromObject(ob, container_mesh=None, apply_modifiers=True, vgroups=True, scn=None)
me= BPyMesh.getMeshFromObject(ob, containerMesh, EXPORT_APPLY_MODIFIERS, False, scn) me= BPyMesh.getMeshFromObject(ob, containerMesh, EXPORT_APPLY_MODIFIERS, EXPORT_POLYGROUPS, scn)
if not me: if not me:
continue continue
@@ -397,6 +421,17 @@ EXPORT_GROUP_BY_OB=False, EXPORT_GROUP_BY_MAT=False, EXPORT_KEEP_VERT_ORDER=Fal
if not faceuv: if not faceuv:
f_image = None f_image = None
if EXPORT_POLYGROUPS:
# Retrieve the list of vertex groups
vertGroupNames = me.getVertGroupNames()
currentVGroup = ''
# Create a dictionary keyed by face id and listing, for each vertex, the vertex groups it belongs to
vgroupsMap = [[] for _i in xrange(len(me.verts))]
for vertexGroupName in vertGroupNames:
for vIdx, vWeight in me.getVertsFromGroup(vertexGroupName, 1):
vgroupsMap[vIdx].append((vertexGroupName, vWeight))
for f_index, f in enumerate(faces): for f_index, f in enumerate(faces):
f_v= f.v f_v= f.v
f_smooth= f.smooth f_smooth= f.smooth
@@ -411,9 +446,18 @@ EXPORT_GROUP_BY_OB=False, EXPORT_GROUP_BY_MAT=False, EXPORT_KEEP_VERT_ORDER=Fal
else: else:
key = materialNames[f_mat], None # No image, use None instead. key = materialNames[f_mat], None # No image, use None instead.
# Write the vertex group
if EXPORT_POLYGROUPS:
if vertGroupNames:
# find what vertext group the face belongs to
theVGroup = findVertexGroupName(f,vgroupsMap)
if theVGroup != currentVGroup:
currentVGroup = theVGroup
file.write('g %s\n' % theVGroup)
# CHECK FOR CONTEXT SWITCH # CHECK FOR CONTEXT SWITCH
if key == contextMat: if key == contextMat:
pass # Context alredy switched, dont do anythoing pass # Context alredy switched, dont do anything
else: else:
if key[0] == None and key[1] == None: if key[0] == None and key[1] == None:
# Write a null material, since we know the context has changed. # Write a null material, since we know the context has changed.
@@ -438,6 +482,7 @@ EXPORT_GROUP_BY_OB=False, EXPORT_GROUP_BY_MAT=False, EXPORT_KEEP_VERT_ORDER=Fal
if EXPORT_GROUP_BY_MAT: if EXPORT_GROUP_BY_MAT:
file.write('g %s_%s_%s\n' % (fixName(ob.name), fixName(ob.getData(1)), mat_data[0]) ) # can be mat_image or (null) file.write('g %s_%s_%s\n' % (fixName(ob.name), fixName(ob.getData(1)), mat_data[0]) ) # can be mat_image or (null)
file.write('usemtl %s\n' % mat_data[0]) # can be mat_image or (null) file.write('usemtl %s\n' % mat_data[0]) # can be mat_image or (null)
contextMat = key contextMat = key
@@ -539,7 +584,8 @@ def write_ui(filename):
EXPORT_NORMALS, EXPORT_NORMALS_HQ, EXPORT_UV,\ EXPORT_NORMALS, EXPORT_NORMALS_HQ, EXPORT_UV,\
EXPORT_MTL, EXPORT_SEL_ONLY, EXPORT_ALL_SCENES,\ EXPORT_MTL, EXPORT_SEL_ONLY, EXPORT_ALL_SCENES,\
EXPORT_ANIMATION, EXPORT_COPY_IMAGES, EXPORT_BLEN_OBS,\ EXPORT_ANIMATION, EXPORT_COPY_IMAGES, EXPORT_BLEN_OBS,\
EXPORT_GROUP_BY_OB, EXPORT_GROUP_BY_MAT, EXPORT_KEEP_VERT_ORDER EXPORT_GROUP_BY_OB, EXPORT_GROUP_BY_MAT, EXPORT_KEEP_VERT_ORDER,\
EXPORT_POLYGROUPS
EXPORT_APPLY_MODIFIERS = Draw.Create(0) EXPORT_APPLY_MODIFIERS = Draw.Create(0)
EXPORT_ROTX90 = Draw.Create(1) EXPORT_ROTX90 = Draw.Create(1)
@@ -557,6 +603,8 @@ def write_ui(filename):
EXPORT_GROUP_BY_OB = Draw.Create(0) EXPORT_GROUP_BY_OB = Draw.Create(0)
EXPORT_GROUP_BY_MAT = Draw.Create(0) EXPORT_GROUP_BY_MAT = Draw.Create(0)
EXPORT_KEEP_VERT_ORDER = Draw.Create(1) EXPORT_KEEP_VERT_ORDER = Draw.Create(1)
EXPORT_POLYGROUPS = Draw.Create(0)
# Old UI # Old UI
''' '''
@@ -607,7 +655,7 @@ def write_ui(filename):
GLOBALS['EVENT'] = e GLOBALS['EVENT'] = e
def do_split(e,v): def do_split(e,v):
global EXPORT_BLEN_OBS, EXPORT_GROUP_BY_OB, EXPORT_GROUP_BY_MAT, EXPORT_APPLY_MODIFIERS, KEEP_VERT_ORDER global EXPORT_BLEN_OBS, EXPORT_GROUP_BY_OB, EXPORT_GROUP_BY_MAT, EXPORT_APPLY_MODIFIERS, KEEP_VERT_ORDER, EXPORT_POLYGROUPS
if EXPORT_BLEN_OBS.val or EXPORT_GROUP_BY_OB.val or EXPORT_GROUP_BY_MAT.val or EXPORT_APPLY_MODIFIERS.val: if EXPORT_BLEN_OBS.val or EXPORT_GROUP_BY_OB.val or EXPORT_GROUP_BY_MAT.val or EXPORT_APPLY_MODIFIERS.val:
EXPORT_KEEP_VERT_ORDER.val = 0 EXPORT_KEEP_VERT_ORDER.val = 0
else: else:
@@ -621,6 +669,7 @@ def write_ui(filename):
if not (EXPORT_BLEN_OBS.val or EXPORT_GROUP_BY_OB.val or EXPORT_GROUP_BY_MAT.val or EXPORT_APPLY_MODIFIERS.val): if not (EXPORT_BLEN_OBS.val or EXPORT_GROUP_BY_OB.val or EXPORT_GROUP_BY_MAT.val or EXPORT_APPLY_MODIFIERS.val):
EXPORT_KEEP_VERT_ORDER.val = 1 EXPORT_KEEP_VERT_ORDER.val = 1
def do_help(e,v): def do_help(e,v):
url = __url__[0] url = __url__[0]
print 'Trying to open web browser with documentation at this address...' print 'Trying to open web browser with documentation at this address...'
@@ -637,43 +686,45 @@ def write_ui(filename):
# Center based on overall pup size # Center based on overall pup size
ui_x -= 165 ui_x -= 165
ui_y -= 110 ui_y -= 140
global EXPORT_APPLY_MODIFIERS, EXPORT_ROTX90, EXPORT_TRI, EXPORT_EDGES,\ global EXPORT_APPLY_MODIFIERS, EXPORT_ROTX90, EXPORT_TRI, EXPORT_EDGES,\
EXPORT_NORMALS, EXPORT_NORMALS_HQ, EXPORT_UV,\ EXPORT_NORMALS, EXPORT_NORMALS_HQ, EXPORT_UV,\
EXPORT_MTL, EXPORT_SEL_ONLY, EXPORT_ALL_SCENES,\ EXPORT_MTL, EXPORT_SEL_ONLY, EXPORT_ALL_SCENES,\
EXPORT_ANIMATION, EXPORT_COPY_IMAGES, EXPORT_BLEN_OBS,\ EXPORT_ANIMATION, EXPORT_COPY_IMAGES, EXPORT_BLEN_OBS,\
EXPORT_GROUP_BY_OB, EXPORT_GROUP_BY_MAT, EXPORT_KEEP_VERT_ORDER EXPORT_GROUP_BY_OB, EXPORT_GROUP_BY_MAT, EXPORT_KEEP_VERT_ORDER,\
EXPORT_POLYGROUPS
Draw.Label('Context...', ui_x+9, ui_y+209, 220, 20) Draw.Label('Context...', ui_x+9, ui_y+239, 220, 20)
Draw.BeginAlign() Draw.BeginAlign()
EXPORT_SEL_ONLY = Draw.Toggle('Selection Only', EVENT_NONE, ui_x+9, ui_y+189, 110, 20, EXPORT_SEL_ONLY.val, 'Only export objects in visible selection. Else export whole scene.') EXPORT_SEL_ONLY = Draw.Toggle('Selection Only', EVENT_NONE, ui_x+9, ui_y+219, 110, 20, EXPORT_SEL_ONLY.val, 'Only export objects in visible selection. Else export whole scene.')
EXPORT_ALL_SCENES = Draw.Toggle('All Scenes', EVENT_NONE, ui_x+119, ui_y+189, 110, 20, EXPORT_ALL_SCENES.val, 'Each scene as a separate OBJ file.') EXPORT_ALL_SCENES = Draw.Toggle('All Scenes', EVENT_NONE, ui_x+119, ui_y+219, 110, 20, EXPORT_ALL_SCENES.val, 'Each scene as a separate OBJ file.')
EXPORT_ANIMATION = Draw.Toggle('Animation', EVENT_NONE, ui_x+229, ui_y+189, 110, 20, EXPORT_ANIMATION.val, 'Each frame as a numbered OBJ file.') EXPORT_ANIMATION = Draw.Toggle('Animation', EVENT_NONE, ui_x+229, ui_y+219, 110, 20, EXPORT_ANIMATION.val, 'Each frame as a numbered OBJ file.')
Draw.EndAlign() Draw.EndAlign()
Draw.Label('Output Options...', ui_x+9, ui_y+159, 220, 20) Draw.Label('Output Options...', ui_x+9, ui_y+189, 220, 20)
Draw.BeginAlign() Draw.BeginAlign()
EXPORT_APPLY_MODIFIERS = Draw.Toggle('Apply Modifiers', EVENT_REDRAW, ui_x+9, ui_y+140, 110, 20, EXPORT_APPLY_MODIFIERS.val, 'Use transformed mesh data from each object. May break vert order for morph targets.', do_split) EXPORT_APPLY_MODIFIERS = Draw.Toggle('Apply Modifiers', EVENT_REDRAW, ui_x+9, ui_y+170, 110, 20, EXPORT_APPLY_MODIFIERS.val, 'Use transformed mesh data from each object. May break vert order for morph targets.', do_split)
EXPORT_ROTX90 = Draw.Toggle('Rotate X90', EVENT_NONE, ui_x+119, ui_y+140, 110, 20, EXPORT_ROTX90.val, 'Rotate on export so Blenders UP is translated into OBJs UP') EXPORT_ROTX90 = Draw.Toggle('Rotate X90', EVENT_NONE, ui_x+119, ui_y+170, 110, 20, EXPORT_ROTX90.val, 'Rotate on export so Blenders UP is translated into OBJs UP')
EXPORT_COPY_IMAGES = Draw.Toggle('Copy Images', EVENT_NONE, ui_x+229, ui_y+140, 110, 20, EXPORT_COPY_IMAGES.val, 'Copy image files to the export directory, never overwrite.') EXPORT_COPY_IMAGES = Draw.Toggle('Copy Images', EVENT_NONE, ui_x+229, ui_y+170, 110, 20, EXPORT_COPY_IMAGES.val, 'Copy image files to the export directory, never overwrite.')
Draw.EndAlign() Draw.EndAlign()
Draw.Label('Export...', ui_x+9, ui_y+109, 220, 20) Draw.Label('Export...', ui_x+9, ui_y+139, 220, 20)
Draw.BeginAlign() Draw.BeginAlign()
EXPORT_EDGES = Draw.Toggle('Edges', EVENT_NONE, ui_x+9, ui_y+90, 50, 20, EXPORT_EDGES.val, 'Edges not connected to faces.') EXPORT_EDGES = Draw.Toggle('Edges', EVENT_NONE, ui_x+9, ui_y+120, 50, 20, EXPORT_EDGES.val, 'Edges not connected to faces.')
EXPORT_TRI = Draw.Toggle('Triangulate', EVENT_NONE, ui_x+59, ui_y+90, 70, 20, EXPORT_TRI.val, 'Triangulate quads.') EXPORT_TRI = Draw.Toggle('Triangulate', EVENT_NONE, ui_x+59, ui_y+120, 70, 20, EXPORT_TRI.val, 'Triangulate quads.')
Draw.EndAlign() Draw.EndAlign()
Draw.BeginAlign() Draw.BeginAlign()
EXPORT_MTL = Draw.Toggle('Materials', EVENT_NONE, ui_x+139, ui_y+90, 70, 20, EXPORT_MTL.val, 'Write a separate MTL file with the OBJ.') EXPORT_MTL = Draw.Toggle('Materials', EVENT_NONE, ui_x+139, ui_y+120, 70, 20, EXPORT_MTL.val, 'Write a separate MTL file with the OBJ.')
EXPORT_UV = Draw.Toggle('UVs', EVENT_NONE, ui_x+209, ui_y+90, 31, 20, EXPORT_UV.val, 'Export texface UV coords.') EXPORT_UV = Draw.Toggle('UVs', EVENT_NONE, ui_x+209, ui_y+120, 31, 20, EXPORT_UV.val, 'Export texface UV coords.')
Draw.EndAlign() Draw.EndAlign()
Draw.BeginAlign() Draw.BeginAlign()
EXPORT_NORMALS = Draw.Toggle('Normals', EVENT_NONE, ui_x+250, ui_y+90, 59, 20, EXPORT_NORMALS.val, 'Export vertex normal data (Ignored on import).') EXPORT_NORMALS = Draw.Toggle('Normals', EVENT_NONE, ui_x+250, ui_y+120, 59, 20, EXPORT_NORMALS.val, 'Export vertex normal data (Ignored on import).')
EXPORT_NORMALS_HQ = Draw.Toggle('HQ', EVENT_NONE, ui_x+309, ui_y+90, 31, 20, EXPORT_NORMALS_HQ.val, 'Calculate high quality normals for rendering.') EXPORT_NORMALS_HQ = Draw.Toggle('HQ', EVENT_NONE, ui_x+309, ui_y+120, 31, 20, EXPORT_NORMALS_HQ.val, 'Calculate high quality normals for rendering.')
Draw.EndAlign() Draw.EndAlign()
EXPORT_POLYGROUPS = Draw.Toggle('Polygroups', EVENT_REDRAW, ui_x+9, ui_y+95, 120, 20, EXPORT_POLYGROUPS.val, 'Export vertex groups as OBJ groups (one group per face approximation).')
Draw.Label('Blender Objects as OBJ:', ui_x+9, ui_y+59, 220, 20) Draw.Label('Blender Objects as OBJ:', ui_x+9, ui_y+59, 220, 20)
@@ -727,7 +778,7 @@ def write_ui(filename):
EXPORT_GROUP_BY_OB = EXPORT_GROUP_BY_OB.val EXPORT_GROUP_BY_OB = EXPORT_GROUP_BY_OB.val
EXPORT_GROUP_BY_MAT = EXPORT_GROUP_BY_MAT.val EXPORT_GROUP_BY_MAT = EXPORT_GROUP_BY_MAT.val
EXPORT_KEEP_VERT_ORDER = EXPORT_KEEP_VERT_ORDER.val EXPORT_KEEP_VERT_ORDER = EXPORT_KEEP_VERT_ORDER.val
EXPORT_POLYGROUPS = EXPORT_POLYGROUPS.val
base_name, ext = splitExt(filename) base_name, ext = splitExt(filename)
@@ -776,7 +827,8 @@ def write_ui(filename):
EXPORT_NORMALS_HQ, EXPORT_UV, EXPORT_MTL,\ EXPORT_NORMALS_HQ, EXPORT_UV, EXPORT_MTL,\
EXPORT_COPY_IMAGES, EXPORT_APPLY_MODIFIERS,\ EXPORT_COPY_IMAGES, EXPORT_APPLY_MODIFIERS,\
EXPORT_ROTX90, EXPORT_BLEN_OBS,\ EXPORT_ROTX90, EXPORT_BLEN_OBS,\
EXPORT_GROUP_BY_OB, EXPORT_GROUP_BY_MAT, EXPORT_KEEP_VERT_ORDER) EXPORT_GROUP_BY_OB, EXPORT_GROUP_BY_MAT, EXPORT_KEEP_VERT_ORDER,\
EXPORT_POLYGROUPS)
Blender.Set('curframe', orig_frame) Blender.Set('curframe', orig_frame)

View File

@@ -36,6 +36,12 @@ This script opens the user's default web browser at http://www.blender.org's
# ***** END GPL LICENCE BLOCK ***** # ***** END GPL LICENCE BLOCK *****
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
import Blender, webbrowser import Blender
version = str(int(Blender.Get('version'))) try: import webbrowser
webbrowser.open('http://www.blender.org/documentation/'+ version +'PythonDoc/') except: webbrowser = None
if webbrowser:
version = str(int(Blender.Get('version')))
webbrowser.open('http://www.blender.org/documentation/'+ version +'PythonDoc/')
else:
Blender.Draw.PupMenu("Error%t|This script requires a full python installation")

View File

@@ -38,5 +38,13 @@ This script opens the user's default web browser at www.blender.org's
# ***** END GPL LICENCE BLOCK ***** # ***** END GPL LICENCE BLOCK *****
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
import Blender, webbrowser import Blender
webbrowser.open('http://www.blender.org/education-help/tutorials/getting-started/') try: import webbrowser
except: webbrowser = None
if webbrowser:
webbrowser.open('http://www.blender.org/education-help/tutorials/getting-started/')
else:
Blender.Draw.PupMenu("Error%t|This script requires a full python installation")

View File

@@ -36,5 +36,13 @@ This script opens the user's default web browser at www.blender.org's
# ***** END GPL LICENCE BLOCK ***** # ***** END GPL LICENCE BLOCK *****
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
import Blender, webbrowser import Blender
webbrowser.open('http://wiki.blender.org/index.php/Manual') try: import webbrowser
except: webbrowser = None
if webbrowser:
webbrowser.open('http://wiki.blender.org/index.php/Manual')
else:
Blender.Draw.PupMenu("Error%t|This script requires a full python installation")

View File

@@ -36,6 +36,12 @@ This script opens the user's default web browser at www.blender.org's
# ***** END GPL LICENCE BLOCK ***** # ***** END GPL LICENCE BLOCK *****
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
import Blender, webbrowser import Blender
try: import webbrowser
except: webbrowser = None
if webbrowser:
webbrowser.open('http://www.blender.org/development/release-logs/')
else:
Blender.Draw.PupMenu("Error%t|This script requires a full python installation")
webbrowser.open('http://www.blender.org/development/release-logs/')

View File

@@ -37,5 +37,11 @@ This script opens the user's default web browser at www.blender.org's
# ***** END GPL LICENCE BLOCK ***** # ***** END GPL LICENCE BLOCK *****
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
import Blender, webbrowser import Blender
webbrowser.open('http://www.blender.org/education-help/tutorials/') try: import webbrowser
except: webbrowser = None
if webbrowser:
webbrowser.open('http://www.blender.org/education-help/tutorials/')
else:
Blender.Draw.PupMenu("Error%t|This script requires a full python installation")

View File

@@ -38,5 +38,11 @@ www.blender.org.
# ***** END GPL LICENCE BLOCK ***** # ***** END GPL LICENCE BLOCK *****
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
import Blender, webbrowser import Blender
webbrowser.open('http://www.blender.org/') try: import webbrowser
except: webbrowser = None
if webbrowser:
webbrowser.open('http://www.blender.org/')
else:
Blender.Draw.PupMenu("Error%t|This script requires a full python installation")

View File

@@ -37,5 +37,11 @@ This script opens the user's default web browser at www.blender.org's
# ***** END GPL LICENCE BLOCK ***** # ***** END GPL LICENCE BLOCK *****
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
import webbrowser import Blender
webbrowser.open('http://www.blender.org/community/get-involved/') try: import webbrowser
except: webbrowser = None
if webbrowser:
webbrowser.open('http://www.blender.org/community/get-involved/')
else:
Blender.Draw.PupMenu("Error%t|This script requires a full python installation")

View File

@@ -37,5 +37,11 @@ This script opens the user's default web browser at www.blender.org's
# ***** END GPL LICENCE BLOCK ***** # ***** END GPL LICENCE BLOCK *****
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
import Blender, webbrowser import Blender
webbrowser.open('http://www.blender3d.org/e-shop') try: import webbrowser
except: webbrowser = None
if webbrowser:
webbrowser.open('http://www.blender3d.org/e-shop')
else:
Blender.Draw.PupMenu("Error%t|This script requires a full python installation")

View File

@@ -37,5 +37,11 @@ This script opens the user's default web browser at www.blender.org's
# ***** END GPL LICENCE BLOCK ***** # ***** END GPL LICENCE BLOCK *****
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
import webbrowser import Blender
webbrowser.open('http://www.blender.org/community/user-community/') try: import webbrowser
except: webbrowser = None
if webbrowser:
webbrowser.open('http://www.blender.org/community/user-community/')
else:
Blender.Draw.PupMenu("Error%t|This script requires a full python installation")

View File

@@ -2,12 +2,12 @@
""" """
Name: 'Autodesk DXF (.dxf .dwg)' Name: 'Autodesk DXF (.dxf .dwg)'
Blender: 246 Blender: 249
Group: 'Import' Group: 'Import'
Tooltip: 'Import for DWG/DXF geometry data.' Tooltip: 'Import for DWG/DXF geometry data.'
""" """
__author__ = 'Kitsu(Ed Blake) & migius(Remigiusz Fiedler)' __author__ = 'Kitsu(Ed Blake) & migius(Remigiusz Fiedler)'
__version__ = '1.12 - 2009.04.11 by migius' __version__ = '1.12 - 2009.05.27 by migius'
__url__ = ["http://blenderartists.org/forum/showthread.php?t=84319", __url__ = ["http://blenderartists.org/forum/showthread.php?t=84319",
"http://wiki.blender.org/index.php/Scripts/Manual/Import/DXF-3D"] "http://wiki.blender.org/index.php/Scripts/Manual/Import/DXF-3D"]
__email__ = ["migius(at)4d-vectors.de","Kitsune_e(at)yahoo.com"] __email__ = ["migius(at)4d-vectors.de","Kitsune_e(at)yahoo.com"]
@@ -44,8 +44,8 @@ Supported DXF>r12 objects:
ELLIPSE, ELLIPSE,
LWPOLYLINE (LightWeight Polyline), LWPOLYLINE (LightWeight Polyline),
SPLINE, SPLINE,
(wip v1.13) MLINE, (todo v1.13) MLINE,
(wip v1.13) MTEXT (todo v1.13) MTEXT
Unsupported objects: Unsupported objects:
DXF r12: DIMENSION. DXF r12: DIMENSION.
@@ -74,7 +74,7 @@ thickness,
width, width,
color, color,
layer, layer,
(wip v1.13: XDATA, grouped status) (todo v1.13: XDATA, grouped status)
It is recommended to use DXF-object properties for assign Blender materials. It is recommended to use DXF-object properties for assign Blender materials.
Notes: Notes:
@@ -111,7 +111,11 @@ History:
-- support DXF-definitions of scene, lights and cameras -- support DXF-definitions of scene, lights and cameras
-- support ortho mode for VIEWs and VPORTs as cameras -- support ortho mode for VIEWs and VPORTs as cameras
v1.12 - 2009.05.27 by migius
d6 todo: bugfix negative scaled INSERTs - isLeftHand(Matrix) check
v1.12 - 2009.05.26 by migius
d5 changed to the new 2.49 method Vector.cross()
d5 bugfix WORLDY(1,1,0) to (0,1,0)
v1.12 - 2009.04.11 by migius v1.12 - 2009.04.11 by migius
d4 added DWG support, Stani Michiels idea for binding an extern DXF-DWG-converter d4 added DWG support, Stani Michiels idea for binding an extern DXF-DWG-converter
v1.12 - 2009.03.14 by migius v1.12 - 2009.03.14 by migius
@@ -309,7 +313,7 @@ History:
import Blender import Blender
from Blender import Mathutils, BezTriple, Draw, Registry, sys,\ from Blender import Mathutils, BezTriple, Draw, Registry, sys,\
Text3d, Window, Mesh, Material, Group Text3d, Window, Mesh, Material, Group, Curve
#from Blender.Mathutils import Vector, Matrix #from Blender.Mathutils import Vector, Matrix
#import bpy #not used yet #import bpy #not used yet
#import BPyMessages #import BPyMessages
@@ -343,14 +347,12 @@ if os.name != 'mac':
except ImportError: except ImportError:
print 'psyco not imported' print 'psyco not imported'
#try: Curve.orderU
print '\n\n\n' print '\n\n\n'
print 'DXF/DWG-Importer v%s *** start ***' %(__version__) #--------------------- print 'DXF/DWG-Importer v%s *** start ***' %(__version__) #---------------------
SCENE = None SCENE = None
WORLDX = Mathutils.Vector((1,0,0)) WORLDX = Mathutils.Vector((1,0,0))
WORLDY = Mathutils.Vector((1,1,0)) WORLDY = Mathutils.Vector((0,1,0))
WORLDZ = Mathutils.Vector((0,0,1)) WORLDZ = Mathutils.Vector((0,0,1))
G_SCALE = 1.0 #(0.0001-1000) global scaling factor for all dxf data G_SCALE = 1.0 #(0.0001-1000) global scaling factor for all dxf data
@@ -375,7 +377,7 @@ GROUP_BYLAYER = 0 #(0/1) all entities from same layer import into one blender-
LAYER_DEF_NAME = 'AAAA' #default layer name LAYER_DEF_NAME = 'AAAA' #default layer name
LAYER_DEF_COLOR = 4 #default layer color LAYER_DEF_COLOR = 4 #default layer color
E_M = 0 E_M = 0
LAB = "*) parts under construction" LAB = ". wip .. todo" #"*) parts under construction"
M_OBJ = 0 M_OBJ = 0
FILENAME_MAX = 180 #max length of path+file_name string (FILE_MAXDIR + FILE_MAXFILE) FILENAME_MAX = 180 #max length of path+file_name string (FILE_MAXDIR + FILE_MAXFILE)
@@ -392,7 +394,20 @@ ALIGN = BezTriple.HandleTypes.ALIGN
UI_MODE = True #activates UI-popup-print, if not multiple files imported UI_MODE = True #activates UI-popup-print, if not multiple files imported
#---- migration to 2.49-------------------------------------------------
if 'cross' in dir(Mathutils.Vector()):
#Draw.PupMenu('DXF exporter: Abort%t|This script version works for Blender up 2.49 only!')
def M_CrossVecs(v1,v2):
return v1.cross(v2) #for up2.49
def M_DotVecs(v1,v2):
return v1.dot(v2) #for up2.49
else:
def M_CrossVecs(v1,v2):
return Mathutils.CrossVecs(v1,v2) #for pre2.49
def M_DotVecs(v1,v2):
return Mathutils.DotVecs(v1,v2) #for pre2.49
#-------- DWG support ------------------------------------------ #-------- DWG support ------------------------------------------
extCONV_OK = True extCONV_OK = True
extCONV = 'DConvertCon.exe' extCONV = 'DConvertCon.exe'
@@ -2237,7 +2252,6 @@ class LWpolyline(Polyline): #--------------------------------------------------
self.spline = False self.spline = False
self.curved = False self.curved = False
#print 'deb:LWpolyline.obj.data:\n', obj.data #------------------------ #print 'deb:LWpolyline.obj.data:\n', obj.data #------------------------
#print 'deb:LWpolyline.ENDinit:----------------' #------------------------ #print 'deb:LWpolyline.ENDinit:----------------' #------------------------
@@ -4419,11 +4433,11 @@ def getOCS(az): #--------------------------------------------------------------
cap = 0.015625 # square polar cap value (1/64.0) cap = 0.015625 # square polar cap value (1/64.0)
if abs(az.x) < cap and abs(az.y) < cap: if abs(az.x) < cap and abs(az.y) < cap:
ax = Mathutils.CrossVecs(WORLDY, az) ax = M_CrossVecs(WORLDY,az)
else: else:
ax = Mathutils.CrossVecs(WORLDZ, az) ax = M_CrossVecs(WORLDZ,az)
ax = ax.normalize() ax = ax.normalize()
ay = Mathutils.CrossVecs(az, ax) ay = M_CrossVecs(az, ax)
ay = ay.normalize() ay = ay.normalize()
return ax, ay, az return ax, ay, az
@@ -5166,17 +5180,17 @@ GUI_B = {} # GUI-buttons dictionary for drawingTypes
# settings default, initialize ------------------------ # settings default, initialize ------------------------
points_as_menu = "convert to: %t|empty %x1|mesh.vertex %x2|thin sphere %x3|thin box %x4|*curve.vertex %x5" points_as_menu = "convert to: %t|empty %x1|mesh.vertex %x2|thin sphere %x3|thin box %x4|..curve.vertex %x5"
lines_as_menu = "convert to: %t|*edge %x1|mesh %x2|*thin cylinder %x3|thin box %x4|Bezier-curve %x5|*NURBS-curve %x6" lines_as_menu = "convert to: %t|..edge %x1|mesh %x2|..thin cylinder %x3|thin box %x4|Bezier-curve %x5|..NURBS-curve %x6"
mlines_as_menu = "convert to: %t|*edge %x1|*mesh %x2|*thin cylinder %x3|*thin box %x|*curve %x5" mlines_as_menu = "convert to: %t|..edge %x1|..mesh %x2|..thin cylinder %x3|..thin box %x|..curve %x5"
plines_as_menu = "convert to: %t|*edge %x1|mesh %x2|*thin cylinder %x3|*thin box %x4|Bezier-curve %x5|NURBS-curve %x6" plines_as_menu = "convert to: %t|..edge %x1|mesh %x2|..thin cylinder %x3|..thin box %x4|Bezier-curve %x5|NURBS-curve %x6"
splines_as_menu = "convert to: %t|mesh %x2|*thin cylinder %x3|*thin box %x4|*Bezier-curve %x5|NURBS-curve %x6" splines_as_menu = "convert to: %t|mesh %x2|..thin cylinder %x3|..thin box %x4|Bezier-curve %x5|NURBS-curve %x6"
plines3_as_menu = "convert to: %t|*edge %x1|mesh %x2|*thin cylinder %x3|*thin box %x4|Bezier-curve %x5|NURBS-curve %x6" plines3_as_menu = "convert to: %t|..edge %x1|mesh %x2|..thin cylinder %x3|..thin box %x4|Bezier-curve %x5|NURBS-curve %x6"
plmesh_as_menu = "convert to: %t|*edge %x1|mesh %x2|*NURBS-surface %x6" plmesh_as_menu = "convert to: %t|..edge %x1|mesh %x2|..NURBS-surface %x6"
solids_as_menu = "convert to: %t|*edge %x1|mesh %x2" solids_as_menu = "convert to: %t|..edge %x1|mesh %x2"
blocks_as_menu = "convert to: %t|dupliGroup %x1|*real.Group %x2|*exploded %x3" blocks_as_menu = "convert to: %t|dupliGroup %x1|..real.Group %x2|..exploded %x3"
texts_as_menu = "convert to: %t|text %x1|*mesh %x2|*curve %x5" texts_as_menu = "convert to: %t|text %x1|..mesh %x2|..curve %x5"
material_from_menu= "material from: %t|*LINESTYLE %x7|COLOR %x1|LAYER %x2|*LAYER+COLOR %x3|*BLOCK %x4|*XDATA %x5|*INI-File %x6" material_from_menu= "material from: %t|..LINESTYLE %x7|COLOR %x1|LAYER %x2|..LAYER+COLOR %x3|..BLOCK %x4|..XDATA %x5|..INI-File %x6"
g_scale_list = ''.join(( g_scale_list = ''.join((
'scale factor: %t', 'scale factor: %t',
'|user def. %x12', '|user def. %x12',
@@ -5662,7 +5676,7 @@ def draw_UI(): #---------------------------------------------------------------
y -= 20 y -= 20
Draw.BeginAlign() Draw.BeginAlign()
GUI_B['mline'] = Draw.Toggle('*MLINE', EVENT_REDRAW, b0, y, b0_, 20, GUI_B['mline'].val, "(*wip)support dxf-MLINE on/off") GUI_B['mline'] = Draw.Toggle('..MLINE', EVENT_REDRAW, b0, y, b0_, 20, GUI_B['mline'].val, "(*todo)support dxf-MLINE on/off")
if GUI_B['mline'].val: if GUI_B['mline'].val:
GUI_A['mlines_as'] = Draw.Menu(mlines_as_menu, EVENT_NONE, but1c, y, but_1c, 20, GUI_A['mlines_as'].val, "select target Blender-object") GUI_A['mlines_as'] = Draw.Menu(mlines_as_menu, EVENT_NONE, but1c, y, but_1c, 20, GUI_A['mlines_as'].val, "select target Blender-object")
Draw.EndAlign() Draw.EndAlign()
@@ -5713,7 +5727,7 @@ def draw_UI(): #---------------------------------------------------------------
y -= 20 y -= 20
GUI_B['text'] = Draw.Toggle('TEXT', EVENT_NONE, b0, y, b0_, 20, GUI_B['text'].val, "support dxf-TEXT on/off") GUI_B['text'] = Draw.Toggle('TEXT', EVENT_NONE, b0, y, b0_, 20, GUI_B['text'].val, "support dxf-TEXT on/off")
GUI_B['mtext'] = Draw.Toggle('*MTEXT', EVENT_NONE, b1, y, b1_, 20, GUI_B['mtext'].val, "(*wip)support dxf-MTEXT on/off") GUI_B['mtext'] = Draw.Toggle('..MTEXT', EVENT_NONE, b1, y, b1_, 20, GUI_B['mtext'].val, "(*todo)support dxf-MTEXT on/off")
# GUI_A['texts_as'] = Draw.Menu(texts_as_menu, EVENT_NONE, but3c, y, but_3c, 20, GUI_A['texts_as'].val, "select target Blender-object") # GUI_A['texts_as'] = Draw.Menu(texts_as_menu, EVENT_NONE, but3c, y, but_3c, 20, GUI_A['texts_as'].val, "select target Blender-object")
y -= 20 y -= 20
@@ -5732,8 +5746,8 @@ def draw_UI(): #---------------------------------------------------------------
Draw.BeginAlign() Draw.BeginAlign()
GUI_A['views_on'] = Draw.Toggle('views', EVENT_NONE, b0, y, b0_-25, 20, GUI_A['views_on'].val, "imports VIEWs and VIEWPORTs as cameras on/off") GUI_A['views_on'] = Draw.Toggle('views', EVENT_NONE, b0, y, b0_-25, 20, GUI_A['views_on'].val, "imports VIEWs and VIEWPORTs as cameras on/off")
GUI_A['cams_on'] = Draw.Toggle('*cams', EVENT_NONE, b1-25, y, b1_-25, 20, GUI_A['cams_on'].val, "(*wip) support ASHADE cameras on/off") GUI_A['cams_on'] = Draw.Toggle('..cams', EVENT_NONE, b1-25, y, b1_-25, 20, GUI_A['cams_on'].val, "(*todo) support ASHADE cameras on/off")
GUI_A['lights_on'] = Draw.Toggle('*lights', EVENT_NONE, b1+25, y, b1_-25, 20, GUI_A['lights_on'].val, "(*wip) support AVE_RENDER lights on/off") GUI_A['lights_on'] = Draw.Toggle('..lights', EVENT_NONE, b1+25, y, b1_-25, 20, GUI_A['lights_on'].val, "(*todo) support AVE_RENDER lights on/off")
Draw.EndAlign() Draw.EndAlign()
@@ -5749,10 +5763,10 @@ def draw_UI(): #---------------------------------------------------------------
Draw.BeginAlign() Draw.BeginAlign()
GUI_A['paper_space_on'] = Draw.Toggle('paper', EVENT_NONE, b0+but_*0, y, but_, 20, GUI_A['paper_space_on'].val, "import only from Paper-Space on/off") GUI_A['paper_space_on'] = Draw.Toggle('paper', EVENT_NONE, b0+but_*0, y, but_, 20, GUI_A['paper_space_on'].val, "import only from Paper-Space on/off")
GUI_A['layFrozen_on'] = Draw.Toggle ('frozen', EVENT_NONE, b0+but_*1, y, but_, 20, GUI_A['layFrozen_on'].val, "import also from frozen LAYERs on/off") GUI_A['layFrozen_on'] = Draw.Toggle ('frozen', EVENT_NONE, b0+but_*1, y, but_, 20, GUI_A['layFrozen_on'].val, "import also from frozen LAYERs on/off")
GUI_A['layerFilter_on'] = Draw.Toggle('layer', EVENT_NONE, b0+but_*2, y, but_, 20, GUI_A['layerFilter_on'].val, "(*wip) LAYER filtering on/off") GUI_A['layerFilter_on'] = Draw.Toggle('..layer', EVENT_NONE, b0+but_*2, y, but_, 20, GUI_A['layerFilter_on'].val, "(*todo) LAYER filtering on/off")
GUI_A['colorFilter_on'] = Draw.Toggle('color', EVENT_NONE, b0+but_*3, y, but_, 20, GUI_A['colorFilter_on'].val, "(*wip) COLOR filtering on/off") GUI_A['colorFilter_on'] = Draw.Toggle('..color', EVENT_NONE, b0+but_*3, y, but_, 20, GUI_A['colorFilter_on'].val, "(*todo) COLOR filtering on/off")
GUI_A['groupFilter_on'] = Draw.Toggle('group', EVENT_NONE, b0+but_*4, y, but_, 20, GUI_A['groupFilter_on'].val, "(*wip) GROUP filtering on/off") GUI_A['groupFilter_on'] = Draw.Toggle('..group', EVENT_NONE, b0+but_*4, y, but_, 20, GUI_A['groupFilter_on'].val, "(*todo) GROUP filtering on/off")
GUI_A['blockFilter_on'] = Draw.Toggle('block', EVENT_NONE, b0+but_*5, y, but_, 20, GUI_A['blockFilter_on'].val, "(*wip) BLOCK filtering on/off") GUI_A['blockFilter_on'] = Draw.Toggle('..block', EVENT_NONE, b0+but_*5, y, but_, 20, GUI_A['blockFilter_on'].val, "(*todo) BLOCK filtering on/off")
#GUI_A['dummy_on'] = Draw.Toggle('-', EVENT_NONE, but3c, y, but_3c, 20, GUI_A['dummy_on'].val, "dummy on/off") #GUI_A['dummy_on'] = Draw.Toggle('-', EVENT_NONE, but3c, y, but_3c, 20, GUI_A['dummy_on'].val, "dummy on/off")
Draw.EndAlign() Draw.EndAlign()
@@ -5853,7 +5867,7 @@ def draw_UI(): #---------------------------------------------------------------
y -= 10 y -= 10
y -= 20 y -= 20
Draw.BeginAlign() Draw.BeginAlign()
GUI_A['Z_force_on'] = Draw.Toggle('*elevation', EVENT_REDRAW, b0, y, b0_, 20, GUI_A['Z_force_on'].val, "*set objects Z-coordinates to elevation on/off") GUI_A['Z_force_on'] = Draw.Toggle('.elevation', EVENT_REDRAW, b0, y, b0_, 20, GUI_A['Z_force_on'].val, ".set objects Z-coordinates to elevation on/off")
if GUI_A['Z_force_on'].val: if GUI_A['Z_force_on'].val:
GUI_A['Z_elev'] = Draw.Number('', EVENT_NONE, b1, y, b1_, 20, GUI_A['Z_elev'].val, -1000, 1000, "set default elevation(Z-coordinate)") GUI_A['Z_elev'] = Draw.Number('', EVENT_NONE, b1, y, b1_, 20, GUI_A['Z_elev'].val, -1000, 1000, "set default elevation(Z-coordinate)")
Draw.EndAlign() Draw.EndAlign()
@@ -6155,6 +6169,7 @@ def multi_import(DIR):
if __name__ == "__main__": if __name__ == "__main__":
#Draw.PupMenu('DXF importer: Abort%t|This script version works for Blender up 2.49 only!')
UI_MODE = True UI_MODE = True
# recall last used DXF-file and INI-file names # recall last used DXF-file and INI-file names
dxffilename = check_RegistryKey('dxfFileName') dxffilename = check_RegistryKey('dxfFileName')

View File

@@ -7,9 +7,9 @@ Group: 'Import'
Tooltip: 'Load a Wavefront OBJ File, Shift: batch import all dir.' Tooltip: 'Load a Wavefront OBJ File, Shift: batch import all dir.'
""" """
__author__= "Campbell Barton", "Jiri Hnidek" __author__= "Campbell Barton", "Jiri Hnidek", "Paolo Ciccone"
__url__= ['http://wiki.blender.org/index.php/Scripts/Manual/Import/wavefront_obj', 'blender.org', 'blenderartists.org'] __url__= ['http://wiki.blender.org/index.php/Scripts/Manual/Import/wavefront_obj', 'blender.org', 'blenderartists.org']
__version__= "2.1" __version__= "2.11"
__bpydoc__= """\ __bpydoc__= """\
This script imports a Wavefront OBJ files to Blender. This script imports a Wavefront OBJ files to Blender.
@@ -49,7 +49,6 @@ import BPyMessages
try: import os try: import os
except: os= False except: os= False
# Generic path functions # Generic path functions
def stripFile(path): def stripFile(path):
'''Return directory, where the file is''' '''Return directory, where the file is'''
@@ -320,7 +319,7 @@ def split_mesh(verts_loc, faces, unique_materials, filepath, SPLIT_OB_OR_GROUP,
return [(value[0], value[1], value[2], key_to_name(key)) for key, value in face_split_dict.iteritems()] return [(value[0], value[1], value[2], key_to_name(key)) for key, value in face_split_dict.iteritems()]
def create_mesh(scn, new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc, verts_tex, faces, unique_materials, unique_material_images, unique_smooth_groups, dataname): def create_mesh(scn, new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc, verts_tex, faces, unique_materials, unique_material_images, unique_smooth_groups, vertex_groups, dataname):
''' '''
Takes all the data gathered and generates a mesh, adding the new object to new_objects Takes all the data gathered and generates a mesh, adding the new object to new_objects
deals with fgons, sharp edges and assigning materials deals with fgons, sharp edges and assigning materials
@@ -530,6 +529,13 @@ def create_mesh(scn, new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_l
ob= scn.objects.new(me) ob= scn.objects.new(me)
new_objects.append(ob) new_objects.append(ob)
# Create the vertex groups. No need to have the flag passed here since we test for the
# content of the vertex_groups. If the user selects to NOT have vertex groups saved then
# the following test will never run
for group_name, group_indicies in vertex_groups.iteritems():
me.addVertGroup(group_name)
me.assignVertsToGroup(group_name, group_indicies,1.00, Mesh.AssignModes.REPLACE)
def get_float_func(filepath): def get_float_func(filepath):
''' '''
find the float function for this obj file find the float function for this obj file
@@ -547,7 +553,16 @@ def get_float_func(filepath):
# incase all vert values were ints # incase all vert values were ints
return float return float
def load_obj(filepath, CLAMP_SIZE= 0.0, CREATE_FGONS= True, CREATE_SMOOTH_GROUPS= True, CREATE_EDGES= True, SPLIT_OBJECTS= True, SPLIT_GROUPS= True, SPLIT_MATERIALS= True, IMAGE_SEARCH=True): def load_obj(filepath,
CLAMP_SIZE= 0.0,
CREATE_FGONS= True,
CREATE_SMOOTH_GROUPS= True,
CREATE_EDGES= True,
SPLIT_OBJECTS= True,
SPLIT_GROUPS= True,
SPLIT_MATERIALS= True,
IMAGE_SEARCH=True,
POLYGROUPS=False):
''' '''
Called by the user interface or another script. Called by the user interface or another script.
load_obj(path) - should give acceptable results. load_obj(path) - should give acceptable results.
@@ -556,13 +571,16 @@ def load_obj(filepath, CLAMP_SIZE= 0.0, CREATE_FGONS= True, CREATE_SMOOTH_GROUPS
''' '''
print '\nimporting obj "%s"' % filepath print '\nimporting obj "%s"' % filepath
if SPLIT_OBJECTS or SPLIT_GROUPS or SPLIT_MATERIALS:
POLYGROUPS = False
time_main= sys.time() time_main= sys.time()
verts_loc= [] verts_loc= []
verts_tex= [] verts_tex= []
faces= [] # tuples of the faces faces= [] # tuples of the faces
material_libs= [] # filanems to material libs this uses material_libs= [] # filanems to material libs this uses
vertex_groups = {} # when POLYGROUPS is true
# Get the string to float conversion func for this file- is 'float' for almost all files. # Get the string to float conversion func for this file- is 'float' for almost all files.
float_func= get_float_func(filepath) float_func= get_float_func(filepath)
@@ -571,7 +589,8 @@ def load_obj(filepath, CLAMP_SIZE= 0.0, CREATE_FGONS= True, CREATE_SMOOTH_GROUPS
context_material= None context_material= None
context_smooth_group= None context_smooth_group= None
context_object= None context_object= None
context_vgroup = None
has_ngons= False has_ngons= False
# has_smoothgroups= False - is explicit with len(unique_smooth_groups) being > 0 # has_smoothgroups= False - is explicit with len(unique_smooth_groups) being > 0
@@ -587,8 +606,9 @@ def load_obj(filepath, CLAMP_SIZE= 0.0, CREATE_FGONS= True, CREATE_SMOOTH_GROUPS
# so we need to know weather # so we need to know weather
multi_line_face= False multi_line_face= False
print '\tpassing obj file "%s"...' % filepath, print '\tparsing obj file "%s"...' % filepath,
time_sub= sys.time() time_sub= sys.time()
file= open(filepath, 'rU') file= open(filepath, 'rU')
for line in file: #.xreadlines(): for line in file: #.xreadlines():
line = line.lstrip() # rare cases there is white space at the start of the line line = line.lstrip() # rare cases there is white space at the start of the line
@@ -641,6 +661,10 @@ def load_obj(filepath, CLAMP_SIZE= 0.0, CREATE_FGONS= True, CREATE_SMOOTH_GROUPS
obj_vert= v.split('/') obj_vert= v.split('/')
vert_loc_index= int(obj_vert[0])-1 vert_loc_index= int(obj_vert[0])-1
# Add the vertex to the current group
# *warning*, this wont work for files that have groups defined around verts
if POLYGROUPS and context_vgroup:
vertex_groups[context_vgroup].append(vert_loc_index)
# Make relative negative vert indicies absolute # Make relative negative vert indicies absolute
if vert_loc_index < 0: if vert_loc_index < 0:
@@ -684,6 +708,12 @@ def load_obj(filepath, CLAMP_SIZE= 0.0, CREATE_FGONS= True, CREATE_SMOOTH_GROUPS
context_object= line_value(line.split()) context_object= line_value(line.split())
# print 'context_object', context_object # print 'context_object', context_object
# unique_obects[context_object]= None # unique_obects[context_object]= None
elif POLYGROUPS:
context_vgroup = line_value(line.split())
if context_vgroup and context_vgroup != '(null)':
vertex_groups.setdefault(context_vgroup, [])
else:
context_vgroup = None # dont assign a vgroup
elif line.startswith('usemtl'): elif line.startswith('usemtl'):
context_material= line_value(line.split()) context_material= line_value(line.split())
@@ -721,8 +751,8 @@ def load_obj(filepath, CLAMP_SIZE= 0.0, CREATE_FGONS= True, CREATE_SMOOTH_GROUPS
else: SPLIT_OB_OR_GROUP = False else: SPLIT_OB_OR_GROUP = False
for verts_loc_split, faces_split, unique_materials_split, dataname in split_mesh(verts_loc, faces, unique_materials, filepath, SPLIT_OB_OR_GROUP, SPLIT_MATERIALS): for verts_loc_split, faces_split, unique_materials_split, dataname in split_mesh(verts_loc, faces, unique_materials, filepath, SPLIT_OB_OR_GROUP, SPLIT_MATERIALS):
# Create meshes from the data # Create meshes from the data, warning 'vertex_groups' wont support splitting
create_mesh(scn, new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc_split, verts_tex, faces_split, unique_materials_split, unique_material_images, unique_smooth_groups, dataname) create_mesh(scn, new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc_split, verts_tex, faces_split, unique_materials_split, unique_material_images, unique_smooth_groups, vertex_groups, dataname)
axis_min= [ 1000000000]*3 axis_min= [ 1000000000]*3
axis_max= [-1000000000]*3 axis_max= [-1000000000]*3
@@ -758,7 +788,7 @@ def load_obj_ui(filepath, BATCH_LOAD= False):
if BPyMessages.Error_NoFile(filepath): if BPyMessages.Error_NoFile(filepath):
return return
global CREATE_SMOOTH_GROUPS, CREATE_FGONS, CREATE_EDGES, SPLIT_OBJECTS, SPLIT_GROUPS, SPLIT_MATERIALS, CLAMP_SIZE, IMAGE_SEARCH, KEEP_VERT_ORDER global CREATE_SMOOTH_GROUPS, CREATE_FGONS, CREATE_EDGES, SPLIT_OBJECTS, SPLIT_GROUPS, SPLIT_MATERIALS, CLAMP_SIZE, IMAGE_SEARCH, POLYGROUPS, KEEP_VERT_ORDER
CREATE_SMOOTH_GROUPS= Draw.Create(0) CREATE_SMOOTH_GROUPS= Draw.Create(0)
CREATE_FGONS= Draw.Create(1) CREATE_FGONS= Draw.Create(1)
@@ -768,6 +798,7 @@ def load_obj_ui(filepath, BATCH_LOAD= False):
SPLIT_MATERIALS= Draw.Create(0) SPLIT_MATERIALS= Draw.Create(0)
CLAMP_SIZE= Draw.Create(10.0) CLAMP_SIZE= Draw.Create(10.0)
IMAGE_SEARCH= Draw.Create(1) IMAGE_SEARCH= Draw.Create(1)
POLYGROUPS= Draw.Create(0)
KEEP_VERT_ORDER= Draw.Create(1) KEEP_VERT_ORDER= Draw.Create(1)
@@ -817,9 +848,10 @@ def load_obj_ui(filepath, BATCH_LOAD= False):
GLOBALS['EVENT'] = e GLOBALS['EVENT'] = e
def do_split(e,v): def do_split(e,v):
global SPLIT_OBJECTS, SPLIT_GROUPS, SPLIT_MATERIALS, KEEP_VERT_ORDER global SPLIT_OBJECTS, SPLIT_GROUPS, SPLIT_MATERIALS, KEEP_VERT_ORDER, POLYGROUPS
if SPLIT_OBJECTS.val or SPLIT_GROUPS.val or SPLIT_MATERIALS.val: if SPLIT_OBJECTS.val or SPLIT_GROUPS.val or SPLIT_MATERIALS.val:
KEEP_VERT_ORDER.val = 0 KEEP_VERT_ORDER.val = 0
POLYGROUPS.val = 0
else: else:
KEEP_VERT_ORDER.val = 1 KEEP_VERT_ORDER.val = 1
@@ -831,6 +863,11 @@ def load_obj_ui(filepath, BATCH_LOAD= False):
if not (SPLIT_OBJECTS.val or SPLIT_GROUPS.val or SPLIT_MATERIALS.val): if not (SPLIT_OBJECTS.val or SPLIT_GROUPS.val or SPLIT_MATERIALS.val):
KEEP_VERT_ORDER.val = 1 KEEP_VERT_ORDER.val = 1
def do_polygroups(e,v):
global SPLIT_OBJECTS, SPLIT_GROUPS, SPLIT_MATERIALS, KEEP_VERT_ORDER, POLYGROUPS
if POLYGROUPS.val:
SPLIT_OBJECTS.val = SPLIT_GROUPS.val = SPLIT_MATERIALS.val = 0
def do_help(e,v): def do_help(e,v):
url = __url__[0] url = __url__[0]
print 'Trying to open web browser with documentation at this address...' print 'Trying to open web browser with documentation at this address...'
@@ -849,7 +886,7 @@ def load_obj_ui(filepath, BATCH_LOAD= False):
ui_x -= 165 ui_x -= 165
ui_y -= 90 ui_y -= 90
global CREATE_SMOOTH_GROUPS, CREATE_FGONS, CREATE_EDGES, SPLIT_OBJECTS, SPLIT_GROUPS, SPLIT_MATERIALS, CLAMP_SIZE, IMAGE_SEARCH, KEEP_VERT_ORDER global CREATE_SMOOTH_GROUPS, CREATE_FGONS, CREATE_EDGES, SPLIT_OBJECTS, SPLIT_GROUPS, SPLIT_MATERIALS, CLAMP_SIZE, IMAGE_SEARCH, POLYGROUPS, KEEP_VERT_ORDER
Draw.Label('Import...', ui_x+9, ui_y+159, 220, 21) Draw.Label('Import...', ui_x+9, ui_y+159, 220, 21)
Draw.BeginAlign() Draw.BeginAlign()
@@ -869,8 +906,9 @@ def load_obj_ui(filepath, BATCH_LOAD= False):
KEEP_VERT_ORDER = Draw.Toggle('Keep Vert Order', EVENT_REDRAW, ui_x+229, ui_y+89, 110, 21, KEEP_VERT_ORDER.val, 'Keep vert and face order, disables split options, enable for morph targets', do_vertorder) KEEP_VERT_ORDER = Draw.Toggle('Keep Vert Order', EVENT_REDRAW, ui_x+229, ui_y+89, 110, 21, KEEP_VERT_ORDER.val, 'Keep vert and face order, disables split options, enable for morph targets', do_vertorder)
Draw.Label('Options...', ui_x+9, ui_y+60, 211, 20) Draw.Label('Options...', ui_x+9, ui_y+60, 211, 20)
CLAMP_SIZE = Draw.Number('Clamp Scale: ', EVENT_NONE, ui_x+9, ui_y+39, 211, 21, CLAMP_SIZE.val, 0.0, 1000.0, 'Clamp the size to this maximum (Zero to Disable)') CLAMP_SIZE = Draw.Number('Clamp Scale: ', EVENT_NONE, ui_x+9, ui_y+39, 130, 21, CLAMP_SIZE.val, 0.0, 1000.0, 'Clamp the size to this maximum (Zero to Disable)')
IMAGE_SEARCH = Draw.Toggle('Image Search', EVENT_NONE, ui_x+229, ui_y+39, 110, 21, IMAGE_SEARCH.val, 'Search subdirs for any assosiated images (Warning, may be slow)') POLYGROUPS = Draw.Toggle('Poly Groups', EVENT_REDRAW, ui_x+144, ui_y+39, 90, 21, POLYGROUPS.val, 'Import OBJ groups as vertex groups.', do_polygroups)
IMAGE_SEARCH = Draw.Toggle('Image Search', EVENT_NONE, ui_x+239, ui_y+39, 100, 21, IMAGE_SEARCH.val, 'Search subdirs for any assosiated images (Warning, may be slow)')
Draw.BeginAlign() Draw.BeginAlign()
Draw.PushButton('Online Help', EVENT_REDRAW, ui_x+9, ui_y+9, 110, 21, 'Load the wiki page for this script', do_help) Draw.PushButton('Online Help', EVENT_REDRAW, ui_x+9, ui_y+9, 110, 21, 'Load the wiki page for this script', do_help)
Draw.PushButton('Cancel', EVENT_EXIT, ui_x+119, ui_y+9, 110, 21, '', obj_ui_set_event) Draw.PushButton('Cancel', EVENT_EXIT, ui_x+119, ui_y+9, 110, 21, '', obj_ui_set_event)
@@ -921,6 +959,7 @@ def load_obj_ui(filepath, BATCH_LOAD= False):
SPLIT_GROUPS.val,\ SPLIT_GROUPS.val,\
SPLIT_MATERIALS.val,\ SPLIT_MATERIALS.val,\
IMAGE_SEARCH.val,\ IMAGE_SEARCH.val,\
POLYGROUPS.val
) )
else: # Normal load else: # Normal load
@@ -933,6 +972,7 @@ def load_obj_ui(filepath, BATCH_LOAD= False):
SPLIT_GROUPS.val,\ SPLIT_GROUPS.val,\
SPLIT_MATERIALS.val,\ SPLIT_MATERIALS.val,\
IMAGE_SEARCH.val,\ IMAGE_SEARCH.val,\
POLYGROUPS.val
) )
Window.WaitCursor(0) Window.WaitCursor(0)

View File

@@ -85,7 +85,7 @@ def imageConvertCompat(path):
def vrmlFormat(data): def vrmlFormat(data):
''' '''
Keep this as a valid vrml file, but format in a way we can pradict. Keep this as a valid vrml file, but format in a way we can predict.
''' '''
# Strip all commends - # not in strings - warning multiline strings are ignored. # Strip all commends - # not in strings - warning multiline strings are ignored.
def strip_comment(l): def strip_comment(l):

View File

@@ -68,8 +68,13 @@ v5.5 format.
# ***** END GPL LICENCE BLOCK ***** # ***** END GPL LICENCE BLOCK *****
import Blender import Blender
import struct, cStringIO, operator
import BPyMesh import BPyMesh
try: import struct
except: struct = None
try: import cStringIO
except: cStringIO = None
try: import operator
except: operator = None
VCOL_NAME = "\251 Per-Face Vertex Colors" VCOL_NAME = "\251 Per-Face Vertex Colors"
DEFAULT_NAME = "\251 Blender Default" DEFAULT_NAME = "\251 Blender Default"
@@ -95,12 +100,16 @@ def write(filename):
icon = "" #generate_icon() icon = "" #generate_icon()
meshes = [] meshes = []
mesh_object_name_lookup = {} # for name lookups only
for obj in objects: for obj in objects:
mesh = BPyMesh.getMeshFromObject(obj, None, True, False, scn) mesh = BPyMesh.getMeshFromObject(obj, None, True, False, scn)
if mesh: if mesh:
mesh.transform(obj.matrixWorld) mesh.transform(obj.matrixWorld)
meshes.append(mesh) meshes.append(mesh)
mesh_object_name_lookup[mesh] = obj.name
del obj
material_names = get_used_material_names(meshes) material_names = get_used_material_names(meshes)
tags = generate_tags(material_names) tags = generate_tags(material_names)
surfs = generate_surfs(material_names) surfs = generate_surfs(material_names)
@@ -111,7 +120,7 @@ def write(filename):
layer_index = 0 layer_index = 0
for mesh in meshes: for mesh in meshes:
layr = generate_layr(obj.name, layer_index) layr = generate_layr(mesh_object_name_lookup[mesh], layer_index)
pnts = generate_pnts(mesh) pnts = generate_pnts(mesh)
bbox = generate_bbox(mesh) bbox = generate_bbox(mesh)
pols = generate_pols(mesh) pols = generate_pols(mesh)
@@ -149,7 +158,9 @@ def write(filename):
layer_index += 1 layer_index += 1
mesh.verts = None # save some ram mesh.verts = None # save some ram
del mesh_object_name_lookup
for surf in surfs: for surf in surfs:
chunks.append(surf) chunks.append(surf)
@@ -345,23 +356,28 @@ def generate_vmad_vc(mesh):
# === Generate Per-Face UV Coords (VMAD Chunk) === # === Generate Per-Face UV Coords (VMAD Chunk) ===
# ================================================ # ================================================
def generate_vmad_uv(mesh): def generate_vmad_uv(mesh):
data = cStringIO.StringIO() layers = mesh.getUVLayerNames()
data.write("TXUV") # type org_uv = mesh.activeUVLayer
data.write(struct.pack(">H", 2)) # dimension for l in layers:
data.write(generate_nstring("Blender's UV Coordinates")) # name mesh.activeUVLayer = l
data = cStringIO.StringIO()
data.write("TXUV") # type
data.write(struct.pack(">H", 2)) # dimension
data.write(generate_nstring(l)) # name
for i, f in enumerate(mesh.faces):
if not i%100:
Blender.Window.DrawProgressBar(float(i)/len(mesh.faces), "Writing UV Coordinates")
uv = f.uv
f_v = f.v
for j in xrange(len(f)-1, -1, -1): # Reverse order
U,V = uv[j]
v = f_v[j].index
data.write(struct.pack(">H", v)) # vertex index
data.write(struct.pack(">H", i)) # face index
data.write(struct.pack(">ff", U, V))
for i, f in enumerate(mesh.faces): mesh.activeUVLayer = org_uv
if not i%100:
Blender.Window.DrawProgressBar(float(i)/len(mesh.faces), "Writing UV Coordinates")
uv = f.uv
f_v = f.v
for j in xrange(len(f)-1, -1, -1): # Reverse order
U,V = uv[j]
v = f_v[j].index
data.write(struct.pack(">H", v)) # vertex index
data.write(struct.pack(">H", i)) # face index
data.write(struct.pack(">ff", U, V))
return data.getvalue() return data.getvalue()
# ====================================== # ======================================
@@ -685,4 +701,7 @@ def fs_callback(filename):
if not filename.lower().endswith('.lwo'): filename += '.lwo' if not filename.lower().endswith('.lwo'): filename += '.lwo'
write(filename) write(filename)
Blender.Window.FileSelector(fs_callback, "Export LWO", Blender.sys.makename(ext='.lwo')) if struct and cStringIO and operator:
Blender.Window.FileSelector(fs_callback, "Export LWO", Blender.sys.makename(ext='.lwo'))
else:
Blender.Draw.PupMenu("Error%t|This script requires a full python installation")

View File

@@ -612,29 +612,9 @@ class md2_obj:
###################################################### ######################################################
# Validation # Validation
###################################################### ######################################################
def validation(object): def validation(object):
global user_frame_list global user_frame_list
#move the object to the origin if it's not already there
if object.getLocation('worldspace')!=(0.0, 0.0, 0.0):
print "Model not centered at origin"
result=Blender.Draw.PupMenu("Model not centered at origin%t|Center (will not work with animations!)|Do not center")
if result==1:
object.setLocation(0.0,0.0,0.0)
#resize the object in case it is not the right size
if object.getSize('worldspace')!=(1.0,1.0,1.0):
print "Object is scaled-You should scale the mesh verts, not the object"
result=Blender.Draw.PupMenu("Object is scaled-You should scale the mesh verts, not the object%t|Fix scale (will not work with animations!)|Do not scale")
if result==1:
object.setSize(1.0,1.0,1.0)
if object.getEuler('worldspace')!=Blender.Mathutils.Euler(0.0,0.0,0.0):
print "object.rot: ", object.getEuler('worldspace')
print "Object is rotated-You should rotate the mesh verts, not the object"
result=Blender.Draw.PupMenu("Object is rotated-You should rotate the mesh verts, not the object%t|Fix rotation (will not work with animations!)|Do not rotate")
if result==1:
object.setEuler([0.0,0.0,0.0])
#get access to the mesh data #get access to the mesh data
mesh=object.getData(False, True) #get the object (not just name) and the Mesh, not NMesh mesh=object.getData(False, True) #get the object (not just name) and the Mesh, not NMesh
@@ -696,7 +676,8 @@ def validation(object):
result=Blender.Draw.PupMenu("Model has more than 1 texture map assigned%t|Quit") result=Blender.Draw.PupMenu("Model has more than 1 texture map assigned%t|Quit")
#return False #return False
if mesh_image: if mesh_image:
size=mesh_image.getSize() try: size=mesh_image.getSize()
except: size= 256,256 # No image data
#is this really what the user wants #is this really what the user wants
if (size[0]!=256 or size[1]!=256): if (size[0]!=256 or size[1]!=256):
print "Texture map size is non-standard (not 256x256), it is: ",size[0],"x",size[1] print "Texture map size is non-standard (not 256x256), it is: ",size[0],"x",size[1]
@@ -753,6 +734,8 @@ def fill_md2(md2, object):
#create the vertex list from the first frame #create the vertex list from the first frame
Blender.Set("curframe", 1) Blender.Set("curframe", 1)
has_uvs = mesh.faceUV
#header information #header information
md2.ident=844121161 md2.ident=844121161
md2.version=8 md2.version=8
@@ -761,9 +744,11 @@ def fill_md2(md2, object):
#get the skin information #get the skin information
#use the first faces' image for the texture information #use the first faces' image for the texture information
if mesh.faceUV: if has_uvs:
mesh_image=mesh.faces[0].image mesh_image=mesh.faces[0].image
size=mesh_image.getSize() try: size=mesh_image.getSize()
except: size= 256,256
md2.skin_width=size[0] md2.skin_width=size[0]
md2.skin_height=size[1] md2.skin_height=size[1]
md2.num_skins=1 md2.num_skins=1
@@ -777,12 +762,14 @@ def fill_md2(md2, object):
#put texture information in the md2 structure #put texture information in the md2 structure
#build UV coord dictionary (prevents double entries-saves space) #build UV coord dictionary (prevents double entries-saves space)
if not has_uvs:
t=(0,0)
for face in mesh.faces: for face in mesh.faces:
for i in xrange(0,3): for i in xrange(0,3):
if mesh.faceUV: if has_uvs:
t=(face.uv[i]) t=(face.uv[i])
else:
t=(0,0)
tex_key=(t[0],t[1]) tex_key=(t[0],t[1])
if not tex_list.has_key(tex_key): if not tex_list.has_key(tex_key):
tex_list[tex_key]=tex_count tex_list[tex_key]=tex_count
@@ -798,16 +785,25 @@ def fill_md2(md2, object):
#put faces in the md2 structure #put faces in the md2 structure
#for each face in the model #for each face in the model
if not has_uvs:
uv_coords=[(0,0)]*3
for this_face in xrange(0, md2.num_faces): for this_face in xrange(0, md2.num_faces):
md2.faces.append(md2_face()) md2.faces.append(md2_face())
mf = mesh.faces[this_face]
mf_v = mf.v
if has_uvs:
uv_coords = mf.uv
for i in xrange(0,3): for i in xrange(0,3):
#blender uses indexed vertexes so this works very well #blender uses indexed vertexes so this works very well
md2.faces[this_face].vertex_index[i]=mesh.faces[this_face].verts[i].index md2.faces[this_face].vertex_index[i] = mf_v[i].index
#lookup texture index in dictionary #lookup texture index in dictionary
if mesh.faceUV: if has_uvs:
uv_coord=(mesh.faces[this_face].uv[i]) uv_coord = uv_coords[i]
else: # otherwise we set it before
uv_coord=(0,0)
tex_key=(uv_coord[0],uv_coord[1]) tex_key=(uv_coord[0],uv_coord[1])
tex_index=tex_list[tex_key] tex_index=tex_list[tex_key]
md2.faces[this_face].texture_index[i]=tex_index md2.faces[this_face].texture_index[i]=tex_index
@@ -837,13 +833,18 @@ def fill_md2(md2, object):
for frame_counter in xrange(0,md2.num_frames): for frame_counter in xrange(0,md2.num_frames):
progress+=progressIncrement progress+=progressIncrement
Blender.Window.DrawProgressBar(progress, "Calculating Frame: "+str(frame_counter)) Blender.Window.DrawProgressBar(progress, "Calculating Frame: %d of %d" % (frame_counter, md2.num_frames))
#add a frame #add a frame
md2.frames.append(md2_frame()) md2.frames.append(md2_frame())
#update the mesh objects vertex positions for the animation #update the mesh objects vertex positions for the animation
Blender.Set("curframe", frame_counter) #set blender to the correct frame Blender.Set("curframe", frame_counter) #set blender to the correct frame
mesh.getFromObject(object.name) #update the mesh to make verts current
mesh.getFromObject(object) #update the mesh to make verts current
mesh.transform(object.matrixWorld)
#each frame has a scale and transform value that gets the vertex value between 0-255 #each frame has a scale and transform value that gets the vertex value between 0-255
#since the scale and transform are the same for the all the verts in the frame, we only need #since the scale and transform are the same for the all the verts in the frame, we only need
@@ -862,13 +863,14 @@ def fill_md2(md2, object):
frame_max_z=-100000.0 frame_max_z=-100000.0
for face in mesh.faces: for face in mesh.faces:
for vert in face.verts: for vert in face:
if frame_min_x>vert.co[1]: frame_min_x=vert.co[1] co = vert.co
if frame_max_x<vert.co[1]: frame_max_x=vert.co[1] if frame_min_x>co[1]: frame_min_x=co[1]
if frame_min_y>vert.co[0]: frame_min_y=vert.co[0] if frame_max_x<co[1]: frame_max_x=co[1]
if frame_max_y<vert.co[0]: frame_max_y=vert.co[0] if frame_min_y>co[0]: frame_min_y=co[0]
if frame_min_z>vert.co[2]: frame_min_z=vert.co[2] if frame_max_y<co[0]: frame_max_y=co[0]
if frame_max_z<vert.co[2]: frame_max_z=vert.co[2] if frame_min_z>co[2]: frame_min_z=co[2]
if frame_max_z<co[2]: frame_max_z=co[2]
#the scale is the difference between the min and max (on that axis) / 255 #the scale is the difference between the min and max (on that axis) / 255
frame_scale_x=(frame_max_x-frame_min_x)/255 frame_scale_x=(frame_max_x-frame_min_x)/255
@@ -896,9 +898,10 @@ def fill_md2(md2, object):
#then translates the point so it's not less than 0 #then translates the point so it's not less than 0
#then scale it so it's between 0..255 #then scale it so it's between 0..255
#print "frame scale : ", frame_scale_x, " ", frame_scale_y, " ", frame_scale_z #print "frame scale : ", frame_scale_x, " ", frame_scale_y, " ", frame_scale_z
new_x=int((mesh.verts[vert_counter].co[1]-frame_trans_x)/frame_scale_x) co = mesh.verts[vert_counter].co
new_y=int((mesh.verts[vert_counter].co[0]-frame_trans_y)/frame_scale_y) new_x=int((co[1]-frame_trans_x)/frame_scale_x)
new_z=int((mesh.verts[vert_counter].co[2]-frame_trans_z)/frame_scale_z) new_y=int((co[0]-frame_trans_y)/frame_scale_y)
new_z=int((co[2]-frame_trans_z)/frame_scale_z)
#put them in the structure #put them in the structure
md2.frames[frame_counter].vertices[vert_counter].vertices=(new_x, new_y, new_z) md2.frames[frame_counter].vertices[vert_counter].vertices=(new_x, new_y, new_z)
@@ -908,14 +911,14 @@ def fill_md2(md2, object):
#swap y and x for difference in axis orientation #swap y and x for difference in axis orientation
x1=-mesh.verts[vert_counter].no[1] no = mesh.verts[vert_counter].no
y1=mesh.verts[vert_counter].no[0] x1= -no[1]
z1=mesh.verts[vert_counter].no[2] y1= no[0]
z1= no[2]
for j in xrange(0,162): for j in xrange(0,162):
#dot = (x[0]*y[0]+x[1]*y[1]+x[2]*y[2]) #dot = (x[0]*y[0]+x[1]*y[1]+x[2]*y[2])
dot = (x1*MD2_NORMALS[j][0]+ dot = (x1*MD2_NORMALS[j][0] + y1*MD2_NORMALS[j][1]+ z1*MD2_NORMALS[j][2]);
y1*MD2_NORMALS[j][1]+
z1*MD2_NORMALS[j][2]);
if (dot > maxdot): if (dot > maxdot):
maxdot = dot; maxdot = dot;
maxdotindex = j; maxdotindex = j;

View File

@@ -3,7 +3,7 @@
Name: 'Mirror Vertex Locations & Weight' Name: 'Mirror Vertex Locations & Weight'
Blender: 241 Blender: 241
Group: 'Mesh' Group: 'Mesh'
Tooltip: 'Snap Verticies to X mirrord locations and weights.' Tooltip: 'Snap Verticies to X mirrored locations and weights.'
""" """
__author__ = "Campbell Barton aka ideasman42" __author__ = "Campbell Barton aka ideasman42"
@@ -11,11 +11,11 @@ __url__ = ["www.blender.org", "blenderartists.org", "www.python.org"]
__version__= '1.0' __version__= '1.0'
__bpydoc__= '''\ __bpydoc__= '''\
This script is used to mirror vertex locations and weights This script is used to mirror vertex locations and weights
It is usefull if you have a model that was made symetrical It is useful if you have a model that was made symmetrical
but has verts that have moved from their mirrored locations slightly, but has verts that have moved from their mirrored locations slightly,
casuing blenders X-Mirror options not to work. causing blenders X-Mirror options not to work.
Weights can be mirrored too, this is usefull if you want to model 1 side of a mesh, copy the mesh and flip it. Weights can be mirrored too, this is useful if you want to model 1 side of a mesh, copy the mesh and flip it.
You can then use this script to mirror to the copy, even creating new flipped vertex groups, renaming group name left to right or .L to .R You can then use this script to mirror to the copy, even creating new flipped vertex groups, renaming group name left to right or .L to .R
Vertex positions are mirrored by doing a locational lookup, Vertex positions are mirrored by doing a locational lookup,

View File

@@ -3,7 +3,7 @@
Name: 'Poly Reduce Selection (Unsubsurf)' Name: 'Poly Reduce Selection (Unsubsurf)'
Blender: 245 Blender: 245
Group: 'Mesh' Group: 'Mesh'
Tooltip: 'pradictable mesh simplifaction maintaining face loops' Tooltip: 'predictable mesh simplifaction maintaining face loops'
""" """
from Blender import Scene, Mesh, Window, sys from Blender import Scene, Mesh, Window, sys
@@ -50,7 +50,7 @@ def my_mesh_util(me):
for edkey, count in edge_count.iteritems(): for edkey, count in edge_count.iteritems():
# Ignore verts that connect to edges with more then 2 faces. # Ignore verts that connect to edges with more than 2 faces.
if count != 2: if count != 2:
vert_faces[edkey[0]] = None vert_faces[edkey[0]] = None
vert_faces[edkey[1]] = None vert_faces[edkey[1]] = None

View File

@@ -52,7 +52,7 @@ A pop-up will provide further options, if the results of a method are not adequa
import Blender import Blender
import bpy import bpy
from Blender import Window from Blender import Window
from Blender.Mathutils import MidpointVecs, Vector, CrossVecs from Blender.Mathutils import MidpointVecs, Vector
from Blender.Mathutils import AngleBetweenVecs as _AngleBetweenVecs_ from Blender.Mathutils import AngleBetweenVecs as _AngleBetweenVecs_
import BPyMessages import BPyMessages
@@ -119,7 +119,7 @@ class edgeLoop(object):
# GENERATE AN AVERAGE NORMAL FOR THE WHOLE LOOP. # GENERATE AN AVERAGE NORMAL FOR THE WHOLE LOOP.
self.normal = Vector() self.normal = Vector()
for e in self.edges: for e in self.edges:
n = CrossVecs(self.centre-e.co1, self.centre-e.co2) n = (self.centre-e.co1).cross(self.centre-e.co2)
# Do we realy need tot normalize? # Do we realy need tot normalize?
n.normalize() n.normalize()
self.normal += n self.normal += n
@@ -149,7 +149,7 @@ class edgeLoop(object):
a = n1-n2 a = n1-n2
b = n1-n3 b = n1-n3
normal1 = CrossVecs(a,b) normal1 = a.cross(b)
normal1.normalize() normal1.normalize()
n1 = e.co2 n1 = e.co2
@@ -159,7 +159,7 @@ class edgeLoop(object):
a = n1-n2 a = n1-n2
b = n1-n3 b = n1-n3
normal2 = CrossVecs(a,b) normal2 = a.cross(b)
normal2.normalize() normal2.normalize()
# Reuse normal1 var # Reuse normal1 var

View File

@@ -164,8 +164,8 @@ class Fold:
sangle = Mathutils.AngleBetweenVecs(self.refPolyNormal, self.polyNormal) sangle = Mathutils.AngleBetweenVecs(self.refPolyNormal, self.polyNormal)
if(sangle!=sangle): if(sangle!=sangle):
sangle=0.0 sangle=0.0
ncp = Mathutils.CrossVecs(self.refPolyNormal, self.polyNormal) ncp = self.refPolyNormal.cross(self.polyNormal)
dp = Mathutils.DotVecs(ncp, self.edge.vector) dp = ncp.dot(self.edge.vector)
if(dp>0.0): if(dp>0.0):
return +sangle return +sangle
else: else:
@@ -855,7 +855,7 @@ class Poly:
p.resize3D() p.resize3D()
q = a-c q = a-c
q.resize3D() q.resize3D()
return CrossVecs(p,q) return p.cross(q)
def makeEdges(self): def makeEdges(self):
self.edges = [] self.edges = []
for i in xrange(self.nPoints()): for i in xrange(self.nPoints()):

View File

@@ -10,7 +10,7 @@ __url__= ["blender", "blenderartist"]
__version__= "1.0" __version__= "1.0"
__bpydoc__= """\ __bpydoc__= """\
This script takes the selected mesh objects, devides them into 2 groups This script takes the selected mesh objects, divides them into 2 groups
Cutters and The objects to be cut. Cutters and The objects to be cut.
Cutters are meshes with no faces, just edge loops. and any meshes with faces will be cut. Cutters are meshes with no faces, just edge loops. and any meshes with faces will be cut.
@@ -128,14 +128,14 @@ def sorted_indicies(i1, i2):
def fake_length2d(pt1, pt2): def fake_length2d(pt1, pt2):
''' '''
Only used for comparison so dont sqrt Only used for comparison so don't sqrt
''' '''
#return math.sqrt(abs(pow(x1-x2, 2)+ pow(y1-y2, 2))) #return math.sqrt(abs(pow(x1-x2, 2)+ pow(y1-y2, 2)))
return pow(pt1[0]-pt2[0], 2) + pow(pt1[1]- pt2[1], 2) return pow(pt1[0]-pt2[0], 2) + pow(pt1[1]- pt2[1], 2)
def length2d(pt1, pt2): def length2d(pt1, pt2):
''' '''
Only used for comparison so dont sqrt Only used for comparison so don't sqrt
''' '''
#return math.sqrt(abs(pow(x1-x2, 2)+ pow(y1-y2, 2))) #return math.sqrt(abs(pow(x1-x2, 2)+ pow(y1-y2, 2)))
return sqrt(pow(pt1[0]-pt2[0], 2) + pow(pt1[1]- pt2[1], 2)) return sqrt(pow(pt1[0]-pt2[0], 2) + pow(pt1[1]- pt2[1], 2))
@@ -150,7 +150,7 @@ def tri_area_2d(v1, v2, v3):
return 0.25 * sqrt(abs(p*(p-2*e1)*(p-2*e2)*(p-2*e3))) return 0.25 * sqrt(abs(p*(p-2*e1)*(p-2*e2)*(p-2*e3)))
def tri_pt_find_z_2d(pt, tri): def tri_pt_find_z_2d(pt, tri):
""" Takes a face and 3d vector and assigns teh vectors Z to its on the face""" """ Takes a face and 3d vector and assigns the vectors Z to its on the face"""
l1= tri_area_2d(tri[1], tri[2], pt) l1= tri_area_2d(tri[1], tri[2], pt)
l2= tri_area_2d(tri[0], tri[2], pt) l2= tri_area_2d(tri[0], tri[2], pt)
@@ -170,7 +170,7 @@ def tri_pt_find_z_2d(pt, tri):
def tri_pt_find_uv_2d(pt, tri, uvs): def tri_pt_find_uv_2d(pt, tri, uvs):
""" Takes a face and 3d vector and assigns teh vectors Z to its on the face""" """ Takes a face and 3d vector and assigns the vectors Z to its on the face"""
l1= tri_area_2d(tri[1], tri[2], pt) l1= tri_area_2d(tri[1], tri[2], pt)
l2= tri_area_2d(tri[0], tri[2], pt) l2= tri_area_2d(tri[0], tri[2], pt)
@@ -288,12 +288,12 @@ def terrain_cut_2d(t, c, PREF_Z_LOC):
# Loop through the cutter edges. # Loop through the cutter edges.
for ei_c, ed_c in enumerate(me_c.edges): for ei_c, ed_c in enumerate(me_c.edges):
# If the cutter edge has 2 verts inside the same face then we can ignore it # If the cutter edge has 2 verts inside the same face then we can ignore it
# Bothe are different faces or None # Both are different faces or None
if cut_vert_terrain_faces[ed_c.v1.index] != cut_vert_terrain_faces[ed_c.v2.index] or\ if cut_vert_terrain_faces[ed_c.v1.index] != cut_vert_terrain_faces[ed_c.v2.index] or\
cut_vert_terrain_faces[ed_c.v1.index] == cut_vert_terrain_faces[ed_c.v2.index] == None: cut_vert_terrain_faces[ed_c.v1.index] == cut_vert_terrain_faces[ed_c.v2.index] == None:
eb_c= c.edge_bounds[ei_c] eb_c= c.edge_bounds[ei_c]
if bounds_intersect(eb_t, eb_c): # face/edge bounds intersect? if bounds_intersect(eb_t, eb_c): # face/edge bounds intersect?
# Now we know the 2 edges might intersect, we'll do a propper test # Now we know the 2 edges might intersect, we'll do a proper test
x= LineIntersect2D(ed_t.v1.co, ed_t.v2.co, ed_c.v1.co, ed_c.v2.co) x= LineIntersect2D(ed_t.v1.co, ed_t.v2.co, ed_c.v1.co, ed_c.v2.co)
if x: if x:
@@ -340,7 +340,7 @@ def terrain_cut_2d(t, c, PREF_Z_LOC):
for f in faces: for f in faces:
faces_intersecting.setdefault(f.index, []).append(ed_isect) faces_intersecting.setdefault(f.index, []).append(ed_isect)
# this list is used to store edges that are totaly inside a face ( no intersections with terrain) # this list is used to store edges that are totally inside a face ( no intersections with terrain)
# we can remove these as we # we can remove these as we
face_containing_edges= [[] for i in xrange(len(me_t.faces))] face_containing_edges= [[] for i in xrange(len(me_t.faces))]
for ed_c in me_c.edges: for ed_c in me_c.edges:
@@ -412,8 +412,8 @@ def terrain_cut_2d(t, c, PREF_Z_LOC):
# edges that dont have a vert in the face have to span between to intersection points # edges that don't have a vert in the face have to span between to intersection points
# since we dont know the other point at any 1 time we need to remember edges that # since we don't know the other point at any 1 time we need to remember edges that
# span a face and add them once we'v collected both # span a face and add them once we'v collected both
# first add outline edges # first add outline edges
edge_span_face= {} edge_span_face= {}
@@ -507,7 +507,7 @@ def terrain_cut_2d(t, c, PREF_Z_LOC):
# 0,2,3 # 0,2,3
f_uv_mod= f_uv[0], f_uv[2], f_uv[3] f_uv_mod= f_uv[0], f_uv[2], f_uv[3]
f_vco_mod= f_vco[0], f_vco[2], f_vco[3] f_vco_mod= f_vco[0], f_vco[2], f_vco[3]
# else - side of 0,1,2 - dont modify the quad # else - side of 0,1,2 - don't modify the quad
uvs[i]= tri_pt_find_uv_2d(v_co, f_vco_mod, f_uv_mod) uvs[i]= tri_pt_find_uv_2d(v_co, f_vco_mod, f_uv_mod)
@@ -579,7 +579,7 @@ def main():
for ob in obs: for ob in obs:
if ob.type == 'Mesh': if ob.type == 'Mesh':
me= ob.getData(mesh=1) me= ob.getData(mesh=1)
elif ob.data.flag & 1: # Is the curve 3D? else dont use. elif ob.data.flag & 1: # Is the curve 3D? else don't use.
me= BPyMesh.getMeshFromObject(ob) # get the curve me= BPyMesh.getMeshFromObject(ob) # get the curve
else: else:
continue continue

View File

@@ -1,13 +1,13 @@
#!BPY #!BPY
""" """
Name: 'Drop Onto Ground' Name: 'Drop Onto Ground'
Blender: 245 Blender: 249
Group: 'Object' Group: 'Object'
Tooltip: 'Drop the selected objects onto "ground" objects' Tooltip: 'Drop the selected objects onto "ground" objects'
""" """
__author__= "Campbell Barton" __author__= "Campbell Barton"
__url__= ["blender.org", "blenderartists.org"] __url__= ["blender.org", "blenderartists.org"]
__version__= "1.0" __version__= "1.1"
__bpydoc__= """ __bpydoc__= """
""" """
@@ -36,6 +36,7 @@ __bpydoc__= """
from Blender import Draw, Geometry, Mathutils, Window from Blender import Draw, Geometry, Mathutils, Window
from Blender.Mathutils import Vector, AngleBetweenVecs, RotationMatrix
import bpy import bpy
@@ -44,6 +45,8 @@ GLOBALS['GROUND_SOURCE'] = [Draw.Create(1), Draw.Create(0)]
GLOBALS['GROUND_GROUP_NAME'] = Draw.Create('terrain') GLOBALS['GROUND_GROUP_NAME'] = Draw.Create('terrain')
GLOBALS['DROP_AXIS'] = [Draw.Create(1), Draw.Create(0)] # on what axis will we drop? GLOBALS['DROP_AXIS'] = [Draw.Create(1), Draw.Create(0)] # on what axis will we drop?
GLOBALS['DROP_OVERLAP_CHECK'] = Draw.Create(1) # is the terrain a single skin? GLOBALS['DROP_OVERLAP_CHECK'] = Draw.Create(1) # is the terrain a single skin?
GLOBALS['DROP_ORIENT'] = Draw.Create(1)
GLOBALS['DROP_ORIENT_VALUE'] = Draw.Create(100.0)
GLOBALS['EVENT'] = 2 GLOBALS['EVENT'] = 2
GLOBALS['MOUSE'] = None GLOBALS['MOUSE'] = None
@@ -52,19 +55,18 @@ def collect_terrain_triangles(obs_terrain):
me = bpy.data.meshes.new() me = bpy.data.meshes.new()
for ob in obs_terrain: for ob in obs_terrain:
# this matrix takes the object and drop matrix into account
ob_mat = ob.matrixWorld # * drop_matrix
def blend_face_to_terrain_tris(f): def blend_face_to_terrain_tris(f):
cos = [v.co*ob_mat for v in f] no = f.no
if len(cos) == 4: return [(cos[0], cos[1], cos[2]), (cos[0], cos[2], cos[3])] cos = [v.co for v in f]
else: return [(cos[0], cos[1], cos[2]), ] if len(cos) == 4: return [(cos[0], cos[1], cos[2], no), (cos[0], cos[2], cos[3], no)]
else: return [(cos[0], cos[1], cos[2], no), ]
# Clear # Clear
me.verts = None me.verts = None
try: me.getFromObject(ob) try: me.getFromObject(ob)
except: pass except: pass
me.transform(ob.matrixWorld)
for f in me.faces: # may be [], thats ok for f in me.faces: # may be [], thats ok
terrain_tris.extend( blend_face_to_terrain_tris(f) ) terrain_tris.extend( blend_face_to_terrain_tris(f) )
@@ -72,30 +74,34 @@ def collect_terrain_triangles(obs_terrain):
return terrain_tris return terrain_tris
def calc_drop_loc(ob, terrain_tris, axis): def calc_drop_loc(ob, terrain_tris, axis):
pt = Mathutils.Vector(ob.loc) pt = Vector(ob.loc)
isect = None isect = None
isect_best = None isect_best = None
isect_best_no = None
isect_best_len = 0.0 isect_best_len = 0.0
for t1,t2,t3 in terrain_tris: for t1,t2,t3, no in terrain_tris:
#if Geometry.PointInTriangle2D(pt, t1,t2,t3): #if Geometry.PointInTriangle2D(pt, t1,t2,t3):
isect = Mathutils.Intersect(t1, t2, t3, axis, pt, 1) # 1==clip isect = Mathutils.Intersect(t1, t2, t3, axis, pt, 1) # 1==clip
if isect: if isect:
if not GLOBALS['DROP_OVERLAP_CHECK'].val: if not GLOBALS['DROP_OVERLAP_CHECK'].val:
# Find the first location # Find the first location
return isect return isect, no
else: else:
if isect_best: if isect_best:
isect_len = (pt-isect).length isect_len = (pt-isect).length
if isect_len < isect_best_len: if isect_len < isect_best_len:
isect_best_len = isect_len isect_best_len = isect_len
isect_best = isect isect_best = isect
isect_best_no = no
else: else:
isect_best_len = (pt-isect).length isect_best_len = (pt-isect).length
isect_best = isect; isect_best = isect;
return isect_best isect_best_no = no
return isect_best, isect_best_no
def error_nogroup(): def error_nogroup():
@@ -135,13 +141,28 @@ def terrain_clamp(event, value):
if GLOBALS['DROP_AXIS'][0].val: if GLOBALS['DROP_AXIS'][0].val:
axis = Mathutils.Vector(0,0,-1) axis = Vector(0,0,-1)
else: else:
axis = Mathutils.Vector(Window.GetViewVector()) axis = Vector(Window.GetViewVector())
do_orient = GLOBALS['DROP_ORIENT'].val
do_orient_val = GLOBALS['DROP_ORIENT_VALUE'].val/100.0
if not do_orient_val: do_orient = False
for ob in obs_clamp: for ob in obs_clamp:
loc = calc_drop_loc(ob, terrain_tris, axis) loc, no = calc_drop_loc(ob, terrain_tris, axis)
if loc: if loc:
if do_orient:
try: ang = AngleBetweenVecs(no, axis)
except:ang = 0.0
if ang > 90.0:
no = -no
ang = 180.0-ang
if ang > 0.0001:
ob_matrix = ob.matrixWorld * RotationMatrix(ang * do_orient_val, 4, 'r', axis.cross(no))
ob.setMatrix(ob_matrix)
ob.loc = loc ob.loc = loc
# to make the while loop exist # to make the while loop exist
@@ -175,7 +196,8 @@ def do_ground_group_name(e,v):
if not g: error_nogroup() if not g: error_nogroup()
GLOBALS['EVENT'] = e GLOBALS['EVENT'] = e
def do_dummy(e,v):
GLOBALS['EVENT'] = e
EVENT_NONE = 0 EVENT_NONE = 0
EVENT_EXIT = 1 EVENT_EXIT = 1
@@ -185,7 +207,7 @@ def terain_clamp_ui():
# Only to center the UI # Only to center the UI
x,y = GLOBALS['MOUSE'] x,y = GLOBALS['MOUSE']
x-=40 x-=40
y-=60 y-=70
Draw.Label('Drop Axis', x-70,y+120, 60, 20) Draw.Label('Drop Axis', x-70,y+120, 60, 20)
Draw.BeginAlign() Draw.BeginAlign()
@@ -204,7 +226,13 @@ def terain_clamp_ui():
GLOBALS['DROP_OVERLAP_CHECK'] = Draw.Toggle('Overlapping Terrain', EVENT_NONE, x-70, y+20, 190, 20, GLOBALS['DROP_OVERLAP_CHECK'].val, "Check all terrain triangles and use the top most (slow)") GLOBALS['DROP_OVERLAP_CHECK'] = Draw.Toggle('Overlapping Terrain', EVENT_NONE, x-70, y+20, 190, 20, GLOBALS['DROP_OVERLAP_CHECK'].val, "Check all terrain triangles and use the top most (slow)")
Draw.PushButton('Drop Objects', EVENT_EXIT, x+20, y-10, 100, 20, 'Drop the selected objects', terrain_clamp) Draw.BeginAlign()
GLOBALS['DROP_ORIENT'] = Draw.Toggle('Orient Normal', EVENT_REDRAW, x-70, y-10, 110, 20, GLOBALS['DROP_ORIENT'].val, "Rotate objects to the face normal", do_dummy)
if GLOBALS['DROP_ORIENT'].val:
GLOBALS['DROP_ORIENT_VALUE'] = Draw.Number('', EVENT_NONE, x+40, y-10, 80, 20, GLOBALS['DROP_ORIENT_VALUE'].val, 0.0, 100.0, "Percentage to orient 0.0 - 100.0")
Draw.EndAlign()
Draw.PushButton('Drop Objects', EVENT_EXIT, x+20, y-40, 100, 20, 'Drop the selected objects', terrain_clamp)
# So moving the mouse outside the popup exits the while loop # So moving the mouse outside the popup exits the while loop
GLOBALS['EVENT'] = EVENT_EXIT GLOBALS['EVENT'] = EVENT_EXIT

View File

@@ -149,6 +149,7 @@ def read(filename):
'uint8': 'B', 'uint8': 'B',
'int16': 'h', 'int16': 'h',
'uint16': 'H', 'uint16': 'H',
'ushort': 'H',
'int': 'i', 'int': 'i',
'int32': 'i', 'int32': 'i',
'uint': 'I', 'uint': 'I',
@@ -156,6 +157,7 @@ def read(filename):
'float': 'f', 'float': 'f',
'float32': 'f', 'float32': 'f',
'float64': 'd', 'float64': 'd',
'double': 'd',
'string': 's'} 'string': 's'}
obj_spec = object_spec() obj_spec = object_spec()

View File

@@ -2,7 +2,7 @@
# coding: utf-8 # coding: utf-8
""" Registration info for Blender menus: <- these words are ignored """ Registration info for Blender menus: <- these words are ignored
Name: 'Deformed mesh to Rvk' Name: 'Deformed mesh to Rvk'
Blender: 243 Blender: 248
Group: 'Mesh' Group: 'Mesh'
Tip: 'Copy deform data (not surf. subdiv) of active obj to rvk of the 2nd selected obj' Tip: 'Copy deform data (not surf. subdiv) of active obj to rvk of the 2nd selected obj'
""" """
@@ -11,21 +11,24 @@ __author__ = "Jean-Michel Soler (jms)"
__url__ = ("blender", "blenderartists.org", __url__ = ("blender", "blenderartists.org",
"Script's homepage, http://jmsoler.free.fr/didacticiel/blender/tutor/cpl_rvk1versrvk2.htm", "Script's homepage, http://jmsoler.free.fr/didacticiel/blender/tutor/cpl_rvk1versrvk2.htm",
"Communicate problems and errors, http://www.zoo-logique.org/3D.Blender/newsportal/thread.php?group=3D.Blender") "Communicate problems and errors, http://www.zoo-logique.org/3D.Blender/newsportal/thread.php?group=3D.Blender")
__version__ = "2007/04/27" __version__ = "2009/05/18"
__bpydoc__ = """\ __bpydoc__ = """\
"DEFORM to RVK2" copies deform data (except EDGESPLIT,DECIMATE,SUBSURF,BOOLEAN, "DEFORM to RVK2" copies deformed data (except all data with not exactly
BUILD,MIRROR,ARRAY) of the active object to the RVK (relative vertex key) of the same number of vertices like EDGESPLIT,DECIMATE,SUBSURF, BOOLEAN,
the other selected object. BUILD, MIRROR, ARRAY) of the active object to the RVK (relative vertex
key, now called Shapes key) of the other selected object.
It is presupposed that the second mesh object is built exactly like the first It is presupposed that the second mesh object is built exactly like the first
one. In fact, it is better to use a true copy with at least one basic shape one. In fact, it is better to use a true copy with at least one basic shape
key. key. If there is no other object selected, the script can create a copy.
The new version of this scrit (Blender 2.43) manages the modifier changes. The new version of this scrit (Blender 2.43) manages the modifier changes.
There are a lot of modifiers but only the ones which just deforms the shape There are a lot of modifiers but only the ones which just deforms the shape
can be used : LATTICE, CURVE, WAVE, ARMATURE. You can unset these modifiers can be used : LATTICE, CURVE, WAVE, ARMATURE, CAST, DISPLACE, SMOOTH.
from the script. SIMPLEDEFORM and SHRINKWRAP are not correctly seen before Blender 2.49, but
they can be copied too. You can unset one or more of these modifiers from
the script.
Usage: Usage:
@@ -37,9 +40,9 @@ the rvk it will also ask whether it should replace or add a new vertex group.
""" """
#---------------------------------------------- #----------------------------------------------
# jm soler (c) 2004-2007 : 'Deformed mesh to Rvk' released under GPL licence # jm soler (c) 2004-2009 : 'Deformed mesh to Rvk'
# released under GPL licence
#---------------------------------------------- #----------------------------------------------
""" """
Ce programme est libre, vous pouvez le redistribuer et/ou Ce programme est libre, vous pouvez le redistribuer et/ou
@@ -72,11 +75,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
""" """
# Copy the rvk (1, or armature, lattice, or
# any mesh deformation except surface
# sbdivision) of the active object to rvk (2) of
# the second selected object. Create rvk or modify
# absolute key if needed.
#---------------------------------------------- #----------------------------------------------
# official Page : # official Page :
# http://jmsoler.free.fr/didacticiel/blender/tutor/cpl_rvk1versrvk2.htm # http://jmsoler.free.fr/didacticiel/blender/tutor/cpl_rvk1versrvk2.htm
@@ -90,7 +88,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Communiquer les problemes et erreurs sur: # Communiquer les problemes et erreurs sur:
# http://www.zoo-logique.org/3D.Blender/newsportal/thread.php?group=3D.Blender # http://www.zoo-logique.org/3D.Blender/newsportal/thread.php?group=3D.Blender
#--------------------------------------------- #---------------------------------------------
#---------------------------------------------
import Blender import Blender
from Blender import NMesh,Draw,Object,Modifier from Blender import NMesh,Draw,Object,Modifier
@@ -99,175 +96,246 @@ DEBUG=0
def Value(t): def Value(t):
exec "t=Modifier.Types.%s"%t exec "t=Modifier.Types.%s"%t
return t return t
def deform2rvk(): def copy_shapes(RVK1,RVK2):
POSSMOD_list=['EDGESPLIT', POSSMOD_list=['EDGESPLIT',
'DECIMATE', 'DECIMATE',
'SUBSURF', 'SUBSURF',
'BOOLEAN', 'BOOLEAN',
'BUILD', 'BUILD',
'MIRROR', 'MIRROR',
'ARRAY'] 'ARRAY',
'BEVEL',
'EXPLODE']
AUTHMOD_list=['LATTICE', AUTHMOD_list=['LATTICE',
'CURVE', 'CURVE',
'WAVE', 'WAVE',
'ARMATURE'] 'ARMATURE',
'SMOOTH',
MODIFIERS=0 'SIMPLEDEFORM',
'SHRINKWRAP',
'CAST',
'DISPLACE',
'MESHDEFORM']
BMOD=[['Possible Modifiers'], BMOD=[['Possible Modifiers'],
['Allowed Modifiers']] ['Allowed Modifiers']]
# =============================================================
# ================================================================= # must be 2 meshes ============================================
# at leat 2 objects =============================================== # =============================================================
# ================================================================= if RVK1.getType()=='Mesh' and RVK2.getType()=='Mesh':
if len(Object.GetSelected())>1 : #MODIFIERS=0
RVK1=Object.GetSelected()[0] FRAME=Blender.Get('curframe')
RVK2=Object.GetSelected()[1] DATA2=RVK2.getData()
# ============================================================= if DEBUG: print DATA2.getKey()
# must be 2 meshes ============================================ # ============================================================
# ============================================================= # at least the second must have a shape key ==================
if RVK1.getType()=='Mesh' and RVK2.getType()=='Mesh': # ============================================================
FRAME=Blender.Get('curframe') def select_modifier(RVK1, RVK2, DATA2):
# ======================================================
# in case of modifiers, use =============================
# ======================================================
if RVK1.modifiers:
#MODIFIERS=1
POSSMOD=[Value(t) for t in POSSMOD_list]
AUTHMOD=[Value(t) for t in AUTHMOD_list]
if DEBUG: print 'POSSMOD:',POSSMOD,'\nAUTHMOD:', AUTHMOD
MODRVK1=RVK1.modifiers
block = []
# ===================================================
# === Bloc Menu Modifiers ===1 doc =================
# ===================================================
m=0
for mod in MODRVK1:
if DEBUG: print mod.type
if mod.type in POSSMOD:
BMOD[0].append([Draw.Create(0),mod.type,
m,
POSSMOD_list[POSSMOD.index(mod.type)],
mod[Modifier.Settings.RENDER]==1,
mod[Modifier.Settings.EDITMODE]==1
])
elif mod.type in AUTHMOD:
BMOD[1].append([Draw.Create(1),
mod.type,
m,
AUTHMOD_list[AUTHMOD.index(mod.type)],
mod[Modifier.Settings.RENDER]==1,
mod[Modifier.Settings.EDITMODE]==1
])
m+=1
# ===================================================
# === Bloc Menu Modifiers ===2 display =============
# ===================================================
block.append(BMOD[1][0])
for B in BMOD[1][1:]:
block.append((B[3],B[0],""))
block.append(BMOD[0][0])
block.append("not alredy implemented")
block.append("in this script.")
for B in BMOD[0][1:]:
block.append((B[3],B[0],""))
retval = Blender.Draw.PupBlock("MESH 2 RVK", block)
# ===================================================
# === unset Modifiers =============================
# ===================================================
for B in BMOD[0][1:]:
if DEBUG: print B[2]
MODRVK1[B[2]][Modifier.Settings.RENDER]=0
for B in BMOD[1]:
if not B[1]:
MODRVK1[B[2]][Modifier.Settings.RENDER]=0
# ===================================================
# === update Modifiers =============================
# ===================================================
#RVK1.makeDisplayList()
# =======================================================
# === get deformed mesh ================================
# =======================================================
RVK1NAME=Object.GetSelected()[0].getName()
meshrvk1=NMesh.GetRawFromObject(RVK1NAME)
if DEBUG: print len(meshrvk1.verts)
# =======================================================
# === get normal mesh for vertex group =================
# =======================================================
DATA1=RVK1.getData()
# =======================================================
# === get destination mesh ============================
# =======================================================
DATA2=RVK2.getData() DATA2=RVK2.getData()
if DEBUG: print DATA2.getKey() if DEBUG: print len(meshrvk1.verts)
# ============================================================ if DEBUG: print len(DATA2.verts)
# at least the second must have a shape key ================== # ========================================================
# ============================================================ # ===== is there the same number of vertices =============
if DATA2.getKey(): # ========================================================
# ====================================================== if len(meshrvk1.verts)==len(DATA2.verts):
# in case of modifiers use ============================= name = "Do you want to replace or add vertex groups ? %t| YES %x1| NO ? %x2 "
# ====================================================== result = Draw.PupMenu(name)
if result==1:
# =====================================================
# ===== Do we save vertex groups ? ===================
# =====================================================
GROUPNAME2=DATA2.getVertGroupNames()
if len(GROUPNAME2)!=0:
for GROUP2 in GROUPNAME2:
DATA2.removeVertGroup(GROUP2)
GROUPNAME1=DATA1.getVertGroupNames()
if len(GROUPNAME1)!=0:
for GROUP1 in GROUPNAME1:
DATA2.addVertGroup(GROUP1)
DATA2.assignVertsToGroup(GROUP1,DATA1.getVertsFromGroup(GROUP1),1.0,'replace')
# ========================================================
# ===== now copy the vertices coords =====================
# ========================================================
for v in meshrvk1.verts:
i= meshrvk1.verts.index(v)
v1=DATA2.verts[i]
for n in [0,1,2]:
v1.co[n]=v.co[n]
DATA2.update()
DATA2.insertKey(FRAME,'relative')
DATA2.update()
RVK2.makeDisplayList()
if RVK1.modifiers: if RVK1.modifiers:
MODIFIERS=1
POSSMOD=[Value(t) for t in POSSMOD_list]
AUTHMOD=[Value(t) for t in AUTHMOD_list]
if DEBUG: print 'POSSMOD:',POSSMOD,'\nAUTHMOD:', AUTHMOD
MODRVK1=RVK1.modifiers
block = []
# ===================================================
# === Bloc Menu Modifiers ===1 doc =================
# ===================================================
m=0
for mod in MODRVK1:
if DEBUG: print mod.type
if mod.type in POSSMOD:
BMOD[0].append([Draw.Create(0),mod.type,
m,
POSSMOD_list[POSSMOD.index(mod.type)],
mod[Modifier.Settings.RENDER]==1,
mod[Modifier.Settings.EDITMODE]==1
])
elif mod.type in AUTHMOD:
BMOD[1].append([Draw.Create(1),
mod.type,
m,
AUTHMOD_list[AUTHMOD.index(mod.type)],
mod[Modifier.Settings.RENDER]==1,
mod[Modifier.Settings.EDITMODE]==1
])
m+=1
# ===================================================
# === Bloc Menu Modifiers ===2 display =============
# ===================================================
block.append(BMOD[1][0])
for B in BMOD[1][1:]:
block.append((B[3],B[0],""))
block.append(BMOD[0][0])
block.append("not alredy implemented")
block.append("in this script.")
for B in BMOD[0][1:]:
block.append((B[3],B[0],""))
retval = Blender.Draw.PupBlock("MESH 2 RVK", block)
# =================================================== # ===================================================
# === unset Modifiers ============================= # === unset Modifiers =============================
# =================================================== # ===================================================
for B in BMOD[0][1:]: for B in BMOD[0][1:]:
if DEBUG: print B[2] MODRVK1[B[2]][Modifier.Settings.RENDER]|=B[-2]
MODRVK1[B[2]][Modifier.Settings.RENDER]=0
for B in BMOD[1]: for B in BMOD[1]:
if not B[1]: if not B[1]:
MODRVK1[B[2]][Modifier.Settings.RENDER]=0
# ===================================================
# === update Modifiers =============================
# ===================================================
#RVK1.makeDisplayList()
# =======================================================
# === get deformed mesh ================================
# =======================================================
RVK1NAME=Object.GetSelected()[0].getName()
meshrvk1=NMesh.GetRawFromObject(RVK1NAME)
if DEBUG: print len(meshrvk1.verts)
# =======================================================
# === get normal mesh for vertex group =================
# =======================================================
DATA1=RVK1.getData()
# =======================================================
# === get destination mesh ============================
# =======================================================
DATA2=RVK2.getData()
if DEBUG: print len(meshrvk1.verts)
if DEBUG: print len(DATA2.verts)
# ========================================================
# ===== is there the same number of vertices =============
# ========================================================
if len(meshrvk1.verts)==len(DATA2.verts):
name = "Do you want to replace or add vertex groups ? %t| YES %x1| NO ? %x2 "
result = Draw.PupMenu(name)
if result==1:
# =====================================================
# ===== Do we save vertex groups ? ===================
# =====================================================
GROUPNAME2=DATA2.getVertGroupNames()
if len(GROUPNAME2)!=0:
for GROUP2 in GROUPNAME2:
DATA2.removeVertGroup(GROUP2)
GROUPNAME1=DATA1.getVertGroupNames()
if len(GROUPNAME1)!=0:
for GROUP1 in GROUPNAME1:
DATA2.addVertGroup(GROUP1)
DATA2.assignVertsToGroup(GROUP1,DATA1.getVertsFromGroup(GROUP1),1.0,'replace')
# ========================================================
# ===== now copy the vertices coords =====================
# ========================================================
for v in meshrvk1.verts:
i= meshrvk1.verts.index(v)
v1=DATA2.verts[i]
for n in [0,1,2]:
v1.co[n]=v.co[n]
DATA2.update()
DATA2.insertKey(FRAME,'relative')
DATA2.update()
RVK2.makeDisplayList()
if MODIFIERS:
# ===================================================
# === unset Modifiers =============================
# ===================================================
for B in BMOD[0][1:]:
MODRVK1[B[2]][Modifier.Settings.RENDER]|=B[-2] MODRVK1[B[2]][Modifier.Settings.RENDER]|=B[-2]
for B in BMOD[1]:
if not B[1]:
MODRVK1[B[2]][Modifier.Settings.RENDER]|=B[-2]
else:
name = "Meshes Objects must the same number of vertices %t| Ok. %x1"
result = Draw.PupMenu(name)
return
else: else:
name = "Second Object must have at least a shape key %t| Ok. %x1" name = "Meshes Objects must have the same number of vertices %t|Ok. %x1"
result = Draw.PupMenu(name) result = Draw.PupMenu(name)
return return
if DATA2.getKey():
select_modifier(RVK1, RVK2, DATA2)
else: else:
name = "Object must be Meshes %t| Ok. %x1" name = "Second Object must have at least a shape key %t| Ok. %x1| Add one ? %x2"
result = Draw.PupMenu(name) result = Draw.PupMenu(name)
return if result :
else : RVK2.insertShapeKey()
name = "At least 2 Meshes as to be selected %t| Ok. %x1" DATA2=RVK2.getData()
select_modifier(RVK1, RVK2, DATA2)
else:
return
else:
name = "Object must be Meshes %t| Ok. %x1"
result = Draw.PupMenu(name) result = Draw.PupMenu(name)
return return
def deform2rvk():
scn = Blender.Scene.GetCurrent()
# =================================================================
# at leat 2 objects ===============================================
# =================================================================
if len(scn.objects.selected) >1 :
RVK1 = Object.GetSelected()[0]
RVK2=Object.GetSelected()[1]
if RVK2.getType()=='Mesh' :
copy_shapes(RVK1,RVK2)
# =================================================================
# ... but if only one...===========================================
# =================================================================
elif len(scn.objects.selected)==1:
name = "At least 2 Meshes must be selected %t| Ok. %x1| Add one ? %x2"
result = Draw.PupMenu(name)
RVK1 = Object.GetSelected()[0]
if result and RVK1.getType()=='Mesh' :
Blender.Object.Duplicate(mesh=1)
RVK2=scn.objects.active
mod = RVK2.modifiers
for m in mod :
RVK2.modifiers.remove(m)
RVK2.LocX+=2.0
copy_shapes(RVK1,RVK2)
scn.objects.selected=[]
RVK2.sel=1
RVK1.sel=1
# ================================================================
# ... and not a mesh...===========================================
# ================================================================
elif result:
name = "Selected object must be a mesh %t| Ok. %x1"
result = Draw.PupMenu(name)
return
else :
return
# ================================================================
# ... if not object at all. =====================================
# ================================================================
else:
name = "At least one Mesh object must be selected %t| Ok. %x1"
result = Draw.PupMenu(name)
return
Blender.Redraw() Blender.Redraw()
EDITMODE=Blender.Window.EditMode() EDITMODE=Blender.Window.EditMode()
Blender.Window.EditMode(0) Blender.Window.EditMode(0)
deform2rvk() END = 0
Blender.Window.EditMode(EDITMODE) DEFAULT= Blender.Get('curframe')
while not END:
deform2rvk()
name = "Do you want to copy at a new frame %t| Yes ? %x1| No ? %x2"
result = Draw.PupMenu(name)
if result == 1:
msg = "Frame :"
inputresult = Draw.PupIntInput(msg, DEFAULT , Blender.Get('staframe'), Blender.Get('endframe'))
print inputresult
if inputresult != None:
Blender.Set('curframe',inputresult)
Blender.Window.RedrawAll()
else:
END = 1
else:
END = 1
Blender.Window.EditMode(EDITMODE)

View File

@@ -1,7 +1,7 @@
#!BPY #!BPY
""" """
Name: 'GameLogic Example' Name: 'GameLogic Example'
Blender: 245 Blender: 249
Group: 'ScriptTemplate' Group: 'ScriptTemplate'
Tooltip: 'Script template with examples of how to use game logic' Tooltip: 'Script template with examples of how to use game logic'
""" """
@@ -29,63 +29,63 @@ def main():
cont = GameLogic.getCurrentController() cont = GameLogic.getCurrentController()
# The KX_GameObject that owns this controller. # The KX_GameObject that owns this controller.
own = cont.getOwner() own = cont.owner
# for scripts that deal with spacial logic # for scripts that deal with spacial logic
own_pos = own.getPosition() own_pos = own.worldPosition
# Some example functions, remove to write your own script. # Some example functions, remove to write your own script.
# check for a positive sensor, will run on any object without errors. # check for a positive sensor, will run on any object without errors.
print 'Logic info for KX_GameObject', own.getName() print 'Logic info for KX_GameObject', own.name
input = False input = False
for sens in cont.getSensors(): for sens in cont.sensors:
# The sensor can be on another object, we may want to use it # The sensor can be on another object, we may want to use it
own_sens = sens.getOwner() own_sens = sens.owner
print ' sensor:', sens.getName(), print ' sensor:', sens.name,
if sens.isPositive(): if sens.positive:
print '(true)' print '(true)'
input = True input = True
else: else:
print '(false)' print '(false)'
for actu in cont.getActuators(): for actu in cont.actuators:
# The actuator can be on another object, we may want to use it # The actuator can be on another object, we may want to use it
own_actu = actu.getOwner() own_actu = actu.owner
print ' actuator:', actu.getName() print ' actuator:', actu.name
# This runs the actuator or turns it off # This runs the actuator or turns it off
# note that actuators will continue to run unless explicitly turned off. # note that actuators will continue to run unless explicitly turned off.
if input: if input:
GameLogic.addActiveActuator(actu, True) cont.activate(actu)
else: else:
GameLogic.addActiveActuator(actu, False) cont.deactivate(actu)
# Its also good practice to get sensors and actuators by names # Its also good practice to get sensors and actuators by name
# so any changes to their order wont break the script. # rather then index so any changes to their order wont break the script.
# sens_key = cont.getSensor('key_sensor') # sens_key = cont.sensors['key_sensor']
# actu_motion = cont.getActuator('motion') # actu_motion = cont.actuators['motion']
# Loop through all other objects in the scene # Loop through all other objects in the scene
sce = GameLogic.getCurrentScene() sce = GameLogic.getCurrentScene()
print 'Scene Objects:', sce.getName() print 'Scene Objects:', sce.name
for ob in sce.getObjectList(): for ob in sce.objects:
print ' ', ob.getName(), ob.getPosition() print ' ', ob.name, ob.worldPosition
# Example where collision objects are checked for their properties # Example where collision objects are checked for their properties
# adding to our objects "life" property # adding to our objects "life" property
""" """
actu_collide = cont.getSensor('collision_sens') actu_collide = cont.sensors['collision_sens']
for ob in actu_collide.getHitObjectList(): for ob in actu_collide.objectHitList:
# Check to see the object has this property # Check to see the object has this property
if hasattr(ob, 'life'): if ob.has_key('life'):
own.life += ob.life own['life'] += ob['life']
ob.life = 0 ob['life'] = 0
print own.life print own['life']
""" """
main() main()

View File

@@ -1,7 +1,7 @@
#!BPY #!BPY
""" """
Name: 'GameLogic Template' Name: 'GameLogic Template'
Blender: 245 Blender: 249
Group: 'ScriptTemplate' Group: 'ScriptTemplate'
Tooltip: 'Basic template for new game logic scripts' Tooltip: 'Basic template for new game logic scripts'
""" """
@@ -14,15 +14,15 @@ script_data = \
def main(): def main():
cont = GameLogic.getCurrentController() cont = GameLogic.getCurrentController()
own = cont.getOwner() own = cont.owner
sens = cont.getSensor('mySensor') sens = cont.sensors['mySensor']
actu = cont.getActuator('myActuator') actu = cont.actuators['myActuator']
if sens.isPositive(): if sens.positive:
GameLogic.addActiveActuator(actu, True) cont.activate(actu)
else: else:
GameLogic.addActiveActuator(actu, False) cont.deactivate(actu)
main() main()
''' '''

View File

@@ -46,7 +46,7 @@ import BPyWindow
mouseViewRay= BPyWindow.mouseViewRay mouseViewRay= BPyWindow.mouseViewRay
from Blender import Mathutils, Window, Scene, Draw, sys from Blender import Mathutils, Window, Scene, Draw, sys
from Blender.Mathutils import CrossVecs, Vector, Matrix, LineIntersect, Intersect #, AngleBetweenVecs, Intersect from Blender.Mathutils import Vector, Matrix, LineIntersect, Intersect #, AngleBetweenVecs, Intersect
LMB= Window.MButs.L LMB= Window.MButs.L
RMB= Window.MButs.R RMB= Window.MButs.R
@@ -229,7 +229,7 @@ def main():
y_axis_length = line_a_len y_axis_length = line_a_len
x_axis_length = (line_isect_b_pair[1]-face_corner_main).length x_axis_length = (line_isect_b_pair[1]-face_corner_main).length
proj_y_component = CrossVecs(proj_x_component, proj_z_component) proj_y_component = proj_x_component.cross(proj_z_component)
proj_y_component.length = 1/y_axis_length proj_y_component.length = 1/y_axis_length
proj_x_component.length = 1/x_axis_length proj_x_component.length = 1/x_axis_length

View File

@@ -43,7 +43,7 @@ selected faces, or all faces.
from Blender import Object, Draw, Window, sys, Mesh, Geometry from Blender import Object, Draw, Window, sys, Mesh, Geometry
from Blender.Mathutils import CrossVecs, Matrix, Vector, RotationMatrix, DotVecs from Blender.Mathutils import Matrix, Vector, RotationMatrix
import bpy import bpy
from math import cos from math import cos
@@ -96,7 +96,7 @@ def pointInTri2D(v, v1, v2, v3):
side1 = v2 - v1 side1 = v2 - v1
side2 = v3 - v1 side2 = v3 - v1
nor = CrossVecs(side1, side2) nor = side1.cross(side2)
l1 = [side1[0], side1[1], side1[2]] l1 = [side1[0], side1[1], side1[2]]
l2 = [side2[0], side2[1], side2[2]] l2 = [side2[0], side2[1], side2[2]]
@@ -804,11 +804,11 @@ def VectoMat(vec):
a3 = vec.__copy__().normalize() a3 = vec.__copy__().normalize()
up = Vector(0,0,1) up = Vector(0,0,1)
if abs(DotVecs(a3, up)) == 1.0: if abs(a3.dot(up)) == 1.0:
up = Vector(0,1,0) up = Vector(0,1,0)
a1 = CrossVecs(a3, up).normalize() a1 = a3.cross(up).normalize()
a2 = CrossVecs(a3, a1) a2 = a3.cross(a1)
return Matrix([a1[0], a1[1], a1[2]], [a2[0], a2[1], a2[2]], [a3[0], a3[1], a3[2]]) return Matrix([a1[0], a1[1], a1[2]], [a2[0], a2[1], a2[2]], [a3[0], a3[1], a3[2]])
@@ -1001,7 +1001,7 @@ def main():
for fIdx in xrange(len(tempMeshFaces)-1, -1, -1): for fIdx in xrange(len(tempMeshFaces)-1, -1, -1):
# Use half the angle limit so we dont overweight faces towards this # Use half the angle limit so we dont overweight faces towards this
# normal and hog all the faces. # normal and hog all the faces.
if DotVecs(newProjectVec, tempMeshFaces[fIdx].no) > USER_PROJECTION_LIMIT_HALF_CONVERTED: if newProjectVec.dot(tempMeshFaces[fIdx].no) > USER_PROJECTION_LIMIT_HALF_CONVERTED:
newProjectMeshFaces.append(tempMeshFaces.pop(fIdx)) newProjectMeshFaces.append(tempMeshFaces.pop(fIdx))
# Add the average of all these faces normals as a projectionVec # Add the average of all these faces normals as a projectionVec
@@ -1027,7 +1027,7 @@ def main():
# Get the closest vec angle we are to. # Get the closest vec angle we are to.
for p in projectVecs: for p in projectVecs:
temp_angle_diff= DotVecs(p, tempMeshFaces[fIdx].no) temp_angle_diff= p.dot(tempMeshFaces[fIdx].no)
if angleDifference < temp_angle_diff: if angleDifference < temp_angle_diff:
angleDifference= temp_angle_diff angleDifference= temp_angle_diff
@@ -1066,14 +1066,14 @@ def main():
i = len(projectVecs) i = len(projectVecs)
# Initialize first # Initialize first
bestAng = DotVecs(fvec, projectVecs[0]) bestAng = fvec.dot(projectVecs[0])
bestAngIdx = 0 bestAngIdx = 0
# Cycle through the remaining, first alredy done # Cycle through the remaining, first alredy done
while i-1: while i-1:
i-=1 i-=1
newAng = DotVecs(fvec, projectVecs[i]) newAng = fvec.dot(projectVecs[i])
if newAng > bestAng: # Reverse logic for dotvecs if newAng > bestAng: # Reverse logic for dotvecs
bestAng = newAng bestAng = newAng
bestAngIdx = i bestAngIdx = i

View File

@@ -45,7 +45,6 @@ import BPyMesh
def vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_RADIUS, PREF_MIN_EDLEN, PREF_CLAMP_CONCAVE, PREF_CLAMP_CONVEX, PREF_SHADOW_ONLY, PREF_SEL_ONLY): def vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_RADIUS, PREF_MIN_EDLEN, PREF_CLAMP_CONCAVE, PREF_CLAMP_CONVEX, PREF_SHADOW_ONLY, PREF_SEL_ONLY):
Window.WaitCursor(1) Window.WaitCursor(1)
DotVecs = Mathutils.DotVecs
Ang= Mathutils.AngleBetweenVecs Ang= Mathutils.AngleBetweenVecs
BPyMesh.meshCalcNormals(me) BPyMesh.meshCalcNormals(me)
@@ -63,7 +62,7 @@ def vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_RADIUS, PREF_MIN_EDLEN, PRE
for v in f.v: for v in f.v:
vno=v.no # get a scaled down normal. vno=v.no # get a scaled down normal.
dot= DotVecs(vno, v.co) - DotVecs(vno, fc) dot= vno.dot(v.co) - vno.dot(fc)
vert_tone_count[v.index]+=1 vert_tone_count[v.index]+=1
try: try:
a= Ang(vno, fno) a= Ang(vno, fno)
@@ -180,6 +179,10 @@ def main():
t= sys.time() t= sys.time()
vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_RADIUS, PREF_MIN_EDLEN, PREF_CLAMP_CONCAVE, PREF_CLAMP_CONVEX, PREF_SHADOW_ONLY, PREF_SEL_ONLY) vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_RADIUS, PREF_MIN_EDLEN, PREF_CLAMP_CONCAVE, PREF_CLAMP_CONVEX, PREF_SHADOW_ONLY, PREF_SEL_ONLY)
if ob.modifiers:
me.update()
print 'done in %.6f' % (sys.time()-t) print 'done in %.6f' % (sys.time()-t)
if __name__=='__main__': if __name__=='__main__':
main() main()

View File

@@ -39,7 +39,7 @@ __bpydoc__ = """\
import bpy import bpy
import Blender import Blender
import BPyMesh import BPyMesh
from Blender.Mathutils import Vector, Matrix, CrossVecs, AngleBetweenVecs, LineIntersect, TranslationMatrix, ScaleMatrix, RotationMatrix, Rand from Blender.Mathutils import Vector, Matrix, AngleBetweenVecs, LineIntersect, TranslationMatrix, ScaleMatrix, RotationMatrix, Rand
from Blender.Geometry import ClosestPointOnLine from Blender.Geometry import ClosestPointOnLine
from Blender.Noise import randuvec from Blender.Noise import randuvec
@@ -496,12 +496,12 @@ class tree:
# Align this with the existing branch # Align this with the existing branch
angle = AngleBetweenVecsSafe(zup, parent_pt.no) angle = AngleBetweenVecsSafe(zup, parent_pt.no)
cross = CrossVecs(zup, parent_pt.no) cross = zup.cross(parent_pt.no)
mat_align = RotationMatrix(angle, 3, 'r', cross) mat_align = RotationMatrix(angle, 3, 'r', cross)
# Use the bend on the point to work out which way to make the branch point! # Use the bend on the point to work out which way to make the branch point!
if parent_pt.prev: cross = CrossVecs(parent_pt.no, parent_pt.prev.no - parent_pt.no) if parent_pt.prev: cross = parent_pt.no.cross(parent_pt.prev.no - parent_pt.no)
else: cross = CrossVecs(parent_pt.no, parent_pt.next.no - parent_pt.no) else: cross = parent_pt.no.cross(parent_pt.next.no - parent_pt.no)
if parent_pt.branch.parent_pt: if parent_pt.branch.parent_pt:
angle = AngleBetweenVecsSafe(parent_pt.branch.parent_pt.no, parent_pt.no) angle = AngleBetweenVecsSafe(parent_pt.branch.parent_pt.no, parent_pt.no)
@@ -1065,8 +1065,8 @@ class tree:
l = line_normal.length l = line_normal.length
cross1 = CrossVecs( seg.no, line_normal ) cross1 = seg.no.cross(line_normal)
cross2 = CrossVecs( pt.no, line_normal ) cross2 = pt.no.cross(line_normal)
angle_line = min(AngleBetweenVecsSafe(cross1, cross2), AngleBetweenVecsSafe(cross1, -cross2)) angle_line = min(AngleBetweenVecsSafe(cross1, cross2), AngleBetweenVecsSafe(cross1, -cross2))
angle_leaf_no_diff = min(AngleBetweenVecsSafe(line_normal, seg.no), AngleBetweenVecsSafe(line_normal, -seg.no)) angle_leaf_no_diff = min(AngleBetweenVecsSafe(line_normal, seg.no), AngleBetweenVecsSafe(line_normal, -seg.no))
@@ -1914,8 +1914,8 @@ class tree:
# endpoints dont rotate # endpoints dont rotate
if pt.next != None: if pt.next != None:
cross1 = CrossVecs(zup, pt.no) # use this to offset the leaf later cross1 = zup.cross(pt.no) # use this to offset the leaf later
cross2 = CrossVecs(cross1, pt.no) cross2 = cross1.cross(pt.no)
if odd_even ==0: if odd_even ==0:
mat_yaw = RotationMatrix(leaf_branch_angle, 3, 'r', cross2) mat_yaw = RotationMatrix(leaf_branch_angle, 3, 'r', cross2)
else: else:
@@ -1939,7 +1939,7 @@ class tree:
# Randomize pitch and roll for the leaf # Randomize pitch and roll for the leaf
# work out the axis to pitch and roll # work out the axis to pitch and roll
cross1 = CrossVecs(zup, leaf_no) # use this to offset the leaf later cross1 = zup.cross(leaf_no) # use this to offset the leaf later
if leaf_branch_pitch_rand or leaf_branch_pitch_angle: if leaf_branch_pitch_rand or leaf_branch_pitch_angle:
angle = -leaf_branch_pitch_angle angle = -leaf_branch_pitch_angle
@@ -2480,7 +2480,7 @@ class bpoint(object):
def calcVerts(self): def calcVerts(self):
if self.prev == None: if self.prev == None:
if self.branch.parent_pt: if self.branch.parent_pt:
cross = CrossVecs(self.no, self.branch.parent_pt.no) * RotationMatrix(-45, 3, 'r', self.no) cross = self.no.cross(self.branch.parent_pt.no) * RotationMatrix(-45, 3, 'r', self.no)
else: else:
# parentless branch - for best results get a cross thats not the same as the normal, in rare cases this happens. # parentless branch - for best results get a cross thats not the same as the normal, in rare cases this happens.
@@ -2493,9 +2493,9 @@ class bpoint(object):
else: cross = xup else: cross = xup
else: else:
cross = CrossVecs(self.prev.vecs[0], self.no) cross = self.prev.vecs[0].cross(self.no)
self.vecs[0] = Blender.Mathutils.CrossVecs(self.no, cross) self.vecs[0] = self.no.cross(cross)
self.vecs[0].length = abs(self.radius) self.vecs[0].length = abs(self.radius)
mat = RotationMatrix(90, 3, 'r', self.no) mat = RotationMatrix(90, 3, 'r', self.no)
self.vecs[1] = self.vecs[0] * mat self.vecs[1] = self.vecs[0] * mat
@@ -2660,8 +2660,8 @@ class branch:
self_normal = self.bpoints[1].co - self.parent_pt.co self_normal = self.bpoints[1].co - self.parent_pt.co
# We only want the angle in relation to the parent points normal # We only want the angle in relation to the parent points normal
# modify self_normal to make this so # modify self_normal to make this so
cross = CrossVecs(self_normal, self.parent_pt.no) cross = self_normal.cross(self.parent_pt.no)
self_normal = CrossVecs(self.parent_pt.no, cross) # CHECK self_normal = self.parent_pt.no.cross(cross) # CHECK
#try: angle = AngleBetweenVecs(parent_normal, self_normal) #try: angle = AngleBetweenVecs(parent_normal, self_normal)
#except: return 0.0 #except: return 0.0
@@ -2670,7 +2670,7 @@ class branch:
# see if we need to rotate positive or negative # see if we need to rotate positive or negative
# USE DOT PRODUCT! # USE DOT PRODUCT!
cross = CrossVecs(parent_normal, self_normal) cross = parent_normal.cross(self_normal)
if AngleBetweenVecsSafe(cross, self.parent_pt.no) > 90: if AngleBetweenVecsSafe(cross, self.parent_pt.no) > 90:
angle = -angle angle = -angle
@@ -3018,7 +3018,7 @@ class branch:
scales = [] scales = []
for cos_ls in (cos1, cos2): for cos_ls in (cos1, cos2):
cross = CrossVecs(cos_ls[-1], zup) cross = cos_ls[-1].cross(zup)
mat = RotationMatrix(AngleBetweenVecsSafe(cos_ls[-1], zup), 3, 'r', cross) mat = RotationMatrix(AngleBetweenVecsSafe(cos_ls[-1], zup), 3, 'r', cross)
cos_ls[:] = [co*mat for co in cos_ls] cos_ls[:] = [co*mat for co in cos_ls]
@@ -3029,7 +3029,7 @@ class branch:
for co in cos_ls: for co in cos_ls:
xy_nor.x += co.x xy_nor.x += co.x
xy_nor.y += co.y xy_nor.y += co.y
cross = CrossVecs(xy_nor, xup) cross = xy_nor.cross(xup)
# Also scale them here so they are 1.0 tall always # Also scale them here so they are 1.0 tall always
scale = 1.0/(cos_ls[0]-cos_ls[-1]).length scale = 1.0/(cos_ls[0]-cos_ls[-1]).length

View File

@@ -1,234 +0,0 @@
#!BPY
"""
Name: 'xfig export (.fig)'
Blender: 244
Group: 'Export'
Tooltip: 'Export selected mesh to xfig Format (.fig)'
"""
__author__ = 'Dino Ghilardi', 'Campbell Barton AKA Ideasman42'
__url__ = ("blender", "blenderartists.org")
__version__ = "1.1"
__bpydoc__ = """\
This script exports the selected mesh to xfig (www.xfig.org) file format (i.e.: .fig)
The starting point of this script was Anthony D'Agostino's raw triangle format export.
(some code is still here and there, cut'n pasted from his script)
Usage:<br>
Select the mesh to be exported and run this script from "File->Export" menu.
The toggle button 'export 3 files' enables the generation of 4 files: one global
and three with the three different views of the object.
This script is licensed under the GPL license. (c) Dino Ghilardi, 2005
"""
# .fig export, mostly brutally cut-n pasted from the
# 'Raw triangle export' (Anthony D'Agostino, http://www.redrival.com/scorpius)|
import Blender
from Blender import Draw
import BPyObject
#, meshtools
import sys
import bpy
#import time
# =================================
# === Write xfig Format.===
# =================================
def collect_edges(edges):
"""Gets the max-min coordinates of the mesh"""
"""Getting the extremes of the mesh to be exported"""
maxX=maxY=maxZ = -1000000000
minX=minY=minZ = 1000000000
FGON= Blender.Mesh.EdgeFlags.FGON
me = bpy.data.meshes.new()
for ob_base in bpy.data.scenes.active.objects.context:
for ob in BPyObject.getDerivedObjects(ob_base):
me.verts = None
try: me.getFromObject(ob[0])
except: pass
if me.edges:
me.transform(ob[1])
for ed in me.edges:
if not ed.flag & FGON:
x,y,z = v1 = tuple(ed.v1.co)
maxX = max(maxX, x)
maxY = max(maxY, y)
maxZ = max(maxZ, z)
minX = min(minX, x)
minY = min(minY, y)
minZ = min(minZ, z)
x,y,z = v2 = tuple(ed.v2.co)
maxX = max(maxX, x)
maxY = max(maxY, y)
maxZ = max(maxZ, z)
minX = min(minX, x)
minY = min(minY, y)
minZ = min(minZ, z)
edges.append( (v1, v2) )
me.verts = None # free memory
return maxX,maxY,maxZ,minX,minY,minZ
def xfigheader(file):
file.write('#FIG 3.2 Produced by xfig version 3.2.5-alpha5\n')
file.write('Landscape\n')
file.write('Center\n')
file.write('Metric\n')
file.write('A4\n')
file.write('100.00\n')
file.write('Single\n')
file.write('-2\n')
file.write('1200 2\n')
def figdata(file, edges, expview, bounds, scale, space):
maxX,maxY,maxZ,minX,minY,minZ = bounds
def xytransform(ed):
"""gives the face vertexes coordinates in the xfig format/translation (view xy)"""
x1,y1,z1 = ed[0]
x2,y2,z2 = ed[1]
y1=-y1; y2=-y2
return x1,y1,z1,x2,y2,z2
def xztransform(ed):
"""gives the face vertexes coordinates in the xfig format/translation (view xz)"""
x1,y1,z1 = ed[0]
x2,y2,z2 = ed[1]
y1=-y1
y2=-y2
z1=-z1+maxZ-minY +space
z2=-z2+maxZ-minY +space
return x1,y1,z1,x2,y2,z2
def yztransform(ed):
"""gives the face vertexes coordinates in the xfig format/translation (view xz)"""
x1,y1,z1 = ed[0]
x2,y2,z2 = ed[1]
y1=-y1; y2=-y2
z1=-(z1-maxZ-maxX-space)
z2=-(z2-maxZ-maxX-space)
return x1,y1,z1,x2,y2,z2
def transform(ed, expview, scale):
if expview=='xy':
x1,y1,z1,x2,y2,z2 = xytransform(ed)
return int(x1*scale),int(y1*scale),int(x2*scale),int(y2*scale)
elif expview=='xz':
x1,y1,z1,x2,y2,z2 = xztransform(ed)
return int(x1*scale),int(z1*scale),int(x2*scale),int(z2*scale)
elif expview=='yz':
x1,y1,z1,x2,y2,z2 = yztransform(ed)
return int(z1*scale),int(y1*scale),int(z2*scale),int(y2*scale)
"""Prints all the xfig data (no header)"""
for ed in edges:
file.write('2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n')
file.write('\t %i %i %i %i\n' % transform(ed, expview, scale))
def writexy(edges, bounds, filename, scale, space):
"""writes the x-y view file exported"""
file = open(filename, 'wb')
xfigheader(file)
figdata(file, edges, 'xy', bounds, scale, space)
file.close()
print 'Successfully exported ', Blender.sys.basename(filename)# + seconds
def writexz(edges, bounds, filename, scale, space):
"""writes the x-z view file exported"""
#start = time.clock()
file = open(filename, 'wb')
xfigheader(file)
figdata(file, edges, 'xz', bounds, scale, space)
file.close()
print 'Successfully exported ', Blender.sys.basename(filename)# + seconds
def writeyz(edges, bounds, filename, scale, space):
"""writes the y-z view file exported"""
#start = time.clock()
file = open(filename, 'wb')
xfigheader(file)
figdata(file, edges, 'yz', bounds, scale, space)
file.close()
#end = time.clock()
#seconds = " in %.2f %s" % (end-start, "seconds")
print 'Successfully exported ', Blender.sys.basename(filename)# + seconds
def writeall(edges, bounds, filename, scale=450, space=2.0):
"""writes all 3 views
Every view is a combined object in the resulting xfig. file."""
maxX,maxY,maxZ,minX,minY,minZ = bounds
file = open(filename, 'wb')
xfigheader(file)
file.write('#upper view (7)\n')
file.write('6 % i % i % i % i ')
file.write('%.6f %.6f %.6f %.6f\n' % (minX, minY, maxX, maxY))
figdata(file, edges, 'xy', bounds, scale, space)
file.write('-6\n')
file.write('#bottom view (1)\n')
file.write('6 %i %i %i %i ')
file.write('%.6f %.6f %.6f %.6f\n' % (minX, -minZ+maxZ-minY +space, maxX,-maxZ+maxZ-minY +space))
figdata(file, edges, 'xz', bounds, scale, space)
file.write('-6\n')
file.write('#right view (3)\n')
file.write('6 %i %i %i %i ')
file.write('%.6f %.6f %.6f %.6f\n' % (minX, -minZ+maxZ-minY +space, maxX,-maxZ+maxZ-minY +space))
figdata(file, edges, 'yz', bounds, scale, space)
file.write('-6\n')
file.close()
print 'Successfully exported ', Blender.sys.basename(filename)# + seconds
import BPyMessages
def write_ui(filename):
if filename.lower().endswith('.fig'): filename = filename[:-4]
PREF_SEP= Draw.Create(0)
PREF_SCALE= Draw.Create(1200)
PREF_SPACE= Draw.Create(2.0)
block = [\
("Separate Files", PREF_SEP, "Export each view axis as a seperate file"),\
("Space: ", PREF_SPACE, 0.0, 10.0, "Space between views in blender units"),\
("Scale: ", PREF_SCALE, 10, 100000, "Scale, 1200 is a good default")]
if not Draw.PupBlock("Export FIG", block):
return
edges = []
bounds = collect_edges(edges)
if PREF_SEP.val:
writexy(edges, bounds, filename + '_XY.fig', PREF_SCALE.val, PREF_SPACE.val)
writexz(edges, bounds, filename + '_XZ.fig', PREF_SCALE.val, PREF_SPACE.val)
writeyz(edges, bounds, filename + '_YZ.fig', PREF_SCALE.val, PREF_SPACE.val)
writeall(edges, bounds, filename + '.fig', PREF_SCALE.val, PREF_SPACE.val)
if __name__ == '__main__':
Blender.Window.FileSelector(write_ui, 'Export XFIG', Blender.sys.makename(ext='.fig'))

View File

@@ -14,27 +14,40 @@ class DATA_PT_skeleton(DataButtonsPanel):
__label__ = "Skeleton" __label__ = "Skeleton"
def draw(self, context): def draw(self, context):
ob = context.object
arm = context.armature arm = context.armature
space = context.space_data
layout = self.layout layout = self.layout
layout.itemR(arm, "rest_position")
split = layout.split() split = layout.split(percentage=0.65)
sub = split.column() if ob:
sub.itemL(text="Deform:") split.template_ID(context, ob, "data")
sub.itemR(arm, "deform_vertexgroups", text="Vertes Groups") split.itemS()
sub.itemR(arm, "deform_envelope", text="Envelopes") elif arm:
sub.itemR(arm, "deform_quaternion", text="Quaternion") split.template_ID(context, space, "pin_id")
sub.itemR(arm, "deform_bbone_rest", text="B-Bones Rest") split.itemS()
#sub.itemR(arm, "x_axis_mirror")
#sub.itemR(arm, "auto_ik") if arm:
layout.itemS()
sub = split.column() layout.itemR(arm, "rest_position")
sub.itemL(text="Layers:")
sub.itemL(text="LAYERS") split = layout.split()
#sub.itemR(arm, "layer")
#sub.itemR(arm, "layer_protection") sub = split.column()
sub.itemL(text="Deform:")
sub.itemR(arm, "deform_vertexgroups", text="Vertes Groups")
sub.itemR(arm, "deform_envelope", text="Envelopes")
sub.itemR(arm, "deform_quaternion", text="Quaternion")
sub.itemR(arm, "deform_bbone_rest", text="B-Bones Rest")
#sub.itemR(arm, "x_axis_mirror")
#sub.itemR(arm, "auto_ik")
sub = split.column()
sub.itemL(text="Layers:")
sub.itemL(text="LAYERS")
#sub.itemR(arm, "layer")
#sub.itemR(arm, "layer_protection")
class DATA_PT_display(DataButtonsPanel): class DATA_PT_display(DataButtonsPanel):
__idname__ = "DATA_PT_display" __idname__ = "DATA_PT_display"

View File

@@ -9,45 +9,58 @@ class DataButtonsPanel(bpy.types.Panel):
def poll(self, context): def poll(self, context):
return (context.camera != None) return (context.camera != None)
class DATA_PT_cameralens(DataButtonsPanel): class DATA_PT_camera(DataButtonsPanel):
__idname__ = "DATA_PT_camera" __idname__ = "DATA_PT_camera"
__label__ = "Lens" __label__ = "Lens"
def draw(self, context): def draw(self, context):
ob = context.object
cam = context.camera cam = context.camera
space = context.space_data
layout = self.layout layout = self.layout
layout.itemR(cam, "type", expand=True) split = layout.split(percentage=0.65)
row = layout.row(align=True)
if cam.type == 'PERSP':
row.itemR(cam, "lens_unit", text="")
if cam.lens_unit == 'MILLIMETERS':
row.itemR(cam, "lens", text="Angle")
elif cam.lens_unit == 'DEGREES':
row.itemR(cam, "angle")
elif cam.type == 'ORTHO': if ob:
row.itemR(cam, "ortho_scale") split.template_ID(context, ob, "data")
split.itemS()
elif arm:
split.template_ID(context, space, "pin_id")
split.itemS()
if cam:
layout.itemS()
layout.itemR(cam, "type", expand=True)
split = layout.split() row = layout.row(align=True)
if cam.type == 'PERSP':
row.itemR(cam, "lens_unit", text="")
if cam.lens_unit == 'MILLIMETERS':
row.itemR(cam, "lens", text="Angle")
elif cam.lens_unit == 'DEGREES':
row.itemR(cam, "angle")
elif cam.type == 'ORTHO':
row.itemR(cam, "ortho_scale")
split = layout.split()
sub = split.column(align=True)
sub.itemL(text="Shift:")
sub.itemR(cam, "shift_x", text="X")
sub.itemR(cam, "shift_y", text="Y")
sub = split.column(align=True)
sub.itemL(text="Clipping:")
sub.itemR(cam, "clip_start", text="Start")
sub.itemR(cam, "clip_end", text="End")
row = layout.row()
row.itemR(cam, "dof_object")
row.itemR(cam, "dof_distance")
sub = split.column(align=True) class DATA_PT_camera_display(DataButtonsPanel):
sub.itemL(text="Shift:") __idname__ = "DATA_PT_camera_display"
sub.itemR(cam, "shift_x", text="X")
sub.itemR(cam, "shift_y", text="Y")
sub = split.column(align=True)
sub.itemL(text="Clipping:")
sub.itemR(cam, "clip_start", text="Start")
sub.itemR(cam, "clip_end", text="End")
row = layout.row()
row.itemR(cam, "dof_object")
row.itemR(cam, "dof_distance")
class DATA_PT_cameradisplay(DataButtonsPanel):
__idname__ = "DATA_PT_cameradisplay"
__label__ = "Display" __label__ = "Display"
def draw(self, context): def draw(self, context):
@@ -69,5 +82,5 @@ class DATA_PT_cameradisplay(DataButtonsPanel):
colsub.itemR(cam, "passepartout_alpha", text="Alpha", slider=True) colsub.itemR(cam, "passepartout_alpha", text="Alpha", slider=True)
col.itemR(cam, "draw_size", text="Size") col.itemR(cam, "draw_size", text="Size")
bpy.types.register(DATA_PT_cameralens) bpy.types.register(DATA_PT_camera)
bpy.types.register(DATA_PT_cameradisplay) bpy.types.register(DATA_PT_camera_display)

View File

@@ -11,13 +11,26 @@ class DataButtonsPanel(bpy.types.Panel):
return (ob and ob.type == 'CURVE' and context.curve) return (ob and ob.type == 'CURVE' and context.curve)
class DATA_PT_shape_curve(DataButtonsPanel): class DATA_PT_shape_curve(DataButtonsPanel):
__idname__ = "DATA_PT_shape_curve" __idname__ = "DATA_PT_shape_curve"
__label__ = "Shape" __label__ = "Shape"
def draw(self, context): def draw(self, context):
curve = context.curve ob = context.object
layout = self.layout curve = context.curve
space = context.space_data
layout = self.layout
split = layout.split(percentage=0.65)
if ob:
split.template_ID(context, ob, "data")
split.itemS()
elif curve:
split.template_ID(context, space, "pin_id")
split.itemS()
if curve:
layout.itemS()
layout.itemR(curve, "curve_2d") layout.itemR(curve, "curve_2d")
split = layout.split() split = layout.split()
@@ -46,85 +59,85 @@ class DATA_PT_shape_curve(DataButtonsPanel):
sub.itemR(curve, "vertex_normal_flip") sub.itemR(curve, "vertex_normal_flip")
class DATA_PT_geometry(DataButtonsPanel): class DATA_PT_geometry(DataButtonsPanel):
__idname__ = "DATA_PT_geometry" __idname__ = "DATA_PT_geometry"
__label__ = "Geometry" __label__ = "Geometry"
def draw(self, context): def draw(self, context):
curve = context.curve curve = context.curve
layout = self.layout layout = self.layout
split = layout.split() split = layout.split()
sub = split.column()
sub.itemL(text="Modification:")
sub.itemR(curve, "width")
sub.itemR(curve, "extrude")
sub.itemR(curve, "taper_object")
sub = split.column() sub = split.column()
sub.itemL(text="Modification:") sub.itemL(text="Bevel:")
sub.itemR(curve, "width") sub.itemR(curve, "bevel_depth", text="Depth")
sub.itemR(curve, "extrude") sub.itemR(curve, "bevel_resolution", text="Resolution")
sub.itemR(curve, "taper_object") sub.itemR(curve, "bevel_object")
sub = split.column()
sub.itemL(text="Bevel:")
sub.itemR(curve, "bevel_depth", text="Depth")
sub.itemR(curve, "bevel_resolution", text="Resolution")
sub.itemR(curve, "bevel_object")
class DATA_PT_pathanim(DataButtonsPanel): class DATA_PT_pathanim(DataButtonsPanel):
__idname__ = "DATA_PT_pathanim" __idname__ = "DATA_PT_pathanim"
__label__ = "Path Animation" __label__ = "Path Animation"
def draw_header(self, context):
curve = context.curve
layout = self.layout
layout.itemR(curve, "path", text="")
def draw(self, context):
curve = context.curve
layout = self.layout
layout.active = curve.path
def draw_header(self, context): split = layout.split()
curve = context.curve
sub = split.column()
sub.itemR(curve, "path_length", text="Frames")
sub.itemR(curve, "follow")
layout = self.layout sub = split.column()
layout.itemR(curve, "path", text="") sub.itemR(curve, "stretch")
sub.itemR(curve, "offset_path_distance", text="Offset Children")
def draw(self, context):
curve = context.curve
layout = self.layout
layout.active = curve.path
split = layout.split()
sub = split.column()
sub.itemR(curve, "path_length", text="Frames")
sub.itemR(curve, "follow")
sub = split.column()
sub.itemR(curve, "stretch")
sub.itemR(curve, "offset_path_distance", text="Offset Children")
class DATA_PT_current_curve(DataButtonsPanel): class DATA_PT_current_curve(DataButtonsPanel):
__idname__ = "DATA_PT_current_curve" __idname__ = "DATA_PT_current_curve"
__label__ = "Current Curve" __label__ = "Current Curve"
def draw(self, context): def draw(self, context):
currentcurve = context.curve.curves[0] # XXX currentcurve = context.curve.curves[0] # XXX
layout = self.layout layout = self.layout
split = layout.split() split = layout.split()
sub = split.column()
sub.itemL(text="Cyclic:")
sub.itemR(currentcurve, "cyclic_u", text="U")
sub.itemR(currentcurve, "cyclic_v", text="V")
sub.itemL(text="Order:")
sub.itemR(currentcurve, "order_u", text="U")
sub.itemR(currentcurve, "order_v", text="V")
sub.itemL(text="Endpoints:")
sub.itemR(currentcurve, "endpoint_u", text="U")
sub.itemR(currentcurve, "endpoint_v", text="V")
sub = split.column()
sub.itemL(text="Bezier:")
sub.itemR(currentcurve, "bezier_u", text="U")
sub.itemR(currentcurve, "bezier_v", text="V")
sub.itemL(text="Resolution:")
sub.itemR(currentcurve, "resolution_u", text="U")
sub.itemR(currentcurve, "resolution_v", text="V")
sub.itemL(text="Interpolation:")
sub.itemR(currentcurve, "tilt_interpolation", text="Tilt")
sub.itemR(currentcurve, "radius_interpolation", text="Tilt")
sub.itemR(currentcurve, "smooth")
sub = split.column()
sub.itemL(text="Cyclic:")
sub.itemR(currentcurve, "cyclic_u", text="U")
sub.itemR(currentcurve, "cyclic_v", text="V")
sub.itemL(text="Order:")
sub.itemR(currentcurve, "order_u", text="U")
sub.itemR(currentcurve, "order_v", text="V")
sub.itemL(text="Endpoints:")
sub.itemR(currentcurve, "endpoint_u", text="U")
sub.itemR(currentcurve, "endpoint_v", text="V")
sub = split.column()
sub.itemL(text="Bezier:")
sub.itemR(currentcurve, "bezier_u", text="U")
sub.itemR(currentcurve, "bezier_v", text="V")
sub.itemL(text="Resolution:")
sub.itemR(currentcurve, "resolution_u", text="U")
sub.itemR(currentcurve, "resolution_v", text="V")
sub.itemL(text="Interpolation:")
sub.itemR(currentcurve, "tilt_interpolation", text="Tilt")
sub.itemR(currentcurve, "radius_interpolation", text="Tilt")
sub.itemR(currentcurve, "smooth")
bpy.types.register(DATA_PT_shape_curve) bpy.types.register(DATA_PT_shape_curve)
bpy.types.register(DATA_PT_geometry) bpy.types.register(DATA_PT_geometry)
bpy.types.register(DATA_PT_pathanim) bpy.types.register(DATA_PT_pathanim)

View File

@@ -8,15 +8,38 @@ class DataButtonsPanel(bpy.types.Panel):
def poll(self, context): def poll(self, context):
return (context.lamp != None) return (context.lamp != None)
class DATA_PT_preview(DataButtonsPanel):
__idname__= "DATA_PT_preview"
__label__ = "Preview"
def draw(self, context):
layout = self.layout
lamp = context.lamp
layout.template_preview(lamp)
class DATA_PT_lamp(DataButtonsPanel): class DATA_PT_lamp(DataButtonsPanel):
__idname__ = "DATA_PT_lamp" __idname__ = "DATA_PT_lamp"
__label__ = "Lamp" __label__ = "Lamp"
def draw(self, context): def draw(self, context):
ob = context.object
lamp = context.lamp lamp = context.lamp
space = context.space_data
layout = self.layout layout = self.layout
split = layout.split(percentage=0.65)
if ob:
split.template_ID(context, ob, "data")
split.itemS()
elif lamp:
split.template_ID(context, space, "pin_id")
split.itemS()
layout.itemS()
layout.itemR(lamp, "type", expand=True) layout.itemR(lamp, "type", expand=True)
split = layout.split() split = layout.split()
@@ -218,9 +241,9 @@ class DATA_PT_falloff_curve(DataButtonsPanel):
layout.template_curve_mapping(lamp.falloff_curve) layout.template_curve_mapping(lamp.falloff_curve)
bpy.types.register(DATA_PT_preview)
bpy.types.register(DATA_PT_lamp) bpy.types.register(DATA_PT_lamp)
bpy.types.register(DATA_PT_shadow) bpy.types.register(DATA_PT_shadow)
bpy.types.register(DATA_PT_sunsky) bpy.types.register(DATA_PT_sunsky)
bpy.types.register(DATA_PT_spot) bpy.types.register(DATA_PT_spot)
bpy.types.register(DATA_PT_falloff_curve) bpy.types.register(DATA_PT_falloff_curve)

View File

@@ -14,23 +14,37 @@ class DATA_PT_lattice(DataButtonsPanel):
__label__ = "Lattice" __label__ = "Lattice"
def draw(self, context): def draw(self, context):
ob = context.object
lat = context.lattice lat = context.lattice
space = context.space_data
layout = self.layout layout = self.layout
row = layout.row() split = layout.split(percentage=0.65)
row.itemR(lat, "points_u")
row.itemR(lat, "interpolation_type_u", expand=True) if ob:
split.template_ID(context, ob, "data")
row = layout.row() split.itemS()
row.itemR(lat, "points_v") elif lat:
row.itemR(lat, "interpolation_type_v", expand=True) split.template_ID(context, space, "pin_id")
split.itemS()
row = layout.row()
row.itemR(lat, "points_w") if lat:
row.itemR(lat, "interpolation_type_w", expand=True) layout.itemS()
row = layout.row() row = layout.row()
row.itemR(lat, "outside") row.itemR(lat, "points_u")
row.itemR(lat, "shape_keys") row.itemR(lat, "interpolation_type_u", expand=True)
row = layout.row()
row.itemR(lat, "points_v")
row.itemR(lat, "interpolation_type_v", expand=True)
row = layout.row()
row.itemR(lat, "points_w")
row.itemR(lat, "interpolation_type_w", expand=True)
row = layout.row()
row.itemR(lat, "outside")
row.itemR(lat, "shape_keys")
bpy.types.register(DATA_PT_lattice) bpy.types.register(DATA_PT_lattice)

View File

@@ -9,13 +9,27 @@ class DataButtonsPanel(bpy.types.Panel):
def poll(self, context): def poll(self, context):
return (context.mesh != None) return (context.mesh != None)
class DATA_PT_surface(DataButtonsPanel): class DATA_PT_mesh(DataButtonsPanel):
__idname__ = "DATA_PT_surface" __idname__ = "DATA_PT_mesh"
__label__ = "Mesh" __label__ = "Mesh"
def draw(self, context): def draw(self, context):
mesh = context.mesh ob = context.object
layout = self.layout mesh = context.mesh
space = context.space_data
layout = self.layout
split = layout.split(percentage=0.65)
if ob:
split.template_ID(context, ob, "data")
split.itemS()
elif mesh:
split.template_ID(context, space, "pin_id")
split.itemS()
if mesh:
layout.itemS()
split = layout.split() split = layout.split()
@@ -29,5 +43,5 @@ class DATA_PT_surface(DataButtonsPanel):
sub.itemR(mesh, "double_sided") sub.itemR(mesh, "double_sided")
layout.itemR(mesh, "texco_mesh") layout.itemR(mesh, "texco_mesh")
bpy.types.register(DATA_PT_surface) bpy.types.register(DATA_PT_mesh)

View File

@@ -11,13 +11,26 @@ class DataButtonsPanel(bpy.types.Panel):
return (ob and ob.type == 'TEXT') return (ob and ob.type == 'TEXT')
class DATA_PT_shape_text(DataButtonsPanel): class DATA_PT_shape_text(DataButtonsPanel):
__idname__ = "DATA_PT_shape_text" __idname__ = "DATA_PT_shape_text"
__label__ = "Shape" __label__ = "Shape"
def draw(self, context): def draw(self, context):
curve = context.curve ob = context.object
layout = self.layout curve = context.curve
space = context.space_data
layout = self.layout
split = layout.split(percentage=0.65)
if ob:
split.template_ID(context, ob, "data")
split.itemS()
elif curve:
split.template_ID(context, space, "pin_id")
split.itemS()
if curve:
layout.itemS()
layout.itemR(curve, "curve_2d") layout.itemR(curve, "curve_2d")
split = layout.split() split = layout.split()

View File

@@ -13,6 +13,9 @@ class MATERIAL_PT_preview(MaterialButtonsPanel):
__idname__= "MATERIAL_PT_preview" __idname__= "MATERIAL_PT_preview"
__label__ = "Preview" __label__ = "Preview"
def poll(self, context):
return (context.material or context.object)
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@@ -23,18 +26,36 @@ class MATERIAL_PT_material(MaterialButtonsPanel):
__idname__= "MATERIAL_PT_material" __idname__= "MATERIAL_PT_material"
__label__ = "Material" __label__ = "Material"
def poll(self, context):
return (context.material or context.object)
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
mat = context.material mat = context.material
ob = context.object
layout.itemR(mat, "type", expand=True) slot = context.material_slot
space = context.space_data
row = layout.row() split = layout.split(percentage=0.65)
row.column().itemR(mat, "diffuse_color")
row.column().itemR(mat, "specular_color") if ob and slot:
row.column().itemR(mat, "mirror_color") split.template_ID(context, slot, "material", new="MATERIAL_OT_new")
split.itemR(ob, "active_material_index", text="Active")
elif mat:
split.template_ID(context, space, "pin_id")
split.itemS()
if mat:
layout.itemS()
layout.itemR(mat, "alpha", slider=True) layout.itemR(mat, "type", expand=True)
row = layout.row()
row.column().itemR(mat, "diffuse_color")
row.column().itemR(mat, "specular_color")
row.column().itemR(mat, "mirror_color")
layout.itemR(mat, "alpha", slider=True)
class MATERIAL_PT_sss(MaterialButtonsPanel): class MATERIAL_PT_sss(MaterialButtonsPanel):
__idname__= "MATERIAL_PT_sss" __idname__= "MATERIAL_PT_sss"

View File

@@ -4,7 +4,7 @@ import bpy
class ConstraintButtonsPanel(bpy.types.Panel): class ConstraintButtonsPanel(bpy.types.Panel):
__space_type__ = "BUTTONS_WINDOW" __space_type__ = "BUTTONS_WINDOW"
__region_type__ = "WINDOW" __region_type__ = "WINDOW"
__context__ = "object" __context__ = "constraint"
def draw_constraint(self, con): def draw_constraint(self, con):
layout = self.layout layout = self.layout
@@ -509,7 +509,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
class OBJECT_PT_constraints(ConstraintButtonsPanel): class OBJECT_PT_constraints(ConstraintButtonsPanel):
__idname__ = "OBJECT_PT_constraints" __idname__ = "OBJECT_PT_constraints"
__label__ = "Constraints" __label__ = "Constraints"
__context__ = "object" __context__ = "constraint"
def poll(self, context): def poll(self, context):
return (context.object != None) return (context.object != None)
@@ -527,8 +527,8 @@ class OBJECT_PT_constraints(ConstraintButtonsPanel):
class BONE_PT_constraints(ConstraintButtonsPanel): class BONE_PT_constraints(ConstraintButtonsPanel):
__idname__ = "BONE_PT_constraints" __idname__ = "BONE_PT_constraints"
__label__ = "Constraints" __label__ = "Bone Constraints"
__context__ = "bone" __context__ = "constraint"
def poll(self, context): def poll(self, context):
ob = context.object ob = context.object
@@ -547,5 +547,4 @@ class BONE_PT_constraints(ConstraintButtonsPanel):
self.draw_constraint(con) self.draw_constraint(con)
bpy.types.register(OBJECT_PT_constraints) bpy.types.register(OBJECT_PT_constraints)
bpy.types.register(BONE_PT_constraints) bpy.types.register(BONE_PT_constraints)

View File

@@ -6,8 +6,8 @@ def particle_panel_enabled(psys):
def particle_panel_poll(context): def particle_panel_poll(context):
psys = context.particle_system psys = context.particle_system
type = psys.settings.type if psys==None: return False
return psys != None and (type=='EMITTER' or type=='REACTOR'or type=='HAIR') return psys.settings.type in ('EMITTER', 'REACTOR', 'HAIR')
class ParticleButtonsPanel(bpy.types.Panel): class ParticleButtonsPanel(bpy.types.Panel):
__space_type__ = "BUTTONS_WINDOW" __space_type__ = "BUTTONS_WINDOW"
@@ -15,51 +15,89 @@ class ParticleButtonsPanel(bpy.types.Panel):
__context__ = "particle" __context__ = "particle"
def poll(self, context): def poll(self, context):
psys = context.particle_system return particle_panel_poll(context)
type = psys.settings.type
return psys != None and (type=='EMITTER' or type=='REACTOR'or type=='HAIR')
class PARTICLE_PT_particles(ParticleButtonsPanel): class PARTICLE_PT_particles(ParticleButtonsPanel):
__idname__= "PARTICLE_PT_particles" __idname__= "PARTICLE_PT_particles"
__label__ = "ParticleSystem" __label__ = "Particle System"
def poll(self, context): def poll(self, context):
return (context.particle_system != None) return (context.particle_system or context.object)
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
ob = context.object
psys = context.particle_system psys = context.particle_system
part = psys.settings
split = layout.split(percentage=0.65)
if psys:
split.template_ID(context, psys, "settings")
#if ob:
# split.itemR(ob, "active_particle_system_index", text="Active")
if psys:
#row = layout.row()
#row.itemL(text="Particle system datablock")
#row.itemL(text="Viewport")
#row.itemL(text="Render")
part = psys.settings
ptype = psys.settings.type
if ptype not in ('EMITTER', 'REACTOR', 'HAIR'):
layout.itemL(text="No settings for fluid particles")
return
row = layout.row()
row.enabled = particle_panel_enabled(psys)
row.itemR(part, "type")
row.itemR(psys, "seed")
row = layout.row()
if part.type=='HAIR':
if psys.editable==True:
row.itemO("PARTICLE_OT_editable_set", text="Free Edit")
else:
row.itemO("PARTICLE_OT_editable_set", text="Make Editable")
subrow = row.row()
subrow.enabled = particle_panel_enabled(psys)
subrow.itemR(part, "hair_step")
elif part.type=='REACTOR':
row.itemR(psys, "reactor_target_object")
row.itemR(psys, "reactor_target_particle_system", text="Particle System")
#row = layout.row() if psys:
#row.itemL(text="Particle system datablock") #row = layout.row()
#row.itemL(text="Viewport") #row.itemL(text="Particle system datablock")
#row.itemL(text="Render") #row.itemL(text="Viewport")
#row.itemL(text="Render")
type = psys.settings.type
part = psys.settings
if(type!='EMITTER' and type!='REACTOR' and type!='HAIR'): ptype = psys.settings.type
layout.itemL(text="No settings for fluid particles")
return if ptype not in ('EMITTER', 'REACTOR', 'HAIR'):
layout.itemL(text="No settings for fluid particles")
row = layout.row() return
row.enabled = particle_panel_enabled(psys)
row.itemR(part, "type") row = layout.row()
row.itemR(psys, "seed") row.enabled = particle_panel_enabled(psys)
row.itemR(part, "type", expand=True)
row = layout.row()
if part.type=='HAIR':
if psys.editable==True: row = layout.row()
row.itemO("PARTICLE_OT_editable_set", text="Free Edit") if part.type=='HAIR':
else: if psys.editable==True:
row.itemO("PARTICLE_OT_editable_set", text="Make Editable") row.itemO("PARTICLE_OT_editable_set", text="Free Edit")
subrow = row.row() else:
subrow.enabled = particle_panel_enabled(psys) row.itemO("PARTICLE_OT_editable_set", text="Make Editable")
subrow.itemR(part, "hair_step") subrow = row.row()
elif part.type=='REACTOR': subrow.enabled = particle_panel_enabled(psys)
row.itemR(psys, "reactor_target_object") subrow.itemR(part, "hair_step")
row.itemR(psys, "reactor_target_particle_system", text="Particle System") elif part.type=='REACTOR':
row.itemR(psys, "reactor_target_object")
row.itemR(psys, "reactor_target_particle_system", text="Particle System")
class PARTICLE_PT_emission(ParticleButtonsPanel): class PARTICLE_PT_emission(ParticleButtonsPanel):
__idname__= "PARTICLE_PT_emission" __idname__= "PARTICLE_PT_emission"
@@ -76,7 +114,7 @@ class PARTICLE_PT_emission(ParticleButtonsPanel):
row = layout.row() row = layout.row()
#col.itemL(text="TODO: Rate instead of amount") #col.itemL(text="TODO: Rate instead of amount")
row.itemR(part, "amount") row.itemR(part, "amount")
row.itemL(text="") row.itemR(psys, "seed")
split = layout.split() split = layout.split()
@@ -88,14 +126,35 @@ class PARTICLE_PT_emission(ParticleButtonsPanel):
col.itemR(part, "lifetime") col.itemR(part, "lifetime")
col.itemR(part, "random_lifetime", slider=True) col.itemR(part, "random_lifetime", slider=True)
layout.row().itemL(text="Emit From:")
row = layout.row()
row.itemR(part, "emit_from", expand=True)
row = layout.row()
row.itemR(part, "trand")
if part.distribution!='GRID':
row.itemR(part, "even_distribution")
if part.emit_from=='FACE' or part.emit_from=='VOLUME':
row = layout.row()
row.itemR(part, "distribution", expand=True)
row = layout.row()
if part.distribution=='JIT':
row.itemR(part, "userjit", text="Particles/Face")
row.itemR(part, "jitter_factor", text="Jittering Amount", slider=True)
elif part.distribution=='GRID':
row.itemR(part, "grid_resolution")
class PARTICLE_PT_cache(ParticleButtonsPanel): class PARTICLE_PT_cache(ParticleButtonsPanel):
__idname__= "PARTICLE_PT_cache" __idname__= "PARTICLE_PT_cache"
__label__ = "Cache" __label__ = "Cache"
def poll(self, context): def poll(self, context):
psys = context.particle_system psys = context.particle_system
type = psys.settings.type if psys==None: return False
return psys != None and (type=='EMITTER' or type== 'REACTOR') return psys.settings.type in ('EMITTER', 'REACTOR')
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@@ -113,11 +172,10 @@ class PARTICLE_PT_cache(ParticleButtonsPanel):
row.itemR(cache, "end_frame") row.itemR(cache, "end_frame")
#layout.row().itemL(text="No simulation frames in disk cache.") #layout.row().itemL(text="No simulation frames in disk cache.")
class PARTICLE_PT_initial(ParticleButtonsPanel): class PARTICLE_PT_initial(ParticleButtonsPanel):
__idname__= "PARTICLE_PT_initial" __idname__= "PARTICLE_PT_initial"
__label__ = "Initial values" __label__ = "Velocity"
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@@ -127,82 +185,55 @@ class PARTICLE_PT_initial(ParticleButtonsPanel):
layout.enabled = particle_panel_enabled(psys) layout.enabled = particle_panel_enabled(psys)
layout.row().itemL(text="Location from:")
box = layout.box()
row = box.row()
row.itemR(part, "trand")
col = row.column()
col.row().itemR(part, "emit_from", expand=True)
if part.emit_from=='FACE' or part.emit_from=='VOLUME':
row = box.row()
if part.distribution!='GRID':
row.itemR(part, "even_distribution")
else:
row.itemL(text="")
row.itemR(part, "distribution", expand=True)
row = box.row()
if part.distribution=='JIT':
row.itemR(part, "userjit", text="Particles/Face")
row.itemR(part, "jitter_factor", text="Jittering Amount", slider=True)
elif part.distribution=='GRID':
row.itemR(part, "grid_resolution")
#layout.row().itemL(text="") #layout.row().itemL(text="")
layout.row().itemL(text="Velocity:") layout.row().itemL(text="Direction:")
box = layout.box()
row = box.row() split = layout.split()
col = row.column()
col.itemR(part, "normal_factor") sub = split.column()
sub.itemR(part, "normal_factor")
if part.emit_from=='PARTICLE': if part.emit_from=='PARTICLE':
col.itemR(part, "particle_factor") sub.itemR(part, "particle_factor")
else: else:
col.itemR(part, "object_factor", slider=True) sub.itemR(part, "object_factor", slider=True)
col.itemR(part, "random_factor") sub.itemR(part, "random_factor")
sub.itemR(part, "tangent_factor")
sub.itemR(part, "tangent_phase", slider=True)
col = row.column(align=True) sub = split.column()
col.itemL(text="TODO:") sub.itemL(text="TODO:")
col.itemL(text="Object aligned") sub.itemL(text="Object aligned")
col.itemL(text="direction: X, Y, Z") sub.itemL(text="direction: X, Y, Z")
row = box.row()
col = row.column(align=True)
col.itemR(part, "tangent_factor")
col.itemR(part, "tangent_phase", slider=True)
col = row.column(align=True)
if part.type=='REACTOR': if part.type=='REACTOR':
col.itemR(part, "reactor_factor") sub.itemR(part, "reactor_factor")
col.itemR(part, "reaction_shape", slider=True) sub.itemR(part, "reaction_shape", slider=True)
else: else:
col.itemL(text="") sub.itemL(text="")
layout.row().itemL(text="Rotation:") layout.row().itemL(text="Rotation:")
box = layout.box() split = layout.split()
box.row().itemR(part, "rotation_dynamic")
sub = split.column()
row = box.row() sub.itemR(part, "rotation_mode", text="Axis")
col = row.column(align=True) split = layout.split()
col.itemR(part, "rotation_mode", text="")
col.itemR(part, "random_rotation_factor", slider=True) sub = split.column()
col = row.column(align=True) sub.itemR(part, "rotation_dynamic")
col.itemR(part, "phase_factor", slider=True) sub.itemR(part, "random_rotation_factor", slider=True)
col.itemR(part, "random_phase_factor", text="Random", slider=True) sub = split.column()
sub.itemR(part, "phase_factor", slider=True)
sub.itemR(part, "random_phase_factor", text="Random", slider=True)
layout.row().itemL(text="Angular velocity:")
box = layout.box() layout.row().itemL(text="Angular velocity:")
row = box.row() layout.row().itemR(part, "angular_velocity_mode", expand=True)
row.itemR(part, "angular_velocity_mode", expand=True) split = layout.split()
row.itemR(part, "angular_velocity_factor", text="")
sub = split.column()
sub.itemR(part, "angular_velocity_factor", text="")
class PARTICLE_PT_physics(ParticleButtonsPanel): class PARTICLE_PT_physics(ParticleButtonsPanel):
__idname__= "PARTICLE_PT_physics" __idname__= "PARTICLE_PT_physics"
@@ -215,56 +246,50 @@ class PARTICLE_PT_physics(ParticleButtonsPanel):
part = psys.settings part = psys.settings
layout.enabled = layout.enabled = particle_panel_enabled(psys) layout.enabled = layout.enabled = particle_panel_enabled(psys)
layout.itemR(part, "effector_group")
layout.itemL(text="General:")
box = layout.box()
row = box.row()
col = row.column(align=True)
col.itemR(part, "particle_size")
col.itemR(part, "random_size", slider=True)
col = row.column(align=True)
col.itemR(part, "mass")
col.itemR(part, "sizemass", text="Multiply mass with size")
layout.row().itemL(text="")
row = layout.row() row = layout.row()
row.itemL(text="Physics Type:")
row.itemR(part, "physics_type", expand=True) row.itemR(part, "physics_type", expand=True)
if part.physics_type != 'NO': if part.physics_type != 'NO':
box = layout.box() layout.itemR(part, "effector_group")
row = box.row()
if part.physics_type == 'NEWTON': row = layout.row()
row.itemR(part, "integrator")
row = box.row()
col = row.column(align=True) col = row.column(align=True)
col.itemL(text="Forces:") col.itemR(part, "particle_size")
col.itemR(part, "brownian_factor") col.itemR(part, "random_size", slider=True)
col.itemR(part, "drag_factor", slider=True) col = row.column(align=True)
col.itemR(part, "damp_factor", slider=True) col.itemR(part, "mass")
col.itemR(part, "sizemass", text="Multiply mass with size")
split = layout.split()
sub = split.column()
if part.physics_type == 'NEWTON':
sub.itemL(text="Forces:")
sub.itemR(part, "brownian_factor")
sub.itemR(part, "drag_factor", slider=True)
sub.itemR(part, "damp_factor", slider=True)
sub.itemR(part, "integrator")
sub = split.column()
sub.itemR(part, "acceleration")
row.column().itemR(part, "acceleration")
elif part.physics_type == 'KEYED': elif part.physics_type == 'KEYED':
row.itemR(psys, "keyed_first") sub.itemR(psys, "keyed_first")
if psys.keyed_first==True: if psys.keyed_first==True:
row.itemR(psys, "timed_keys", text="Key timing") sub.itemR(psys, "timed_keys", text="Key timing")
else: else:
row.itemR(part, "keyed_time") sub.itemR(part, "keyed_time")
sub = split.column()
row = box.row() sub.itemL(text="Next key from object:")
row.itemL(text="Next key from object:") sub.itemR(psys, "keyed_object", text="")
row.itemR(psys, "keyed_object", text="") sub.itemR(psys, "keyed_particle_system")
row.itemR(psys, "keyed_particle_system")
if part.physics_type=='NEWTON' or part.physics_type=='BOIDS': if part.physics_type=='NEWTON' or part.physics_type=='BOIDS':
row = box.row()
row.itemR(part, "size_deflect") sub.itemR(part, "size_deflect")
row.itemR(part, "die_on_collision") sub.itemR(part, "die_on_collision")
row.itemR(part, "sticky") sub.itemR(part, "sticky")
class PARTICLE_PT_render(ParticleButtonsPanel): class PARTICLE_PT_render(ParticleButtonsPanel):
__idname__= "PARTICLE_PT_render" __idname__= "PARTICLE_PT_render"
@@ -279,24 +304,29 @@ class PARTICLE_PT_render(ParticleButtonsPanel):
psys = context.particle_system psys = context.particle_system
part = psys.settings part = psys.settings
row = layout.row() layout.itemR(part, "material")
row.itemR(part, "material")
col = row.column() split = layout.split()
col.itemR(part, "emitter");
col.itemR(part, "parent"); sub = split.column()
col = row.column() sub.itemR(part, "emitter");
col.itemR(part, "unborn"); sub.itemR(part, "parent");
col.itemR(part, "died"); sub = split.column()
sub.itemR(part, "unborn");
sub.itemR(part, "died");
row = layout.row() row = layout.row()
row.itemR(part, "ren_as", expand=True) row.itemR(part, "ren_as", expand=True)
row = layout.row(align=True) split = layout.split()
sub = split.column()
if part.ren_as == 'LINE': if part.ren_as == 'LINE':
row.itemR(part, "line_length_tail") sub.itemR(part, "line_length_tail")
row.itemR(part, "line_length_head") sub.itemR(part, "line_length_head")
row.itemR(part, "velocity_length") sub = split.column()
sub.itemR(part, "velocity_length")
elif part.ren_as == 'PATH': elif part.ren_as == 'PATH':
if (part.type!='HAIR' and psys.point_cache.baked==False): if (part.type!='HAIR' and psys.point_cache.baked==False):
@@ -304,14 +334,23 @@ class PARTICLE_PT_render(ParticleButtonsPanel):
box.itemL(text="Baked or keyed particles needed for correct rendering.") box.itemL(text="Baked or keyed particles needed for correct rendering.")
return return
row.itemR(part, "hair_bspline") sub.itemR(part, "render_strand")
row.itemR(part, "render_step", text="Steps") colsub = sub.column()
colsub.active = part.render_strand == False
row = layout.row() colsub.itemR(part, "render_adaptive")
row.itemR(part, "abs_length") colsub = sub.column()
col = row.column(align=True) colsub.active = part.render_adaptive or part.render_strand == True
col.itemR(part, "absolute_length") colsub.itemR(part, "adaptive_angle")
col.itemR(part, "random_length", slider=True) colsub = sub.column()
colsub.active = part.render_adaptive == True and part.render_strand == False
colsub.itemR(part, "adaptive_pix")
sub.itemR(part, "hair_bspline")
sub.itemR(part, "render_step", text="Steps")
sub = split.column()
sub.itemL(text="Length:")
sub.itemR(part, "abs_length", text="Absolute")
sub.itemR(part, "absolute_length", text="Maximum")
sub.itemR(part, "random_length", text="Random", slider=True)
#row = layout.row() #row = layout.row()
#row.itemR(part, "timed_path") #row.itemR(part, "timed_path")
@@ -322,18 +361,18 @@ class PARTICLE_PT_render(ParticleButtonsPanel):
row = layout.row() row = layout.row()
col = row.column() col = row.column()
col.itemR(part, "render_strand")
subrow = col.row()
subrow.active = part.render_strand == False # subrow = col.row()
subrow.itemR(part, "render_adaptive") # subrow.active = part.render_strand == False
col = row.column(align=True) # subrow.itemR(part, "render_adaptive")
subrow = col.row() # col = row.column(align=True)
subrow.active = part.render_adaptive or part.render_strand == True # subrow = col.row()
subrow.itemR(part, "adaptive_angle") # subrow.active = part.render_adaptive or part.render_strand == True
subrow = col.row() # subrow.itemR(part, "adaptive_angle")
subrow.active = part.render_adaptive == True and part.render_strand == False # subrow = col.row()
subrow.itemR(part, "adaptive_pix") # subrow.active = part.render_adaptive == True and part.render_strand == False
# subrow.itemR(part, "adaptive_pix")
if part.type=='HAIR' and part.render_strand==True and part.child_type=='FACES': if part.type=='HAIR' and part.render_strand==True and part.child_type=='FACES':
layout.itemR(part, "enable_simplify") layout.itemR(part, "enable_simplify")
@@ -351,21 +390,24 @@ class PARTICLE_PT_render(ParticleButtonsPanel):
elif part.ren_as == 'OBJECT': elif part.ren_as == 'OBJECT':
row.itemR(part, "dupli_object") #sub = split.column()
sub.itemR(part, "dupli_object")
elif part.ren_as == 'GROUP': elif part.ren_as == 'GROUP':
sub.itemR(part, "dupli_group")
split = layout.split() split = layout.split()
col = split.column() sub = split.column()
row = col.row() sub.itemR(part, "whole_group")
row.itemR(part, "whole_group") sub = split.column()
subcol = row.column() colsub = sub.column()
subcol.active = part.whole_group == False colsub.active = part.whole_group == False
subcol.itemR(part, "rand_group") colsub.itemR(part, "rand_group")
split.column().itemR(part, "dupli_group", text="")
elif part.ren_as == 'BILLBOARD': elif part.ren_as == 'BILLBOARD':
row.itemL(text="Align:") sub.itemL(text="Align:")
row.itemR(part, "billboard_lock", text="Lock")
row = layout.row() row = layout.row()
row.itemR(part, "billboard_align", expand=True) row.itemR(part, "billboard_align", expand=True)
row.itemR(part, "billboard_lock", text="Lock")
row = layout.row() row = layout.row()
row.itemR(part, "billboard_object") row.itemR(part, "billboard_object")
@@ -395,7 +437,7 @@ class PARTICLE_PT_render(ParticleButtonsPanel):
class PARTICLE_PT_draw(ParticleButtonsPanel): class PARTICLE_PT_draw(ParticleButtonsPanel):
__idname__= "PARTICLE_PT_draw" __idname__= "PARTICLE_PT_draw"
__label__ = "Draw" __label__ = "Display"
def poll(self, context): def poll(self, context):
return (context.particle_system != None) return (context.particle_system != None)
@@ -444,7 +486,6 @@ class PARTICLE_PT_draw(ParticleButtonsPanel):
subcol.active = part.material_color==False subcol.active = part.material_color==False
#subcol.itemL(text="color") #subcol.itemL(text="color")
#subcol.itemL(text="Override material color") #subcol.itemL(text="Override material color")
class PARTICLE_PT_children(ParticleButtonsPanel): class PARTICLE_PT_children(ParticleButtonsPanel):
__idname__= "PARTICLE_PT_children" __idname__= "PARTICLE_PT_children"
@@ -464,7 +505,7 @@ class PARTICLE_PT_children(ParticleButtonsPanel):
row = layout.row() row = layout.row()
col = row.column(align=True) col = row.column(align=True)
col.itemR(part, "child_nbr", text="Draw") col.itemR(part, "child_nbr", text="Display")
col.itemR(part, "rendered_child_nbr", text="Render") col.itemR(part, "rendered_child_nbr", text="Render")
col = row.column(align=True) col = row.column(align=True)
@@ -505,13 +546,14 @@ class PARTICLE_PT_children(ParticleButtonsPanel):
layout.row().itemL(text="Kink:") layout.row().itemL(text="Kink:")
layout.row().itemR(part, "kink", expand=True) layout.row().itemR(part, "kink", expand=True)
row = layout.row() split = layout.split()
row.itemR(part, "kink_amplitude")
row.itemR(part, "kink_frequency")
row.itemR(part, "kink_shape", slider=True)
sub = split.column()
sub.itemR(part, "kink_amplitude")
sub.itemR(part, "kink_frequency")
sub = split.column()
sub.itemR(part, "kink_shape", slider=True)
class PARTICLE_PT_vertexgroups(ParticleButtonsPanel): class PARTICLE_PT_vertexgroups(ParticleButtonsPanel):
__idname__= "PARTICLE_PT_vertexgroups" __idname__= "PARTICLE_PT_vertexgroups"
__label__ = "Vertexgroups" __label__ = "Vertexgroups"
@@ -586,4 +628,3 @@ bpy.types.register(PARTICLE_PT_render)
bpy.types.register(PARTICLE_PT_draw) bpy.types.register(PARTICLE_PT_draw)
bpy.types.register(PARTICLE_PT_children) bpy.types.register(PARTICLE_PT_children)
bpy.types.register(PARTICLE_PT_vertexgroups) bpy.types.register(PARTICLE_PT_vertexgroups)

View File

@@ -44,28 +44,58 @@ class RENDER_PT_output(RenderButtonsPanel):
split = layout.split() split = layout.split()
col = split.column() col = split.column()
col.itemR(rd, "file_format", text="Format") col.itemR(rd, "file_extensions")
if rd.file_format in ("AVIJPEG", "JPEG"):
col.itemR(rd, "quality", slider=True)
sub = split.column()
sub.itemR(rd, "color_mode")
sub.itemR(rd, "alpha_mode")
split = layout.split()
sub = split.column()
sub.itemR(rd, "file_extensions")
sub.itemL(text="Distributed Rendering:")
sub.itemR(rd, "placeholders")
sub.itemR(rd, "no_overwrite")
col = split.column()
col.itemR(rd, "fields", text="Fields") col.itemR(rd, "fields", text="Fields")
colsub = col.column() colsub = col.column()
colsub.active = rd.fields colsub.active = rd.fields
colsub.itemR(rd, "fields_still", text="Still") colsub.itemR(rd, "fields_still", text="Still")
colsub.row().itemR(rd, "field_order", expand=True) colsub.row().itemR(rd, "field_order", expand=True)
col = split.column()
col.itemR(rd, "color_mode")
col.itemR(rd, "alpha_mode")
col.itemL(text="Distributed Rendering:")
col.itemR(rd, "placeholders")
col.itemR(rd, "no_overwrite")
layout.itemR(rd, "file_format", text="Format")
split = layout.split()
col = split.column()
if rd.file_format in ("AVIJPEG", "JPEG"):
col.itemR(rd, "quality", slider=True)
elif rd.file_format in ("OPENEXR"):
col.itemR(rd, "exr_codec")
col.itemR(rd, "exr_half")
col = split.column()
col.itemR(rd, "exr_zbuf")
col.itemR(rd, "exr_preview")
elif rd.file_format in ("JPEG2000"):
row = layout.row()
row.itemR(rd, "jpeg_preset")
split = layout.split()
col = split.column()
col.itemL(text="Depth:")
col.row().itemR(rd, "jpeg_depth", expand=True)
col = split.column()
col.itemR(rd, "jpeg_ycc")
col.itemR(rd, "exr_preview")
elif rd.file_format in ("CINEON", "DPX"):
col.itemR(rd, "cineon_log", text="Convert to Log")
colsub = col.column()
colsub.active = rd.cineon_log
colsub.itemR(rd, "cineon_black", text="Black")
colsub.itemR(rd, "cineon_white", text="White")
colsub.itemR(rd, "cineon_gamma", text="Gamma")
elif rd.file_format in ("TIFF"):
col.itemR(rd, "tiff_bit")
class RENDER_PT_antialiasing(RenderButtonsPanel): class RENDER_PT_antialiasing(RenderButtonsPanel):
__label__ = "Anti-Aliasing" __label__ = "Anti-Aliasing"
@@ -209,13 +239,15 @@ class RENDER_PT_stamp(RenderButtonsPanel):
sub = split.column() sub = split.column()
sub.itemR(rd, "render_stamp") sub.itemR(rd, "render_stamp")
sub.itemR(rd, "stamp_foreground") colsub = sub.column()
sub.itemR(rd, "stamp_background") colsub.active = rd.render_stamp
sub.itemR(rd, "stamp_font_size", text="Font Size") colsub.itemR(rd, "stamp_foreground")
colsub.itemR(rd, "stamp_background")
colsub.itemR(rd, "stamp_font_size", text="Font Size")
bpy.types.register(RENDER_PT_render) bpy.types.register(RENDER_PT_render)
bpy.types.register(RENDER_PT_dimensions) bpy.types.register(RENDER_PT_dimensions)
bpy.types.register(RENDER_PT_antialiasing) bpy.types.register(RENDER_PT_antialiasing)
bpy.types.register(RENDER_PT_shading) bpy.types.register(RENDER_PT_shading)
bpy.types.register(RENDER_PT_output) bpy.types.register(RENDER_PT_output)
bpy.types.register(RENDER_PT_stamp) bpy.types.register(RENDER_PT_stamp)

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