Merged changes in the trunk up to revision 49478.

Conflicts resolved:
source/blender/blenkernel/intern/library.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/interface/resources.c
source/blender/makesrna/intern/rna_scene.c
This commit is contained in:
Tamito Kajiyama 2012-08-02 00:10:05 +00:00
commit 4ea2fb8b0a
479 changed files with 10450 additions and 7473 deletions

@ -280,8 +280,10 @@ if 'blenderlite' in B.targets:
if env['OURPLATFORM']=='darwin': if env['OURPLATFORM']=='darwin':
print B.bc.OKGREEN + "Detected Xcode version: -- " + B.bc.ENDC + env['XCODE_CUR_VER'] + " --" print B.bc.OKGREEN + "Detected Xcode version: -- " + B.bc.ENDC + env['XCODE_CUR_VER'] + " --"
print "Available " + env['MACOSX_SDK_CHECK'] print "Available " + env['MACOSX_SDK_CHECK']
if not 'Mac OS X 10.5' in env['MACOSX_SDK_CHECK']: if not 'Mac OS X 10.6' in env['MACOSX_SDK_CHECK']:
print B.bc.OKGREEN + "MacOSX10.5.sdk not available:" + B.bc.ENDC + " using MacOSX10.6.sdk" print B.bc.OKGREEN + "Auto-setting available MacOSX SDK -> " + B.bc.ENDC + "MacOSX10.7.sdk"
elif not 'Mac OS X 10.5' in env['MACOSX_SDK_CHECK']:
print B.bc.OKGREEN + "Auto-setting available MacOSX SDK -> " + B.bc.ENDC + "MacOSX10.6.sdk"
else: else:
print B.bc.OKGREEN + "Found recommended sdk :" + B.bc.ENDC + " using MacOSX10.5.sdk" print B.bc.OKGREEN + "Found recommended sdk :" + B.bc.ENDC + " using MacOSX10.5.sdk"

@ -32,6 +32,8 @@ elif cmd_res[:2]=='10':
MAC_CUR_VER='10.6' MAC_CUR_VER='10.6'
elif cmd_res[:2]=='11': elif cmd_res[:2]=='11':
MAC_CUR_VER='10.7' MAC_CUR_VER='10.7'
elif cmd_res[:2]=='12':
MAC_CUR_VER='10.8'
cmd = 'xcodebuild -version' cmd = 'xcodebuild -version'
cmd_xcode=commands.getoutput(cmd) cmd_xcode=commands.getoutput(cmd)
XCODE_CUR_VER=cmd_xcode[6:][:3] # truncate output to major.minor version XCODE_CUR_VER=cmd_xcode[6:][:3] # truncate output to major.minor version
@ -75,7 +77,7 @@ else :
LCGDIR = '#../lib/darwin-9.x.universal' LCGDIR = '#../lib/darwin-9.x.universal'
CC = 'gcc-4.2' CC = 'gcc-4.2'
CXX = 'g++-4.2' CXX = 'g++-4.2'
else: elif 'Mac OS X 10.6' in MACOSX_SDK_CHECK:
# OSX 10.6/7 with Xcode 4.x # OSX 10.6/7 with Xcode 4.x
MAC_MIN_VERS = '10.6' MAC_MIN_VERS = '10.6'
MACOSX_DEPLOYMENT_TARGET = '10.6' MACOSX_DEPLOYMENT_TARGET = '10.6'
@ -83,6 +85,14 @@ else :
LCGDIR = '#../lib/darwin-9.x.universal' LCGDIR = '#../lib/darwin-9.x.universal'
CC = 'gcc-4.2' CC = 'gcc-4.2'
CXX = 'g++-4.2' CXX = 'g++-4.2'
else:
# OSX 10.8 with Xcode 4.4 and higher (no 10.6sdk! )
MAC_MIN_VERS = '10.6'
MACOSX_DEPLOYMENT_TARGET = '10.6'
MACOSX_SDK='/Developer/SDKs/MacOSX10.7.sdk'
LCGDIR = '#../lib/darwin-9.x.universal'
CC = 'gcc'
CXX = 'g++'
LIBDIR = '${LCGDIR}' LIBDIR = '${LCGDIR}'
@ -333,8 +343,8 @@ if not WITH_OSX_STATICPYTHON:
#note to build succesfully on 10.3.9 SDK you need to patch 10.3.9 by adding the SystemStubs.a lib from 10.4 #note to build succesfully on 10.3.9 SDK you need to patch 10.3.9 by adding the SystemStubs.a lib from 10.4
#for 10.7.sdk, SystemStubs needs to be excluded (lib doesn't exist anymore) #for > 10.7.sdk, SystemStubs needs to be excluded (lib doesn't exist anymore)
if MACOSX_DEPLOYMENT_TARGET == '10.7': if MACOSX_SDK.endswith("10.7.sdk") or MACOSX_SDK.endswith("10.8.sdk"):
LLIBS = ['stdc++'] LLIBS = ['stdc++']
else: else:
LLIBS = ['stdc++', 'SystemStubs'] LLIBS = ['stdc++', 'SystemStubs']

@ -693,12 +693,24 @@ def UnixPyBundle(target=None, source=None, env=None):
run("rm -r '%s/turtle.py'" % py_target) run("rm -r '%s/turtle.py'" % py_target)
run("rm -f '%s/lib-dynload/_tkinter.so'" % py_target) run("rm -f '%s/lib-dynload/_tkinter.so'" % py_target)
if env['WITH_BF_PYTHON_INSTALL_NUMPY']:
numpy_src = py_src + "/site-packages/numpy"
numpy_target = py_target + "/site-packages/numpy"
if os.path.exists(numpy_src):
print 'Install numpy from:'
print '\t"%s" into...' % numpy_src
print '\t"%s"\n' % numpy_target
run("cp -R '%s' '%s'" % (numpy_src, os.path.dirname(numpy_target)))
else:
print 'Failed to find numpy at %s, skipping copying' % numpy_src
run("find '%s' -type d -name 'test' -prune -exec rm -rf {} ';'" % py_target) run("find '%s' -type d -name 'test' -prune -exec rm -rf {} ';'" % py_target)
run("find '%s' -type d -name '__pycache__' -exec rm -rf {} ';'" % py_target) run("find '%s' -type d -name '__pycache__' -exec rm -rf {} ';'" % py_target)
run("find '%s' -name '*.py[co]' -exec rm -rf {} ';'" % py_target) run("find '%s' -name '*.py[co]' -exec rm -rf {} ';'" % py_target)
run("find '%s' -name '*.so' -exec strip -s {} ';'" % py_target) run("find '%s' -name '*.so' -exec strip -s {} ';'" % py_target)
#### END ACTION STUFF ######### #### END ACTION STUFF #########
def bsc(env, target, source): def bsc(env, target, source):

@ -135,7 +135,7 @@ def validate_arguments(args, bc):
'BF_CXX', 'WITH_BF_STATICCXX', 'BF_CXX_LIB_STATIC', 'BF_CXX', 'WITH_BF_STATICCXX', 'BF_CXX_LIB_STATIC',
'BF_TWEAK_MODE', 'BF_SPLIT_SRC', 'BF_TWEAK_MODE', 'BF_SPLIT_SRC',
'WITHOUT_BF_INSTALL', 'WITHOUT_BF_INSTALL',
'WITHOUT_BF_PYTHON_INSTALL', 'WITHOUT_BF_PYTHON_UNPACK', 'WITHOUT_BF_PYTHON_INSTALL', 'WITHOUT_BF_PYTHON_UNPACK', 'WITH_BF_PYTHON_INSTALL_NUMPY'
'WITHOUT_BF_OVERWRITE_INSTALL', 'WITHOUT_BF_OVERWRITE_INSTALL',
'WITH_BF_OPENMP', 'BF_OPENMP', 'BF_OPENMP_LIBPATH', 'WITH_BF_OPENMP', 'BF_OPENMP', 'BF_OPENMP_LIBPATH',
'WITH_GHOST_COCOA', 'WITH_GHOST_COCOA',
@ -520,6 +520,7 @@ def read_opts(env, cfg, args):
(BoolVariable('BF_SPLIT_SRC', 'Split src lib into several chunks if true', False)), (BoolVariable('BF_SPLIT_SRC', 'Split src lib into several chunks if true', False)),
(BoolVariable('WITHOUT_BF_INSTALL', 'dont install if true', False)), (BoolVariable('WITHOUT_BF_INSTALL', 'dont install if true', False)),
(BoolVariable('WITHOUT_BF_PYTHON_INSTALL', 'dont install Python modules if true', False)), (BoolVariable('WITHOUT_BF_PYTHON_INSTALL', 'dont install Python modules if true', False)),
(BoolVariable('WITH_BF_PYTHON_INSTALL_NUMPY', 'install Python mumpy module', False)),
(BoolVariable('WITHOUT_BF_PYTHON_UNPACK', 'dont remove and unpack Python modules everytime if true', False)), (BoolVariable('WITHOUT_BF_PYTHON_UNPACK', 'dont remove and unpack Python modules everytime if true', False)),
(BoolVariable('WITHOUT_BF_OVERWRITE_INSTALL', 'dont remove existing files before breating the new install directory (set to False when making packages for others)', False)), (BoolVariable('WITHOUT_BF_OVERWRITE_INSTALL', 'dont remove existing files before breating the new install directory (set to False when making packages for others)', False)),
(BoolVariable('BF_FANCY', 'Enable fancy output if true', True)), (BoolVariable('BF_FANCY', 'Enable fancy output if true', True)),

@ -172,7 +172,7 @@ General functions
Restarts the current game by reloading the .blend file (the last saved version, not what is currently running). Restarts the current game by reloading the .blend file (the last saved version, not what is currently running).
.. function:: LibLoad(blend, type, data, load_actions=False, verbose=False) .. function:: LibLoad(blend, type, data, load_actions=False, verbose=False, load_scripts=True)
Converts the all of the datablocks of the given type from the given blend. Converts the all of the datablocks of the given type from the given blend.
@ -186,6 +186,8 @@ General functions
:type load_actions: bool :type load_actions: bool
:arg verbose: Whether or not to print debugging information (e.g., "SceneName: Scene") :arg verbose: Whether or not to print debugging information (e.g., "SceneName: Scene")
:type verbose: bool :type verbose: bool
:arg load_scripts: Whether or not to load text datablocks as well (can be disabled for some extra security)
:type load_scripts: bool
.. function:: LibNew(name, type, data) .. function:: LibNew(name, type, data)

@ -56,7 +56,69 @@ To enable line length checks use this instead.
User Interface Layout User Interface Layout
===================== =====================
TODO: Thomas Some notes to keep in mind when writing UI layouts:
* UI code is quite simple. Layout declarations are there to easily create a decent layout.
General rule here: If you need more code for the layout declaration, then for the actual properties, you do it wrong.
Example layouts:
* layout()
The basic layout is a simple Top -> Bottom layout.
.. code-block:: python
layout.prop()
layout.prop()
* layout.row()
Use row(), when you want more than 1 propertey in one line.
.. code-block:: python
row = layout.row()
row.prop()
row.prop()
* layout.column()
Use column(), when you want your properties in a column.
.. code-block:: python
col = layout.column()
col.prop()
col.prop()
* layout.split()
This can be used to create more complex layouts. For example you can split the layout and create two column() layouts next to each other.
Don't use split, when you simply want two properties in a row. Use row() for that.
.. code-block:: python
split = layout.split()
col = split.column()
col.prop()
col.prop()
col = split.column()
col.prop()
col.prop()
Declaration names:
Try to only use these variable names for layout declarations:
* row for a row() layout
* col for a column() layout
* split for a split() layout
* flow for a column_flow() layout
* sub for a sub layout (a column inside a column for example)
Script Efficiency Script Efficiency

@ -979,6 +979,7 @@ def pycontext2sphinx(basepath):
"meta_ball": ("MetaBall", False), "meta_ball": ("MetaBall", False),
"object": ("Object", False), "object": ("Object", False),
"particle_edit_object": ("Object", False), "particle_edit_object": ("Object", False),
"particle_settings": ("ParticleSettings", False),
"particle_system": ("ParticleSystem", False), "particle_system": ("ParticleSystem", False),
"particle_system_editable": ("ParticleSystem", False), "particle_system_editable": ("ParticleSystem", False),
"pose_bone": ("PoseBone", False), "pose_bone": ("PoseBone", False),

@ -0,0 +1,28 @@
Index: extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp
===================================================================
--- extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp (revision 49183)
+++ extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp (working copy)
@@ -77,6 +77,9 @@
if (convexResult.m_hitCollisionObject == m_me)
return btScalar(1.0);
+ if (!convexResult.m_hitCollisionObject->hasContactResponse())
+ return btScalar(1.0);
+
btVector3 hitNormalWorld;
if (normalInWorldSpace)
{
@@ -173,7 +176,12 @@
m_manifoldArray.resize(0);
btBroadphasePair* collisionPair = &m_ghostObject->getOverlappingPairCache()->getOverlappingPairArray()[i];
-
+ btCollisionObject* obj0 = static_cast<btCollisionObject*>(collisionPair->m_pProxy0->m_clientObject);
+ btCollisionObject* obj1 = static_cast<btCollisionObject*>(collisionPair->m_pProxy1->m_clientObject);
+
+ if ((obj0 && !obj0->hasContactResponse()) || (obj1 && !obj1->hasContactResponse()))
+ continue;
+
if (collisionPair->m_algorithm)
collisionPair->m_algorithm->getAllContactManifolds(m_manifoldArray);

@ -13,3 +13,7 @@ Originally committed in blender svn revision: 45908.
Apply patches/make_id.patch to prevent duplicated define of MAKE_ID macro in blender Apply patches/make_id.patch to prevent duplicated define of MAKE_ID macro in blender
side and bullet side. side and bullet side.
Sergey Sergey
Apply patches/ghost_character.path to prevent characters from colliding with ghost objects.
Mitchell

@ -77,6 +77,9 @@ public:
if (convexResult.m_hitCollisionObject == m_me) if (convexResult.m_hitCollisionObject == m_me)
return btScalar(1.0); return btScalar(1.0);
if (!convexResult.m_hitCollisionObject->hasContactResponse())
return btScalar(1.0);
btVector3 hitNormalWorld; btVector3 hitNormalWorld;
if (normalInWorldSpace) if (normalInWorldSpace)
{ {
@ -173,6 +176,11 @@ bool btKinematicCharacterController::recoverFromPenetration ( btCollisionWorld*
m_manifoldArray.resize(0); m_manifoldArray.resize(0);
btBroadphasePair* collisionPair = &m_ghostObject->getOverlappingPairCache()->getOverlappingPairArray()[i]; btBroadphasePair* collisionPair = &m_ghostObject->getOverlappingPairCache()->getOverlappingPairArray()[i];
btCollisionObject* obj0 = static_cast<btCollisionObject*>(collisionPair->m_pProxy0->m_clientObject);
btCollisionObject* obj1 = static_cast<btCollisionObject*>(collisionPair->m_pProxy1->m_clientObject);
if ((obj0 && !obj0->hasContactResponse()) || (obj1 && !obj1->hasContactResponse()))
continue;
if (collisionPair->m_algorithm) if (collisionPair->m_algorithm)
collisionPair->m_algorithm->getAllContactManifolds(m_manifoldArray); collisionPair->m_algorithm->getAllContactManifolds(m_manifoldArray);

@ -209,7 +209,7 @@ void CameraIntrinsics::ComputeLookupGrid(Grid* grid, int width, int height, doub
if( ix >= width-2 ) ix = width-2; if( ix >= width-2 ) ix = width-2;
if( iy >= height-2 ) iy = height-2; if( iy >= height-2 ) iy = height-2;
Offset offset = { ix-x, iy-y, fx, fy }; Offset offset = { (short)(ix-x), (short)(iy-y), (unsigned char)fx, (unsigned char)fy };
grid->offset[y*width+x] = offset; grid->offset[y*width+x] = offset;
} }
} }

@ -66,7 +66,7 @@ std::vector<Feature> DetectFAST(const unsigned char* data, int width, int height
Feature *all_features = new Feature[num_features]; Feature *all_features = new Feature[num_features];
for(int i = 0; i < num_features; ++i) { for(int i = 0; i < num_features; ++i) {
Feature a = { nonmax[i].x, nonmax[i].y, scores[i], 0 }; Feature a = { (float)nonmax[i].x, (float)nonmax[i].y, (float)scores[i], 0 };
all_features[i] = a; all_features[i] = a;
} }
@ -173,7 +173,7 @@ void DetectMORAVEC(ubyte* image, int stride, int width, int height, Feature* det
for(int y=16; y<height-16; y++) { for(int y=16; y<height-16; y++) {
for(int x=16; x<width-16; x++) { for(int x=16; x<width-16; x++) {
int s = scores[y*width+x]; int s = scores[y*width+x];
Feature f = { x+8, y+8, s, 16 }; Feature f = { (float)x+8.0f, (float)y+8.0f, (float)s, 16 };
if(s>min) detected[i++] = f; if(s>min) detected[i++] = f;
} }
} }

@ -163,8 +163,8 @@
#include "Eigen/Core" #include "Eigen/Core"
// Visual Studio 2010 or older version // Visual Studio 2012 or older version
#if defined(_MSC_VER) && _MSC_VER <= 1600 #if defined(_MSC_VER) && _MSC_VER <= 1700
namespace std { namespace std {
inline bool isfinite(double x) { return _finite(x); } inline bool isfinite(double x) { return _finite(x); }
inline bool isinf (double x) { return !_finite(x) && !_isnan(x); } inline bool isinf (double x) { return !_finite(x) && !_isnan(x); }

@ -33,7 +33,7 @@
#ifndef CERES_INTERNAL_COLLECTIONS_PORT_H_ #ifndef CERES_INTERNAL_COLLECTIONS_PORT_H_
#define CERES_INTERNAL_COLLECTIONS_PORT_H_ #define CERES_INTERNAL_COLLECTIONS_PORT_H_
#if defined(_MSC_VER) && _MSC_VER <= 1600 #if defined(_MSC_VER) && _MSC_VER <= 1700
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>
#else #else

@ -321,7 +321,7 @@ static void simplifyContour(rcIntArray& points, rcIntArray& simplified,
// Find maximum deviation from the segment. // Find maximum deviation from the segment.
float maxd = 0; float maxd = 0;
int maxi = -1; int i_max = -1;
int ci, cinc, endi; int ci, cinc, endi;
// Traverse the segment in lexilogical order so that the // Traverse the segment in lexilogical order so that the
@ -350,7 +350,7 @@ static void simplifyContour(rcIntArray& points, rcIntArray& simplified,
if (d > maxd) if (d > maxd)
{ {
maxd = d; maxd = d;
maxi = ci; i_max = ci;
} }
ci = (ci+cinc) % pn; ci = (ci+cinc) % pn;
} }
@ -359,7 +359,7 @@ static void simplifyContour(rcIntArray& points, rcIntArray& simplified,
// If the max deviation is larger than accepted error, // If the max deviation is larger than accepted error,
// add new point, else continue to next segment. // add new point, else continue to next segment.
if (maxi != -1 && maxd > (maxError*maxError)) if (i_max != -1 && maxd > (maxError*maxError))
{ {
// Add space for the new point. // Add space for the new point.
simplified.resize(simplified.size()+4); simplified.resize(simplified.size()+4);
@ -372,10 +372,10 @@ static void simplifyContour(rcIntArray& points, rcIntArray& simplified,
simplified[j*4+3] = simplified[(j-1)*4+3]; simplified[j*4+3] = simplified[(j-1)*4+3];
} }
// Add the point. // Add the point.
simplified[(i+1)*4+0] = points[maxi*4+0]; simplified[(i+1)*4+0] = points[i_max*4+0];
simplified[(i+1)*4+1] = points[maxi*4+1]; simplified[(i+1)*4+1] = points[i_max*4+1];
simplified[(i+1)*4+2] = points[maxi*4+2]; simplified[(i+1)*4+2] = points[i_max*4+2];
simplified[(i+1)*4+3] = maxi; simplified[(i+1)*4+3] = i_max;
} }
else else
{ {
@ -399,7 +399,7 @@ static void simplifyContour(rcIntArray& points, rcIntArray& simplified,
const int bi = simplified[ii*4+3]; const int bi = simplified[ii*4+3];
// Find maximum deviation from the segment. // Find maximum deviation from the segment.
int maxi = -1; int i_max = -1;
int ci = (ai+1) % pn; int ci = (ai+1) % pn;
// Tessellate only outer edges or edges between areas. // Tessellate only outer edges or edges between areas.
@ -423,19 +423,19 @@ static void simplifyContour(rcIntArray& points, rcIntArray& simplified,
if (bx > ax || (bx == ax && bz > az)) if (bx > ax || (bx == ax && bz > az))
{ {
const int n = bi < ai ? (bi+pn - ai) : (bi - ai); const int n = bi < ai ? (bi+pn - ai) : (bi - ai);
maxi = (ai + n/2) % pn; i_max = (ai + n/2) % pn;
} }
else else
{ {
const int n = bi < ai ? (bi+pn - ai) : (bi - ai); const int n = bi < ai ? (bi+pn - ai) : (bi - ai);
maxi = (ai + (n+1)/2) % pn; i_max = (ai + (n+1)/2) % pn;
} }
} }
} }
// If the max deviation is larger than accepted error, // If the max deviation is larger than accepted error,
// add new point, else continue to next segment. // add new point, else continue to next segment.
if (maxi != -1) if (i_max != -1)
{ {
// Add space for the new point. // Add space for the new point.
simplified.resize(simplified.size()+4); simplified.resize(simplified.size()+4);
@ -448,10 +448,10 @@ static void simplifyContour(rcIntArray& points, rcIntArray& simplified,
simplified[j*4+3] = simplified[(j-1)*4+3]; simplified[j*4+3] = simplified[(j-1)*4+3];
} }
// Add the point. // Add the point.
simplified[(i+1)*4+0] = points[maxi*4+0]; simplified[(i+1)*4+0] = points[i_max*4+0];
simplified[(i+1)*4+1] = points[maxi*4+1]; simplified[(i+1)*4+1] = points[i_max*4+1];
simplified[(i+1)*4+2] = points[maxi*4+2]; simplified[(i+1)*4+2] = points[i_max*4+2];
simplified[(i+1)*4+3] = maxi; simplified[(i+1)*4+3] = i_max;
} }
else else
{ {

@ -305,7 +305,7 @@ static int triangulate(int n, const int* verts, int* indices, int* tris)
while (n > 3) while (n > 3)
{ {
int minLen = -1; int minLen = -1;
int mini = -1; int i_min = -1;
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
{ {
int i1 = next(i, n); int i1 = next(i, n);
@ -321,12 +321,12 @@ static int triangulate(int n, const int* verts, int* indices, int* tris)
if (minLen < 0 || len < minLen) if (minLen < 0 || len < minLen)
{ {
minLen = len; minLen = len;
mini = i; i_min = i;
} }
} }
} }
if (mini == -1) if (i_min == -1)
{ {
// Should not happen. // Should not happen.
/* printf("mini == -1 ntris=%d n=%d\n", ntris, n); /* printf("mini == -1 ntris=%d n=%d\n", ntris, n);
@ -338,7 +338,7 @@ static int triangulate(int n, const int* verts, int* indices, int* tris)
return -ntris; return -ntris;
} }
int i = mini; int i = i_min;
int i1 = next(i, n); int i1 = next(i, n);
int i2 = next(i1, n); int i2 = next(i1, n);

@ -579,23 +579,23 @@ static bool buildPolyDetail(rcContext* ctx, const float* in, const int nin,
const float* vb = &edge[b*3]; const float* vb = &edge[b*3];
// Find maximum deviation along the segment. // Find maximum deviation along the segment.
float maxd = 0; float maxd = 0;
int maxi = -1; int i_max = -1;
for (int m = a+1; m < b; ++m) for (int m = a+1; m < b; ++m)
{ {
float d = distancePtSeg(&edge[m*3],va,vb); float d = distancePtSeg(&edge[m*3],va,vb);
if (d > maxd) if (d > maxd)
{ {
maxd = d; maxd = d;
maxi = m; i_max = m;
} }
} }
// If the max deviation is larger than accepted error, // If the max deviation is larger than accepted error,
// add new point, else continue to next segment. // add new point, else continue to next segment.
if (maxi != -1 && maxd > rcSqr(sampleMaxError)) if (i_max != -1 && maxd > rcSqr(sampleMaxError))
{ {
for (int m = nidx; m > k; --m) for (int m = nidx; m > k; --m)
idx[m] = idx[m-1]; idx[m] = idx[m-1];
idx[k+1] = maxi; idx[k+1] = i_max;
nidx++; nidx++;
} }
else else

@ -547,13 +547,32 @@ static uint quadMerge(std::map<MeshSet<3>::vertex_t*, uint> *vertexToIndex_map,
return 0; return 0;
} }
static bool Carve_checkDegeneratedFace(MeshSet<3>::face_t *face) static bool Carve_checkDegeneratedFace(std::map<MeshSet<3>::vertex_t*, uint> *vertexToIndex_map, MeshSet<3>::face_t *face)
{ {
/* only tris and quads for now */ /* only tris and quads for now */
if (face->n_edges == 3) { if (face->n_edges == 3) {
uint v1, v2, v3;
v1 = vertexToIndex_map->find(face->edge->prev->vert)->second;
v2 = vertexToIndex_map->find(face->edge->vert)->second;
v3 = vertexToIndex_map->find(face->edge->next->vert)->second;
if (v1 == v2 || v2 == v3 || v1 == v3)
return true;
return triangleArea(face->edge->prev->vert->v, face->edge->vert->v, face->edge->next->vert->v) < DBL_EPSILON; return triangleArea(face->edge->prev->vert->v, face->edge->vert->v, face->edge->next->vert->v) < DBL_EPSILON;
} }
else if (face->n_edges == 4) { else if (face->n_edges == 4) {
uint v1, v2, v3, v4;
v1 = vertexToIndex_map->find(face->edge->prev->vert)->second;
v2 = vertexToIndex_map->find(face->edge->vert)->second;
v3 = vertexToIndex_map->find(face->edge->next->vert)->second;
v4 = vertexToIndex_map->find(face->edge->next->next->vert)->second;
if (v1 == v2 || v1 == v3 || v1 == v4 || v2 == v3 || v2 == v4 || v3 == v4)
return true;
return triangleArea(face->edge->vert->v, face->edge->next->vert->v, face->edge->next->next->vert->v) + return triangleArea(face->edge->vert->v, face->edge->next->vert->v, face->edge->next->next->vert->v) +
triangleArea(face->edge->prev->vert->v, face->edge->vert->v, face->edge->next->next->vert->v) < DBL_EPSILON; triangleArea(face->edge->prev->vert->v, face->edge->vert->v, face->edge->next->next->vert->v) < DBL_EPSILON;
} }
@ -595,8 +614,14 @@ static BSP_CSGMesh *Carve_exportMesh(MeshSet<3>* &poly, carve::interpolate::Face
MeshSet<3>::face_iter face_iter = poly->faceBegin(); MeshSet<3>::face_iter face_iter = poly->faceBegin();
for (i = 0; face_iter != poly->faceEnd(); ++face_iter, ++i) { for (i = 0; face_iter != poly->faceEnd(); ++face_iter, ++i) {
MeshSet<3>::face_t *f = *face_iter; MeshSet<3>::face_t *f = *face_iter;
if (Carve_checkDegeneratedFace(&vertexToIndex_map, f))
continue;
ofaces[oface_num.getAttribute(f)].push_back(i); ofaces[oface_num.getAttribute(f)].push_back(i);
MeshSet<3>::face_t::edge_iter_t edge_iter = f->begin(); MeshSet<3>::face_t::edge_iter_t edge_iter = f->begin();
for (; edge_iter != f->end(); ++edge_iter) { for (; edge_iter != f->end(); ++edge_iter) {
int index = vertexToIndex_map[edge_iter->vert]; int index = vertexToIndex_map[edge_iter->vert];
vi[index].push_back(i); vi[index].push_back(i);
@ -659,14 +684,6 @@ static BSP_CSGMesh *Carve_exportMesh(MeshSet<3>* &poly, carve::interpolate::Face
} }
} }
bool degenerativeFace = false;
if (!result) {
/* merged triangles are already checked for degenerative quad */
degenerativeFace = Carve_checkDegeneratedFace(f);
}
if (!degenerativeFace) {
// add all information except vertices to the output mesh // add all information except vertices to the output mesh
outputMesh->FaceSet().push_back(BSP_MFace()); outputMesh->FaceSet().push_back(BSP_MFace());
BSP_MFace& outFace = outputMesh->FaceSet().back(); BSP_MFace& outFace = outputMesh->FaceSet().back();
@ -692,7 +709,6 @@ static BSP_CSGMesh *Carve_exportMesh(MeshSet<3>* &poly, carve::interpolate::Face
} }
} }
} }
}
// Build the mesh edges using topological informtion // Build the mesh edges using topological informtion
outputMesh->BuildEdges(); outputMesh->BuildEdges();

@ -306,6 +306,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
for(b_sce.objects.begin(b_ob); b_ob != b_sce.objects.end(); ++b_ob) { for(b_sce.objects.begin(b_ob); b_ob != b_sce.objects.end(); ++b_ob) {
bool hide = (render_layer.use_viewport_visibility)? b_ob->hide(): b_ob->hide_render(); bool hide = (render_layer.use_viewport_visibility)? b_ob->hide(): b_ob->hide_render();
uint ob_layer = get_layer(b_ob->layers(), b_ob->layers_local_view(), object_is_light(*b_ob)); uint ob_layer = get_layer(b_ob->layers(), b_ob->layers_local_view(), object_is_light(*b_ob));
CYCLES_LOCAL_LAYER_HACK(render_layer.use_localview, ob_layer);
hide = hide || !(ob_layer & scene_layer); hide = hide || !(ob_layer & scene_layer);
if(!hide) { if(!hide) {

@ -144,16 +144,20 @@ void BlenderSync::sync_particles(Object *ob, BL::Object b_ob)
BL::Object::particle_systems_iterator b_psys; BL::Object::particle_systems_iterator b_psys;
for(b_ob.particle_systems.begin(b_psys); b_psys != b_ob.particle_systems.end(); ++b_psys) { for(b_ob.particle_systems.begin(b_psys); b_psys != b_ob.particle_systems.end(); ++b_psys) {
if (use_particle_system(*b_psys)) { if (use_particle_system(*b_psys)) {
int pa_index = 0;
BL::ParticleSystem::particles_iterator b_pa; BL::ParticleSystem::particles_iterator b_pa;
for(b_psys->particles.begin(b_pa), index = 0; b_pa != b_psys->particles.end(); ++b_pa, ++index) { for(b_psys->particles.begin(b_pa), index = 0; b_pa != b_psys->particles.end(); ++b_pa, ++index) {
if(use_particle(*b_pa)) { if(use_particle(*b_pa)) {
Particle pa; Particle pa;
pa.index = pa_index;
pa.age = b_scene.frame_current() - b_pa->birth_time(); pa.age = b_scene.frame_current() - b_pa->birth_time();
pa.lifetime = b_pa->lifetime(); pa.lifetime = b_pa->lifetime();
ob->particles.push_back(pa); ob->particles.push_back(pa);
} }
++pa_index;
} }
} }
} }

@ -219,7 +219,9 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer)
layer = layername.c_str(); layer = layername.c_str();
} }
else { else {
render_layer.use_localview = (b_v3d.local_view() ? true : false);
render_layer.scene_layer = get_layer(b_v3d.layers(), b_v3d.layers_local_view()); render_layer.scene_layer = get_layer(b_v3d.layers(), b_v3d.layers_local_view());
CYCLES_LOCAL_LAYER_HACK(render_layer.use_localview, render_layer.scene_layer);
render_layer.layer = render_layer.scene_layer; render_layer.layer = render_layer.scene_layer;
render_layer.holdout_layer = 0; render_layer.holdout_layer = 0;
render_layer.material_override = PointerRNA_NULL; render_layer.material_override = PointerRNA_NULL;
@ -245,6 +247,7 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer)
render_layer.material_override = b_rlay->material_override(); render_layer.material_override = b_rlay->material_override();
render_layer.use_background = b_rlay->use_sky(); render_layer.use_background = b_rlay->use_sky();
render_layer.use_viewport_visibility = false; render_layer.use_viewport_visibility = false;
render_layer.use_localview = false;
render_layer.samples = b_rlay->samples(); render_layer.samples = b_rlay->samples();
} }

@ -127,10 +127,25 @@ private:
BL::Material material_override; BL::Material material_override;
bool use_background; bool use_background;
bool use_viewport_visibility; bool use_viewport_visibility;
bool use_localview;
int samples; int samples;
} render_layer; } render_layer;
}; };
/* we don't have spare bits for localview (normally 20-28)
* because PATH_RAY_LAYER_SHIFT uses 20-32.
* So - check if we have localview and if so, shift local
* view bits down to 1-8, since this is done for the view
* port only - it should be OK and not conflict with
* render layers. - Campbell.
*
* ... as an alternative we could use uint64_t
*/
#define CYCLES_LOCAL_LAYER_HACK(use_localview, layer) \
if (use_localview) { \
layer >>= 20; \
} (void)0
CCL_NAMESPACE_END CCL_NAMESPACE_END
#endif /* __BLENDER_SYNC_H__ */ #endif /* __BLENDER_SYNC_H__ */

@ -378,19 +378,10 @@ void BVH::pack_instances(size_t nodes_size)
int mesh_tri_offset = mesh->tri_offset; int mesh_tri_offset = mesh->tri_offset;
/* fill in node indexes for instances */ /* fill in node indexes for instances */
if( if((bvh->pack.is_leaf.size() != 0) && bvh->pack.is_leaf[0])
/* XXX, brecht. check this is needed!. it could be a bug elsewhere
* /mango/pro/scenes/04_2e/04_2e.blend r2158. on Ian's system 192.168.3.27 - campbell */
(bvh->pack.is_leaf.size() != 0) &&
/* previously only checked this */
bvh->pack.is_leaf[0])
{
pack.object_node[object_offset++] = -noffset-1; pack.object_node[object_offset++] = -noffset-1;
} else
else {
pack.object_node[object_offset++] = noffset; pack.object_node[object_offset++] = noffset;
}
mesh_map[mesh] = pack.object_node[object_offset-1]; mesh_map[mesh] = pack.object_node[object_offset-1];

@ -298,15 +298,12 @@ public:
{ {
string build_options = " -cl-fast-relaxed-math "; string build_options = " -cl-fast-relaxed-math ";
/* Multi Closure for nVidia cards */
if(platform_name == "NVIDIA CUDA") if(platform_name == "NVIDIA CUDA")
build_options += "-D__KERNEL_SHADING__ -D__KERNEL_OPENCL_NVIDIA__ -cl-nv-maxrregcount=24 -cl-nv-verbose "; build_options += "-D__KERNEL_SHADING__ -D__KERNEL_OPENCL_NVIDIA__ -cl-nv-maxrregcount=24 -cl-nv-verbose ";
/* No Float3 for Apple */
else if(platform_name == "Apple") else if(platform_name == "Apple")
build_options += "-D__CL_NO_FLOAT3__ -D__KERNEL_OPENCL_APPLE__ "; build_options += "-D__CL_NO_FLOAT3__ -D__KERNEL_OPENCL_APPLE__ ";
/* Basic shading for AMD cards (non Apple) */
else if(platform_name == "AMD Accelerated Parallel Processing") else if(platform_name == "AMD Accelerated Parallel Processing")
build_options += "-D__CL_NO_FLOAT3__ -D__KERNEL_OPENCL_AMD__ "; build_options += "-D__CL_NO_FLOAT3__ -D__KERNEL_OPENCL_AMD__ ";

@ -169,20 +169,27 @@ __device int shader_pass_id(KernelGlobals *kg, ShaderData *sd)
return kernel_tex_fetch(__shader_flag, (sd->shader & SHADER_MASK)*2 + 1); return kernel_tex_fetch(__shader_flag, (sd->shader & SHADER_MASK)*2 + 1);
} }
__device float particle_age(KernelGlobals *kg, int particle) __device_inline float particle_index(KernelGlobals *kg, int particle)
{ {
int offset = particle*PARTICLE_SIZE; int offset = particle*PARTICLE_SIZE;
float4 f = kernel_tex_fetch(__particles, offset); float4 f = kernel_tex_fetch(__particles, offset);
return f.x; return f.x;
} }
__device float particle_lifetime(KernelGlobals *kg, int particle) __device float particle_age(KernelGlobals *kg, int particle)
{ {
int offset = particle*PARTICLE_SIZE; int offset = particle*PARTICLE_SIZE;
float4 f = kernel_tex_fetch(__particles, offset); float4 f = kernel_tex_fetch(__particles, offset);
return f.y; return f.y;
} }
__device float particle_lifetime(KernelGlobals *kg, int particle)
{
int offset = particle*PARTICLE_SIZE;
float4 f = kernel_tex_fetch(__particles, offset);
return f.z;
}
CCL_NAMESPACE_END CCL_NAMESPACE_END

@ -288,7 +288,7 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
if(sd.flag & SD_HOLDOUT_MASK) if(sd.flag & SD_HOLDOUT_MASK)
holdout_weight = make_float3(1.0f, 1.0f, 1.0f); holdout_weight = make_float3(1.0f, 1.0f, 1.0f);
else else
shader_holdout_eval(kg, &sd); holdout_weight = shader_holdout_eval(kg, &sd);
/* any throughput is ok, should all be identical here */ /* any throughput is ok, should all be identical here */
L_transparent += average(holdout_weight*throughput); L_transparent += average(holdout_weight*throughput);
@ -655,7 +655,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
if(sd.flag & SD_HOLDOUT_MASK) if(sd.flag & SD_HOLDOUT_MASK)
holdout_weight = make_float3(1.0f, 1.0f, 1.0f); holdout_weight = make_float3(1.0f, 1.0f, 1.0f);
else else
shader_holdout_eval(kg, &sd); holdout_weight = shader_holdout_eval(kg, &sd);
/* any throughput is ok, should all be identical here */ /* any throughput is ok, should all be identical here */
L_transparent += average(holdout_weight*throughput); L_transparent += average(holdout_weight*throughput);

@ -172,6 +172,8 @@ enum PathRayFlag {
PATH_RAY_ALL = (1|2|4|8|16|32|64|128|256|512), PATH_RAY_ALL = (1|2|4|8|16|32|64|128|256|512),
/* this gives collisions with localview bits
* see: CYCLES_LOCAL_LAYER_HACK(), grr - Campbell */
PATH_RAY_LAYER_SHIFT = (32-20) PATH_RAY_LAYER_SHIFT = (32-20)
}; };

@ -101,6 +101,12 @@ __device void svm_node_particle_info(KernelGlobals *kg, ShaderData *sd, float *s
float data; float data;
switch(type) { switch(type) {
case NODE_INFO_PAR_INDEX: {
uint particle_id = object_particle_id(kg, sd->object);
data = particle_index(kg, particle_id);
stack_store_float(stack, out_offset, data);
break;
}
case NODE_INFO_PAR_AGE: { case NODE_INFO_PAR_AGE: {
uint particle_id = object_particle_id(kg, sd->object); uint particle_id = object_particle_id(kg, sd->object);
data = particle_age(kg, particle_id); data = particle_age(kg, particle_id);

@ -114,6 +114,7 @@ typedef enum NodeObjectInfo {
} NodeObjectInfo; } NodeObjectInfo;
typedef enum NodeParticleInfo { typedef enum NodeParticleInfo {
NODE_INFO_PAR_INDEX,
NODE_INFO_PAR_AGE, NODE_INFO_PAR_AGE,
NODE_INFO_PAR_LIFETIME NODE_INFO_PAR_LIFETIME
} NodeParticleInfo; } NodeParticleInfo;

@ -194,10 +194,11 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
/* sum area */ /* sum area */
if(have_emission) { if(have_emission) {
bool transform_applied = mesh->transform_applied;
Transform tfm = object->tfm; Transform tfm = object->tfm;
int object_id = j; int object_id = j;
if(mesh->transform_applied) if(transform_applied)
object_id = ~object_id; object_id = ~object_id;
for(size_t i = 0; i < mesh->triangles.size(); i++) { for(size_t i = 0; i < mesh->triangles.size(); i++) {
@ -211,9 +212,15 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
offset++; offset++;
Mesh::Triangle t = mesh->triangles[i]; Mesh::Triangle t = mesh->triangles[i];
float3 p1 = transform_point(&tfm, mesh->verts[t.v[0]]); float3 p1 = mesh->verts[t.v[0]];
float3 p2 = transform_point(&tfm, mesh->verts[t.v[1]]); float3 p2 = mesh->verts[t.v[1]];
float3 p3 = transform_point(&tfm, mesh->verts[t.v[2]]); float3 p3 = mesh->verts[t.v[2]];
if(!transform_applied) {
p1 = transform_point(&tfm, p1);
p2 = transform_point(&tfm, p2);
p3 = transform_point(&tfm, p3);
}
totarea += triangle_area(p1, p2, p3); totarea += triangle_area(p1, p2, p3);
} }

@ -1798,12 +1798,15 @@ void ObjectInfoNode::compile(OSLCompiler& compiler)
ParticleInfoNode::ParticleInfoNode() ParticleInfoNode::ParticleInfoNode()
: ShaderNode("particle_info") : ShaderNode("particle_info")
{ {
add_output("Index", SHADER_SOCKET_FLOAT);
add_output("Age", SHADER_SOCKET_FLOAT); add_output("Age", SHADER_SOCKET_FLOAT);
add_output("Lifetime", SHADER_SOCKET_FLOAT); add_output("Lifetime", SHADER_SOCKET_FLOAT);
} }
void ParticleInfoNode::attributes(AttributeRequestSet *attributes) void ParticleInfoNode::attributes(AttributeRequestSet *attributes)
{ {
if(!output("Index")->links.empty())
attributes->add(ATTR_STD_PARTICLE);
if(!output("Age")->links.empty()) if(!output("Age")->links.empty())
attributes->add(ATTR_STD_PARTICLE); attributes->add(ATTR_STD_PARTICLE);
if(!output("Lifetime")->links.empty()) if(!output("Lifetime")->links.empty())
@ -1816,6 +1819,12 @@ void ParticleInfoNode::compile(SVMCompiler& compiler)
{ {
ShaderOutput *out; ShaderOutput *out;
out = output("Index");
if(!out->links.empty()) {
compiler.stack_assign(out);
compiler.add_node(NODE_PARTICLE_INFO, NODE_INFO_PAR_INDEX, out->stack_offset);
}
out = output("Age"); out = output("Age");
if(!out->links.empty()) { if(!out->links.empty()) {
compiler.stack_assign(out); compiler.stack_assign(out);

@ -112,7 +112,8 @@ void Object::apply_transform()
compute_bounds(false); compute_bounds(false);
} }
tfm = transform_identity(); /* tfm is not reset to identity, all code that uses it needs to check the
transform_applied boolean */
} }
void Object::tag_update(Scene *scene) void Object::tag_update(Scene *scene)
@ -269,7 +270,7 @@ void ObjectManager::device_update_particles(Device *device, DeviceScene *dscene,
/* pack in texture */ /* pack in texture */
int offset = i*PARTICLE_SIZE; int offset = i*PARTICLE_SIZE;
particles[offset] = make_float4(pa.age, pa.lifetime, 0.0f, 0.0f); particles[offset] = make_float4(pa.index, pa.age, pa.lifetime, 0.0f);
i++; i++;

@ -36,6 +36,7 @@ struct Transform;
/* Object */ /* Object */
struct Particle { struct Particle {
int index;
float age; float age;
float lifetime; float lifetime;
}; };

@ -26,6 +26,12 @@
#include "util_path.h" #include "util_path.h"
#include "util_types.h" #include "util_types.h"
#include <boost/version.hpp>
#if (BOOST_VERSION < 104400)
# define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
@ -115,7 +121,11 @@ void Cache::clear_except(const string& name, const set<string>& except)
boost::filesystem::directory_iterator it(dir), it_end; boost::filesystem::directory_iterator it(dir), it_end;
for(; it != it_end; it++) { for(; it != it_end; it++) {
#if (BOOST_FILESYSTEM_VERSION == 2)
string filename = it->path().filename();
#else
string filename = it->path().filename().string(); string filename = it->path().filename().string();
#endif
if(boost::starts_with(filename, name)) if(boost::starts_with(filename, name))
if(except.find(filename) == except.end()) if(except.find(filename) == except.end())

@ -26,6 +26,12 @@ OIIO_NAMESPACE_USING
#include <stdio.h> #include <stdio.h>
#include <boost/version.hpp>
#if (BOOST_VERSION < 104400)
# define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
@ -58,7 +64,11 @@ string path_user_get(const string& sub)
string path_filename(const string& path) string path_filename(const string& path)
{ {
#if (BOOST_FILESYSTEM_VERSION == 2)
return boost::filesystem::path(path).filename();
#else
return boost::filesystem::path(path).filename().string(); return boost::filesystem::path(path).filename().string();
#endif
} }
string path_dirname(const string& path) string path_dirname(const string& path)

@ -16,6 +16,13 @@
#include "mvmcoords.h" #include "mvmcoords.h"
#include <algorithm> #include <algorithm>
#if defined(_MSC_VER) && _MSC_VER > 1600
// sdt::greater
#include <functional>
#endif
using std::vector; using std::vector;
void MeanValueMeshCoords::clear() void MeanValueMeshCoords::clear()

@ -48,7 +48,7 @@ GHOST_DisplayManagerX11(
GHOST_DisplayManager(), GHOST_DisplayManager(),
m_system(system) m_system(system)
{ {
//nothing to do. /* nothing to do. */
} }
GHOST_TSuccess GHOST_TSuccess
@ -87,7 +87,7 @@ getNumDisplaySettings(
XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numSettings, &vidmodes); XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numSettings, &vidmodes);
#else #else
// We only have one X11 setting at the moment. /* We only have one X11 setting at the moment. */
GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n"); GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
numSettings = GHOST_TInt32(1); numSettings = GHOST_TInt32(1);
#endif #endif
@ -144,8 +144,8 @@ getDisplaySetting(
setting.bpp = DefaultDepth(x_display, DefaultScreen(x_display)); setting.bpp = DefaultDepth(x_display, DefaultScreen(x_display));
#endif #endif
// Don't think it's possible to get this value from X! /* Don't think it's possible to get this value from X!
// So let's guess!! * So let's guess!! */
setting.frequency = 60; setting.frequency = 60;
return GHOST_kSuccess; return GHOST_kSuccess;
@ -171,11 +171,10 @@ setCurrentDisplaySetting(
const GHOST_DisplaySetting& setting) const GHOST_DisplaySetting& setting)
{ {
#ifdef WITH_X11_XF86VMODE #ifdef WITH_X11_XF86VMODE
// /* Mode switching code ported from Quake 2:
// Mode switching code ported from Quake 2: * ftp: ftp.idsoftware.com/idstuff/source/q2source-3.21.zip
// ftp://ftp.idsoftware.com/idstuff/source/q2source-3.21.zip * See linux/gl_glx.c:GLimp_SetMode
// See linux/gl_glx.c:GLimp_SetMode */
//
int majorVersion, minorVersion; int majorVersion, minorVersion;
XF86VidModeModeInfo **vidmodes; XF86VidModeModeInfo **vidmodes;
Display *dpy = m_system->getXDisplay(); Display *dpy = m_system->getXDisplay();
@ -187,7 +186,7 @@ setCurrentDisplaySetting(
scrnum = DefaultScreen(dpy); scrnum = DefaultScreen(dpy);
// Get video mode list /* Get video mode list */
majorVersion = minorVersion = 0; majorVersion = minorVersion = 0;
if (!XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion)) { if (!XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion)) {
fprintf(stderr, "Error: XF86VidMode extension missing!\n"); fprintf(stderr, "Error: XF86VidMode extension missing!\n");
@ -228,20 +227,21 @@ setCurrentDisplaySetting(
actualWidth, actualHeight); actualWidth, actualHeight);
# endif # endif
// change to the mode /* change to the mode */
XF86VidModeSwitchToMode(dpy, scrnum, vidmodes[best_fit]); XF86VidModeSwitchToMode(dpy, scrnum, vidmodes[best_fit]);
// Move the viewport to top left /* Move the viewport to top left */
XF86VidModeSetViewPort(dpy, scrnum, 0, 0); XF86VidModeSetViewPort(dpy, scrnum, 0, 0);
} }
else else {
return GHOST_kFailure; return GHOST_kFailure;
}
XFlush(dpy); XFlush(dpy);
return GHOST_kSuccess; return GHOST_kSuccess;
#else #else
// Just pretend the request was successful. /* Just pretend the request was successful. */
return GHOST_kSuccess; return GHOST_kSuccess;
#endif #endif
} }

@ -144,23 +144,23 @@ void GHOST_DropTargetX11::UrlDecode(char *decodedOut, int bufferSize, const char
break; break;
} }
// We are now converting /* We are now converting */
state = STATE_CONVERTING; state = STATE_CONVERTING;
break; break;
case STATE_CONVERTING: case STATE_CONVERTING:
bothDigits = true; bothDigits = true;
// Create a buffer to hold the hex. For example, if %20, this /* Create a buffer to hold the hex. For example, if %20, this
// buffer would hold 20 (in ASCII) * buffer would hold 20 (in ASCII) */
memset(tempNumBuf, 0, sizeof(tempNumBuf)); memset(tempNumBuf, 0, sizeof(tempNumBuf));
// Conversion complete (i.e. don't convert again next iter) /* Conversion complete (i.e. don't convert again next iter) */
state = STATE_SEARCH; state = STATE_SEARCH;
strncpy(tempNumBuf, &encodedIn[i], 2); strncpy(tempNumBuf, &encodedIn[i], 2);
// Ensure both characters are hexadecimal /* Ensure both characters are hexadecimal */
for (j = 0; j < 2; ++j) { for (j = 0; j < 2; ++j) {
if (!isxdigit(tempNumBuf[j])) if (!isxdigit(tempNumBuf[j]))
@ -170,16 +170,16 @@ void GHOST_DropTargetX11::UrlDecode(char *decodedOut, int bufferSize, const char
if (!bothDigits) if (!bothDigits)
break; break;
// Convert two hexadecimal characters into one character /* Convert two hexadecimal characters into one character */
sscanf(tempNumBuf, "%x", &asciiCharacter); sscanf(tempNumBuf, "%x", &asciiCharacter);
// Ensure we aren't going to overflow /* Ensure we aren't going to overflow */
assert(strlen(decodedOut) < bufferSize); assert(strlen(decodedOut) < bufferSize);
// Concatenate this character onto the output /* Concatenate this character onto the output */
strncat(decodedOut, (char *)&asciiCharacter, 1); strncat(decodedOut, (char *)&asciiCharacter, 1);
// Skip the next character /* Skip the next character */
i++; i++;
break; break;
} }

@ -58,8 +58,11 @@ GHOST_NDOFManagerX11::GHOST_NDOFManagerX11(GHOST_System& sys)
} }
} }
else { else {
#ifdef DEBUG
/* annoying for official builds, just adds noise and most prople don't own these */
puts("ndof: spacenavd not found"); puts("ndof: spacenavd not found");
/* This isn't a hard error, just means the user doesn't have a 3D mouse. */ /* This isn't a hard error, just means the user doesn't have a 3D mouse. */
#endif
} }
} }

@ -38,11 +38,11 @@
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#include <stdio.h> // for fprintf only #include <stdio.h> /* for fprintf only */
#include <cstdlib> // for exit #include <cstdlib> /* for exit */
#include <pwd.h> // for get home without use getenv() #include <pwd.h> /* for get home without use getenv() */
#include <limits.h> // for PATH_MAX #include <limits.h> /* for PATH_MAX */
#ifdef PREFIX #ifdef PREFIX
static const char *static_path = PREFIX "/share"; static const char *static_path = PREFIX "/share";

@ -32,7 +32,6 @@
* \ingroup GHOST * \ingroup GHOST
*/ */
#include "GHOST_SystemX11.h" #include "GHOST_SystemX11.h"
#include "GHOST_WindowX11.h" #include "GHOST_WindowX11.h"
#include "GHOST_WindowManager.h" #include "GHOST_WindowManager.h"
@ -61,20 +60,19 @@
#include <X11/XF86keysym.h> #include <X11/XF86keysym.h>
#endif #endif
// For timing /* For timing */
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <stdio.h> // for fprintf only #include <stdio.h> /* for fprintf only */
#include <cstdlib> // for exit #include <cstdlib> /* for exit */
static GHOST_TKey static GHOST_TKey
convertXKey(KeySym key); convertXKey(KeySym key);
//these are for copy and select copy /* these are for copy and select copy */
static char *txt_cut_buffer = NULL; static char *txt_cut_buffer = NULL;
static char *txt_select_buffer = NULL; static char *txt_select_buffer = NULL;
@ -90,7 +88,7 @@ GHOST_SystemX11(
if (!m_display) { if (!m_display) {
std::cerr << "Unable to open a display" << std::endl; std::cerr << "Unable to open a display" << std::endl;
abort(); //was return before, but this would just mean it will crash later abort(); /* was return before, but this would just mean it will crash later */
} }
#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) #if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
@ -128,13 +126,13 @@ GHOST_SystemX11(
m_last_warp = 0; m_last_warp = 0;
// compute the initial time /* compute the initial time */
timeval tv; timeval tv;
if (gettimeofday(&tv, NULL) == -1) { if (gettimeofday(&tv, NULL) == -1) {
GHOST_ASSERT(false, "Could not instantiate timer!"); GHOST_ASSERT(false, "Could not instantiate timer!");
} }
// Taking care not to overflow the tv.tv_sec*1000 /* Taking care not to overflow the tv.tv_sec*1000 */
m_start_time = GHOST_TUns64(tv.tv_sec) * 1000 + tv.tv_usec / 1000; m_start_time = GHOST_TUns64(tv.tv_sec) * 1000 + tv.tv_usec / 1000;
@ -190,7 +188,7 @@ getMilliSeconds() const
GHOST_ASSERT(false, "Could not compute time!"); GHOST_ASSERT(false, "Could not compute time!");
} }
// Taking care not to overflow the tv.tv_sec*1000 /* Taking care not to overflow the tv.tv_sec*1000 */
return GHOST_TUns64(tv.tv_sec) * 1000 + tv.tv_usec / 1000 - m_start_time; return GHOST_TUns64(tv.tv_sec) * 1000 + tv.tv_usec / 1000 - m_start_time;
} }
@ -254,16 +252,16 @@ createWindow(
window = new GHOST_WindowX11( window = new GHOST_WindowX11(this, m_display, title,
this, m_display, title, left, top, width, height, state, parentWindow, type, stereoVisual left, top, width, height,
); state, parentWindow, type, stereoVisual);
if (window) { if (window) {
// Both are now handle in GHOST_WindowX11.cpp /* Both are now handle in GHOST_WindowX11.cpp
// Focus and Delete atoms. * Focus and Delete atoms. */
if (window->getValid()) { if (window->getValid()) {
// Store the pointer to the window /* Store the pointer to the window */
m_windowManager->addWindow(window); m_windowManager->addWindow(window);
m_windowManager->setActiveWindow(window); m_windowManager->setActiveWindow(window);
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) ); pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) );
@ -313,10 +311,10 @@ findGhostWindow(
if (xwind == 0) return NULL; if (xwind == 0) return NULL;
// It is not entirely safe to do this as the backptr may point /* It is not entirely safe to do this as the backptr may point
// to a window that has recently been removed. * to a window that has recently been removed.
// We should always check the window manager's list of windows * We should always check the window manager's list of windows
// and only process events on these windows. * and only process events on these windows. */
vector<GHOST_IWindow *> & win_vec = m_windowManager->getWindows(); vector<GHOST_IWindow *> & win_vec = m_windowManager->getWindows();
@ -411,8 +409,8 @@ GHOST_SystemX11::
processEvents( processEvents(
bool waitForEvent) bool waitForEvent)
{ {
// Get all the current events -- translate them into /* Get all the current events -- translate them into
// ghost events and call base class pushEvent() method. * ghost events and call base class pushEvent() method. */
bool anyProcessed = false; bool anyProcessed = false;
@ -519,8 +517,8 @@ GHOST_SystemX11::processEvent(XEvent *xe)
XExposeEvent & xee = xe->xexpose; XExposeEvent & xee = xe->xexpose;
if (xee.count == 0) { if (xee.count == 0) {
// Only generate a single expose event /* Only generate a single expose event
// per read of the event queue. * per read of the event queue. */
g_event = new g_event = new
GHOST_Event( GHOST_Event(
@ -761,7 +759,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
break; break;
} }
// change of size, border, layer etc. /* change of size, border, layer etc. */
case ConfigureNotify: case ConfigureNotify:
{ {
/* XConfigureEvent & xce = xe->xconfigure; */ /* XConfigureEvent & xce = xe->xconfigure; */
@ -780,11 +778,10 @@ GHOST_SystemX11::processEvent(XEvent *xe)
{ {
XFocusChangeEvent &xfe = xe->xfocus; XFocusChangeEvent &xfe = xe->xfocus;
// TODO: make sure this is the correct place for activate/deactivate /* TODO: make sure this is the correct place for activate/deactivate */
// printf("X: focus %s for window %d\n", xfe.type == FocusIn ? "in" : "out", (int) xfe.window); // printf("X: focus %s for window %d\n", xfe.type == FocusIn ? "in" : "out", (int) xfe.window);
// May have to look at the type of event and filter some /* May have to look at the type of event and filter some out. */
// out.
GHOST_TEventType gtype = (xfe.type == FocusIn) ? GHOST_TEventType gtype = (xfe.type == FocusIn) ?
GHOST_kEventWindowActivate : GHOST_kEventWindowDeactivate; GHOST_kEventWindowActivate : GHOST_kEventWindowDeactivate;
@ -860,7 +857,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
case DestroyNotify: case DestroyNotify:
::exit(-1); ::exit(-1);
// We're not interested in the following things.(yet...) /* We're not interested in the following things.(yet...) */
case NoExpose: case NoExpose:
case GraphicsExpose: case GraphicsExpose:
break; break;
@ -946,7 +943,11 @@ GHOST_SystemX11::processEvent(XEvent *xe)
nxe.xselection.time = xse->time; nxe.xselection.time = xse->time;
/* Check to see if the requestor is asking for String */ /* Check to see if the requestor is asking for String */
if (xse->target == utf8_string || xse->target == string || xse->target == compound_text || xse->target == c_string) { if (xse->target == utf8_string ||
xse->target == string ||
xse->target == compound_text ||
xse->target == c_string)
{
if (xse->selection == XInternAtom(m_display, "PRIMARY", False)) { if (xse->selection == XInternAtom(m_display, "PRIMARY", False)) {
XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 8, PropModeReplace, XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 8, PropModeReplace,
(unsigned char *)txt_select_buffer, strlen(txt_select_buffer)); (unsigned char *)txt_select_buffer, strlen(txt_select_buffer));
@ -968,11 +969,11 @@ GHOST_SystemX11::processEvent(XEvent *xe)
XFlush(m_display); XFlush(m_display);
} }
else { else {
//Change property to None because we do not support anything but STRING /* Change property to None because we do not support anything but STRING */
nxe.xselection.property = None; nxe.xselection.property = None;
} }
//Send the event to the client 0 0 == False, SelectionNotify /* Send the event to the client 0 0 == False, SelectionNotify */
XSendEvent(m_display, xse->requestor, 0, 0, &nxe); XSendEvent(m_display, xse->requestor, 0, 0, &nxe);
XFlush(m_display); XFlush(m_display);
break; break;
@ -1023,14 +1024,14 @@ getModifierKeys(
GHOST_ModifierKeys& keys) const GHOST_ModifierKeys& keys) const
{ {
// analyse the masks retuned from XQueryPointer. /* analyse the masks retuned from XQueryPointer. */
memset((void *)m_keyboard_vector, 0, sizeof(m_keyboard_vector)); memset((void *)m_keyboard_vector, 0, sizeof(m_keyboard_vector));
XQueryKeymap(m_display, (char *)m_keyboard_vector); XQueryKeymap(m_display, (char *)m_keyboard_vector);
// now translate key symobols into keycodes and /* now translate key symobols into keycodes and
// test with vector. * test with vector. */
const static KeyCode shift_l = XKeysymToKeycode(m_display, XK_Shift_L); const static KeyCode shift_l = XKeysymToKeycode(m_display, XK_Shift_L);
const static KeyCode shift_r = XKeysymToKeycode(m_display, XK_Shift_R); const static KeyCode shift_r = XKeysymToKeycode(m_display, XK_Shift_R);
@ -1041,16 +1042,16 @@ getModifierKeys(
const static KeyCode super_l = XKeysymToKeycode(m_display, XK_Super_L); const static KeyCode super_l = XKeysymToKeycode(m_display, XK_Super_L);
const static KeyCode super_r = XKeysymToKeycode(m_display, XK_Super_R); const static KeyCode super_r = XKeysymToKeycode(m_display, XK_Super_R);
// shift /* shift */
keys.set(GHOST_kModifierKeyLeftShift, ((m_keyboard_vector[shift_l >> 3] >> (shift_l & 7)) & 1) != 0); keys.set(GHOST_kModifierKeyLeftShift, ((m_keyboard_vector[shift_l >> 3] >> (shift_l & 7)) & 1) != 0);
keys.set(GHOST_kModifierKeyRightShift, ((m_keyboard_vector[shift_r >> 3] >> (shift_r & 7)) & 1) != 0); keys.set(GHOST_kModifierKeyRightShift, ((m_keyboard_vector[shift_r >> 3] >> (shift_r & 7)) & 1) != 0);
// control /* control */
keys.set(GHOST_kModifierKeyLeftControl, ((m_keyboard_vector[control_l >> 3] >> (control_l & 7)) & 1) != 0); keys.set(GHOST_kModifierKeyLeftControl, ((m_keyboard_vector[control_l >> 3] >> (control_l & 7)) & 1) != 0);
keys.set(GHOST_kModifierKeyRightControl, ((m_keyboard_vector[control_r >> 3] >> (control_r & 7)) & 1) != 0); keys.set(GHOST_kModifierKeyRightControl, ((m_keyboard_vector[control_r >> 3] >> (control_r & 7)) & 1) != 0);
// alt /* alt */
keys.set(GHOST_kModifierKeyLeftAlt, ((m_keyboard_vector[alt_l >> 3] >> (alt_l & 7)) & 1) != 0); keys.set(GHOST_kModifierKeyLeftAlt, ((m_keyboard_vector[alt_l >> 3] >> (alt_l & 7)) & 1) != 0);
keys.set(GHOST_kModifierKeyRightAlt, ((m_keyboard_vector[alt_r >> 3] >> (alt_r & 7)) & 1) != 0); keys.set(GHOST_kModifierKeyRightAlt, ((m_keyboard_vector[alt_r >> 3] >> (alt_r & 7)) & 1) != 0);
// super (windows) - only one GHOST-kModifierKeyOS, so mapping to either /* super (windows) - only one GHOST-kModifierKeyOS, so mapping to either */
keys.set(GHOST_kModifierKeyOS, ( ((m_keyboard_vector[super_l >> 3] >> (super_l & 7)) & 1) || keys.set(GHOST_kModifierKeyOS, ( ((m_keyboard_vector[super_l >> 3] >> (super_l & 7)) & 1) ||
((m_keyboard_vector[super_r >> 3] >> (super_r & 7)) & 1) ) != 0); ((m_keyboard_vector[super_r >> 3] >> (super_r & 7)) & 1) ) != 0);
@ -1123,9 +1124,9 @@ setCursorPosition(
GHOST_TInt32 y GHOST_TInt32 y
) { ) {
// This is a brute force move in screen coordinates /* This is a brute force move in screen coordinates
// XWarpPointer does relative moves so first determine the * XWarpPointer does relative moves so first determine the
// current pointer position. * current pointer position. */
int cx, cy; int cx, cy;
if (getCursorPosition(cx, cy) == GHOST_kFailure) { if (getCursorPosition(cx, cy) == GHOST_kFailure) {
@ -1344,7 +1345,7 @@ convertXKey(KeySym key)
#define XCLIB_XCOUT_FALLBACK_COMP 5 /* compouned failed, move to text. */ #define XCLIB_XCOUT_FALLBACK_COMP 5 /* compouned failed, move to text. */
#define XCLIB_XCOUT_FALLBACK_TEXT 6 #define XCLIB_XCOUT_FALLBACK_TEXT 6
// Retrieves the contents of a selections. /* Retrieves the contents of a selections. */
void GHOST_SystemX11::getClipboard_xcout(XEvent evt, void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
Atom sel, Atom target, unsigned char **txt, Atom sel, Atom target, unsigned char **txt,
unsigned long *len, unsigned int *context) const unsigned long *len, unsigned int *context) const
@ -1361,15 +1362,15 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
Window win = window->getXWindow(); Window win = window->getXWindow();
switch (*context) { switch (*context) {
// There is no context, do an XConvertSelection() /* There is no context, do an XConvertSelection() */
case XCLIB_XCOUT_NONE: case XCLIB_XCOUT_NONE:
// Initialise return length to 0 /* Initialise return length to 0 */
if (*len > 0) { if (*len > 0) {
free(*txt); free(*txt);
*len = 0; *len = 0;
} }
// Send a selection request /* Send a selection request */
XConvertSelection(m_display, sel, target, m_xclip_out, win, CurrentTime); XConvertSelection(m_display, sel, target, m_xclip_out, win, CurrentTime);
*context = XCLIB_XCOUT_SENTCONVSEL; *context = XCLIB_XCOUT_SENTCONVSEL;
return; return;
@ -1391,22 +1392,22 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
return; return;
} }
// find the size and format of the data in property /* find the size and format of the data in property */
XGetWindowProperty(m_display, win, m_xclip_out, 0, 0, False, XGetWindowProperty(m_display, win, m_xclip_out, 0, 0, False,
AnyPropertyType, &pty_type, &pty_format, AnyPropertyType, &pty_type, &pty_format,
&pty_items, &pty_size, &buffer); &pty_items, &pty_size, &buffer);
XFree(buffer); XFree(buffer);
if (pty_type == m_incr) { if (pty_type == m_incr) {
// start INCR mechanism by deleting property /* start INCR mechanism by deleting property */
XDeleteProperty(m_display, win, m_xclip_out); XDeleteProperty(m_display, win, m_xclip_out);
XFlush(m_display); XFlush(m_display);
*context = XCLIB_XCOUT_INCR; *context = XCLIB_XCOUT_INCR;
return; return;
} }
// if it's not incr, and not format == 8, then there's /* if it's not incr, and not format == 8, then there's
// nothing in the selection (that xclip understands, anyway) * nothing in the selection (that xclip understands, anyway) */
if (pty_format != 8) { if (pty_format != 8) {
*context = XCLIB_XCOUT_NONE; *context = XCLIB_XCOUT_NONE;
@ -1418,73 +1419,73 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
False, AnyPropertyType, &pty_type, False, AnyPropertyType, &pty_type,
&pty_format, &pty_items, &pty_size, &buffer); &pty_format, &pty_items, &pty_size, &buffer);
// finished with property, delete it /* finished with property, delete it */
XDeleteProperty(m_display, win, m_xclip_out); XDeleteProperty(m_display, win, m_xclip_out);
// copy the buffer to the pointer for returned data /* copy the buffer to the pointer for returned data */
ltxt = (unsigned char *) malloc(pty_items); ltxt = (unsigned char *) malloc(pty_items);
memcpy(ltxt, buffer, pty_items); memcpy(ltxt, buffer, pty_items);
// set the length of the returned data /* set the length of the returned data */
*len = pty_items; *len = pty_items;
*txt = ltxt; *txt = ltxt;
// free the buffer /* free the buffer */
XFree(buffer); XFree(buffer);
*context = XCLIB_XCOUT_NONE; *context = XCLIB_XCOUT_NONE;
// complete contents of selection fetched, return 1 /* complete contents of selection fetched, return 1 */
return; return;
case XCLIB_XCOUT_INCR: case XCLIB_XCOUT_INCR:
// To use the INCR method, we basically delete the /* To use the INCR method, we basically delete the
// property with the selection in it, wait for an * property with the selection in it, wait for an
// event indicating that the property has been created, * event indicating that the property has been created,
// then read it, delete it, etc. * then read it, delete it, etc. */
// make sure that the event is relevant /* make sure that the event is relevant */
if (evt.type != PropertyNotify) if (evt.type != PropertyNotify)
return; return;
// skip unless the property has a new value /* skip unless the property has a new value */
if (evt.xproperty.state != PropertyNewValue) if (evt.xproperty.state != PropertyNewValue)
return; return;
// check size and format of the property /* check size and format of the property */
XGetWindowProperty(m_display, win, m_xclip_out, 0, 0, False, XGetWindowProperty(m_display, win, m_xclip_out, 0, 0, False,
AnyPropertyType, &pty_type, &pty_format, AnyPropertyType, &pty_type, &pty_format,
&pty_items, &pty_size, (unsigned char **) &buffer); &pty_items, &pty_size, (unsigned char **) &buffer);
if (pty_format != 8) { if (pty_format != 8) {
// property does not contain text, delete it /* property does not contain text, delete it
// to tell the other X client that we have read * to tell the other X client that we have read
// it and to send the next property * it and to send the next property */
XFree(buffer); XFree(buffer);
XDeleteProperty(m_display, win, m_xclip_out); XDeleteProperty(m_display, win, m_xclip_out);
return; return;
} }
if (pty_size == 0) { if (pty_size == 0) {
// no more data, exit from loop /* no more data, exit from loop */
XFree(buffer); XFree(buffer);
XDeleteProperty(m_display, win, m_xclip_out); XDeleteProperty(m_display, win, m_xclip_out);
*context = XCLIB_XCOUT_NONE; *context = XCLIB_XCOUT_NONE;
// this means that an INCR transfer is now /* this means that an INCR transfer is now
// complete, return 1 * complete, return 1 */
return; return;
} }
XFree(buffer); XFree(buffer);
// if we have come this far, the propery contains /* if we have come this far, the property contains
// text, we know the size. * text, we know the size. */
XGetWindowProperty(m_display, win, m_xclip_out, 0, (long) pty_size, XGetWindowProperty(m_display, win, m_xclip_out, 0, (long) pty_size,
False, AnyPropertyType, &pty_type, &pty_format, False, AnyPropertyType, &pty_type, &pty_format,
&pty_items, &pty_size, (unsigned char **) &buffer); &pty_items, &pty_size, (unsigned char **) &buffer);
// allocate memory to accommodate data in *txt /* allocate memory to accommodate data in *txt */
if (*len == 0) { if (*len == 0) {
*len = pty_items; *len = pty_items;
ltxt = (unsigned char *) malloc(*len); ltxt = (unsigned char *) malloc(*len);
@ -1494,13 +1495,13 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
ltxt = (unsigned char *) realloc(ltxt, *len); ltxt = (unsigned char *) realloc(ltxt, *len);
} }
// add data to ltxt /* add data to ltxt */
memcpy(&ltxt[*len - pty_items], buffer, pty_items); memcpy(&ltxt[*len - pty_items], buffer, pty_items);
*txt = ltxt; *txt = ltxt;
XFree(buffer); XFree(buffer);
// delete property to get the next item /* delete property to get the next item */
XDeleteProperty(m_display, win, m_xclip_out); XDeleteProperty(m_display, win, m_xclip_out);
XFlush(m_display); XFlush(m_display);
return; return;
@ -1514,7 +1515,7 @@ GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const
Atom target = m_utf8_string; Atom target = m_utf8_string;
Window owner; Window owner;
// from xclip.c doOut() v0.11 /* from xclip.c doOut() v0.11 */
unsigned char *sel_buf; unsigned char *sel_buf;
unsigned long sel_len = 0; unsigned long sel_len = 0;
XEvent evt; XEvent evt;

@ -335,7 +335,7 @@ protected:
/** Modified state : are there unsaved changes */ /** Modified state : are there unsaved changes */
bool m_isUnsavedChanges; bool m_isUnsavedChanges;
/** Stores wether this is a full screen window. */ /** Stores whether this is a full screen window. */
bool m_fullScreen; bool m_fullScreen;
/** Stereo visual created. Only necessary for 'real' stereo support, /** Stereo visual created. Only necessary for 'real' stereo support,

@ -39,7 +39,7 @@
#include "GHOST_DropTargetX11.h" #include "GHOST_DropTargetX11.h"
#endif #endif
// For standard X11 cursors /* For standard X11 cursors */
#include <X11/cursorfont.h> #include <X11/cursorfont.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>
@ -53,8 +53,8 @@
#include <algorithm> #include <algorithm>
#include <string> #include <string>
// For obscure full screen mode stuuf /* For obscure full screen mode stuuf
// lifted verbatim from blut. * lifted verbatim from blut. */
typedef struct { typedef struct {
long flags; long flags;
@ -95,7 +95,7 @@ typedef struct {
f.write('\n') f.write('\n')
*/ */
// See the python script above to regenerate the 48x48 icon within blender /* See the python script above to regenerate the 48x48 icon within blender */
#define BLENDER_ICON_WIDTH 48 #define BLENDER_ICON_WIDTH 48
#define BLENDER_ICON_HEIGHT 48 #define BLENDER_ICON_HEIGHT 48
static unsigned char BLENDER_ICON_48x48x24[] = { static unsigned char BLENDER_ICON_48x48x24[] = {
@ -178,13 +178,13 @@ GHOST_WindowX11(
m_custom_cursor(None) m_custom_cursor(None)
{ {
// Set up the minimum atrributes that we require and see if /* Set up the minimum atrributes that we require and see if
// X can find us a visual matching those requirements. * X can find us a visual matching those requirements. */
int attributes[40], i, samples; int attributes[40], i, samples;
Atom atoms[2]; Atom atoms[2];
int natom; int natom;
int glxVersionMajor, glxVersionMinor; // As in GLX major.minor int glxVersionMajor, glxVersionMinor; /* As in GLX major.minor */
#ifdef WITH_X11_XINPUT #ifdef WITH_X11_XINPUT
/* initialize incase X11 fails to load */ /* initialize incase X11 fails to load */
@ -251,11 +251,11 @@ GHOST_WindowX11(
} }
} }
// Create a bunch of attributes needed to create an X window. /* Create a bunch of attributes needed to create an X window. */
// First create a colormap for the window and visual. /* First create a colormap for the window and visual.
// This seems pretty much a legacy feature as we are in rgba mode anyway. * This seems pretty much a legacy feature as we are in rgba mode anyway. */
XSetWindowAttributes xattributes; XSetWindowAttributes xattributes;
memset(&xattributes, 0, sizeof(xattributes)); memset(&xattributes, 0, sizeof(xattributes));
@ -268,7 +268,7 @@ GHOST_WindowX11(
xattributes.border_pixel = 0; xattributes.border_pixel = 0;
// Specify which events we are interested in hearing. /* Specify which events we are interested in hearing. */
xattributes.event_mask = xattributes.event_mask =
ExposureMask | StructureNotifyMask | ExposureMask | StructureNotifyMask |
@ -277,7 +277,7 @@ GHOST_WindowX11(
ButtonPressMask | ButtonReleaseMask | ButtonPressMask | ButtonReleaseMask |
PointerMotionMask | FocusChangeMask | PropertyChangeMask; PointerMotionMask | FocusChangeMask | PropertyChangeMask;
// create the window! /* create the window! */
; ;
if (parentWindow == 0) { if (parentWindow == 0) {
@ -287,7 +287,7 @@ GHOST_WindowX11(
top, top,
width, width,
height, height,
0, // no border. 0, /* no border. */
m_visual->depth, m_visual->depth,
InputOutput, InputOutput,
m_visual->visual, m_visual->visual,
@ -311,12 +311,12 @@ GHOST_WindowX11(
m_window = XCreateWindow(m_display, m_window = XCreateWindow(m_display,
parentWindow, // reparent against embedder parentWindow, /* reparent against embedder */
left, left,
top, top,
width, width,
height, height,
0, // no border. 0, /* no border. */
m_visual->depth, m_visual->depth,
InputOutput, InputOutput,
m_visual->visual, m_visual->visual,
@ -354,8 +354,8 @@ GHOST_WindowX11(
m_post_state = GHOST_kWindowStateNormal; m_post_state = GHOST_kWindowStateNormal;
} }
// Create some hints for the window manager on how /* Create some hints for the window manager on how
// we want this window treated. * we want this window treated. */
XSizeHints *xsizehints = XAllocSizeHints(); XSizeHints *xsizehints = XAllocSizeHints();
xsizehints->flags = PPosition | PSize | PMinSize | PMaxSize; xsizehints->flags = PPosition | PSize | PMinSize | PMaxSize;
@ -363,8 +363,8 @@ GHOST_WindowX11(
xsizehints->y = top; xsizehints->y = top;
xsizehints->width = width; xsizehints->width = width;
xsizehints->height = height; xsizehints->height = height;
xsizehints->min_width = 320; // size hints, could be made apart of the ghost api xsizehints->min_width = 320; /* size hints, could be made apart of the ghost api */
xsizehints->min_height = 240; // limits are also arbitrary, but should not allow 1x1 window xsizehints->min_height = 240; /* limits are also arbitrary, but should not allow 1x1 window */
xsizehints->max_width = 65535; xsizehints->max_width = 65535;
xsizehints->max_height = 65535; xsizehints->max_height = 65535;
XSetWMNormalHints(m_display, m_window, xsizehints); XSetWMNormalHints(m_display, m_window, xsizehints);
@ -404,7 +404,7 @@ GHOST_WindowX11(
m_xic = NULL; m_xic = NULL;
#endif #endif
// Set the window icon /* Set the window icon */
XWMHints *xwmhints = XAllocWMHints(); XWMHints *xwmhints = XAllocWMHints();
XImage *x_image, *mask_image; XImage *x_image, *mask_image;
Pixmap icon_pixmap, mask_pixmap; Pixmap icon_pixmap, mask_pixmap;
@ -442,7 +442,7 @@ GHOST_WindowX11(
XPutImage(display, icon_pixmap, gc_icon, x_image, 0, 0, 0, 0, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT); XPutImage(display, icon_pixmap, gc_icon, x_image, 0, 0, 0, 0, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT);
XPutImage(display, mask_pixmap, gc_mask, mask_image, 0, 0, 0, 0, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT); XPutImage(display, mask_pixmap, gc_mask, mask_image, 0, 0, 0, 0, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT);
// Now the pixmap is ok to assign to the window as a hint /* Now the pixmap is ok to assign to the window as a hint */
xwmhints->icon_pixmap = icon_pixmap; xwmhints->icon_pixmap = icon_pixmap;
xwmhints->icon_mask = mask_pixmap; xwmhints->icon_mask = mask_pixmap;
XFreeGC(display, gc_icon); XFreeGC(display, gc_icon);
@ -455,7 +455,7 @@ GHOST_WindowX11(
xwmhints->flags = InputHint | IconPixmapHint | IconMaskHint | StateHint; xwmhints->flags = InputHint | IconPixmapHint | IconMaskHint | StateHint;
XSetWMHints(display, m_window, xwmhints); XSetWMHints(display, m_window, xwmhints);
XFree(xwmhints); XFree(xwmhints);
// done setting the icon /* done setting the icon */
setTitle(title); setTitle(title);
@ -463,7 +463,7 @@ GHOST_WindowX11(
initXInputDevices(); initXInputDevices();
#endif #endif
// now set up the rendering context. /* now set up the rendering context. */
if (installDrawingContext(type) == GHOST_kSuccess) { if (installDrawingContext(type) == GHOST_kSuccess) {
m_valid_setup = true; m_valid_setup = true;
GHOST_PRINT("Created window\n"); GHOST_PRINT("Created window\n");
@ -748,8 +748,8 @@ setTitle(
(const unsigned char *) title.ReadPtr(), (const unsigned char *) title.ReadPtr(),
title.Length()); title.Length());
// This should convert to valid x11 string /* This should convert to valid x11 string
// and getTitle would need matching change * and getTitle would need matching change */
XStoreName(m_display, m_window, title); XStoreName(m_display, m_window, title);
XFlush(m_display); XFlush(m_display);
@ -772,8 +772,8 @@ GHOST_WindowX11::
getWindowBounds( getWindowBounds(
GHOST_Rect& bounds) const GHOST_Rect& bounds) const
{ {
// Getting the window bounds under X11 is not /* Getting the window bounds under X11 is not
// really supported (nor should it be desired). * really supported (nor should it be desired). */
getClientBounds(bounds); getClientBounds(bounds);
} }
@ -848,7 +848,7 @@ screenToClient(
GHOST_TInt32& outX, GHOST_TInt32& outX,
GHOST_TInt32& outY) const GHOST_TInt32& outY) const
{ {
// This is correct! /* This is correct! */
int ax, ay; int ax, ay;
Window temp; Window temp;
@ -1274,18 +1274,18 @@ GHOST_TSuccess
GHOST_WindowX11:: GHOST_WindowX11::
invalidate() invalidate()
{ {
// So the idea of this function is to generate an expose event /* So the idea of this function is to generate an expose event
// for the window. * for the window.
// Unfortunately X does not handle expose events for you and * Unfortunately X does not handle expose events for you and
// it is the client's job to refresh the dirty part of the window. * it is the client's job to refresh the dirty part of the window.
// We need to queue up invalidate calls and generate GHOST events * We need to queue up invalidate calls and generate GHOST events
// for them in the system. * for them in the system.
*
// We implement this by setting a boolean in this class to concatenate * We implement this by setting a boolean in this class to concatenate
// all such calls into a single event for this window. * all such calls into a single event for this window.
*
// At the same time we queue the dirty windows in the system class * At the same time we queue the dirty windows in the system class
// and generate events for them at the next processEvents call. * and generate events for them at the next processEvents call. */
if (m_invalid_window == false) { if (m_invalid_window == false) {
m_system->addDirtyWindow(this); m_system->addDirtyWindow(this);
@ -1384,7 +1384,7 @@ GHOST_WindowX11::
installDrawingContext( installDrawingContext(
GHOST_TDrawingContextType type) GHOST_TDrawingContextType type)
{ {
// only support openGL for now. /* only support openGL for now. */
GHOST_TSuccess success; GHOST_TSuccess success;
switch (type) { switch (type) {
case GHOST_kDrawingContextTypeOpenGL: case GHOST_kDrawingContextTypeOpenGL:

@ -63,6 +63,9 @@
#include <stdio.h> /* needed for FILE* */ #include <stdio.h> /* needed for FILE* */
#include "MEM_sys_types.h" /* needed for uintptr_t */ #include "MEM_sys_types.h" /* needed for uintptr_t */
/* some GNU attributes are only available from GCC 4.3 */
#define MEM_GNU_ATTRIBUTES (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403))
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -71,7 +74,7 @@ extern "C" {
* by vmemh. If the pointer was not previously allocated by this * by vmemh. If the pointer was not previously allocated by this
* module, the result is undefined.*/ * module, the result is undefined.*/
size_t MEM_allocN_len(const void *vmemh) size_t MEM_allocN_len(const void *vmemh)
#ifdef __GNUC__ #if MEM_GNU_ATTRIBUTES
__attribute__((warn_unused_result)) __attribute__((warn_unused_result))
#endif #endif
; ;
@ -90,7 +93,7 @@ extern "C" {
* Duplicates a block of memory, and returns a pointer to the * Duplicates a block of memory, and returns a pointer to the
* newly allocated block. */ * newly allocated block. */
void *MEM_dupallocN(void *vmemh) void *MEM_dupallocN(void *vmemh)
#ifdef __GNUC__ #if MEM_GNU_ATTRIBUTES
__attribute__((warn_unused_result)) __attribute__((warn_unused_result))
#endif #endif
; ;
@ -101,7 +104,7 @@ extern "C" {
* as a system realloc but just makes a new allocation and copies * as a system realloc but just makes a new allocation and copies
* over from existing memory. */ * over from existing memory. */
void *MEM_reallocN(void *vmemh, size_t len) void *MEM_reallocN(void *vmemh, size_t len)
#ifdef __GNUC__ #if MEM_GNU_ATTRIBUTES
__attribute__((warn_unused_result)) __attribute__((warn_unused_result))
__attribute__((alloc_size(2))) __attribute__((alloc_size(2)))
#endif #endif
@ -112,7 +115,7 @@ extern "C" {
* memory is cleared. The name must be static, because only a * memory is cleared. The name must be static, because only a
* pointer to it is stored ! */ * pointer to it is stored ! */
void *MEM_callocN(size_t len, const char *str) void *MEM_callocN(size_t len, const char *str)
#ifdef __GNUC__ #if MEM_GNU_ATTRIBUTES
__attribute__((warn_unused_result)) __attribute__((warn_unused_result))
__attribute__((nonnull(2))) __attribute__((nonnull(2)))
__attribute__((alloc_size(1))) __attribute__((alloc_size(1)))
@ -124,7 +127,7 @@ extern "C" {
* name must be a static, because only a pointer to it is stored ! * name must be a static, because only a pointer to it is stored !
* */ * */
void *MEM_mallocN(size_t len, const char *str) void *MEM_mallocN(size_t len, const char *str)
#ifdef __GNUC__ #if MEM_GNU_ATTRIBUTES
__attribute__((warn_unused_result)) __attribute__((warn_unused_result))
__attribute__((nonnull(2))) __attribute__((nonnull(2)))
__attribute__((alloc_size(1))) __attribute__((alloc_size(1)))
@ -136,7 +139,7 @@ extern "C" {
* Can be free'd with MEM_freeN as usual. * Can be free'd with MEM_freeN as usual.
* */ * */
void *MEM_mapallocN(size_t len, const char *str) void *MEM_mapallocN(size_t len, const char *str)
#ifdef __GNUC__ #if MEM_GNU_ATTRIBUTES
__attribute__((warn_unused_result)) __attribute__((warn_unused_result))
__attribute__((nonnull(2))) __attribute__((nonnull(2)))
__attribute__((alloc_size(1))) __attribute__((alloc_size(1)))
@ -188,7 +191,7 @@ extern "C" {
/** Get the peak memory usage in bytes, including mmap allocations. */ /** Get the peak memory usage in bytes, including mmap allocations. */
uintptr_t MEM_get_peak_memory(void) uintptr_t MEM_get_peak_memory(void)
#ifdef __GNUC__ #if MEM_GNU_ATTRIBUTES
__attribute__((warn_unused_result)) __attribute__((warn_unused_result))
#endif #endif
; ;

@ -54,6 +54,14 @@
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
/* Only for debugging:
* store original buffer's name when doing MEM_dupallocN
* helpful to profile issues with non-freed "dup_alloc" buffers,
* but this introduces some overhead to memory header and makes
* things slower a bit, so betterto keep disabled by default
*/
//#define DEBUG_MEMDUPLINAME
/* Only for debugging: /* Only for debugging:
* lets you count the allocations so as to find the allocator of unfreed memory * lets you count the allocations so as to find the allocator of unfreed memory
* in situations where the leak is predictable */ * in situations where the leak is predictable */
@ -96,6 +104,10 @@ typedef struct MemHead {
#ifdef DEBUG_MEMCOUNTER #ifdef DEBUG_MEMCOUNTER
int _count; int _count;
#endif #endif
#ifdef DEBUG_MEMDUPLINAME
int need_free_name, pad;
#endif
} MemHead; } MemHead;
typedef struct MemTail { typedef struct MemTail {
@ -244,12 +256,35 @@ void *MEM_dupallocN(void *vmemh)
MemHead *memh = vmemh; MemHead *memh = vmemh;
memh--; memh--;
#ifndef DEBUG_MEMDUPLINAME
if (memh->mmap) if (memh->mmap)
newp = MEM_mapallocN(memh->len, "dupli_mapalloc"); newp = MEM_mapallocN(memh->len, "dupli_mapalloc");
else else
newp = MEM_mallocN(memh->len, "dupli_alloc"); newp = MEM_mallocN(memh->len, "dupli_alloc");
if (newp == NULL) return NULL; if (newp == NULL) return NULL;
#else
{
MemHead *nmemh;
char *name = malloc(strlen(memh->name) + 24);
if (memh->mmap) {
sprintf(name, "%s %s", "dupli_mapalloc", memh->name);
newp = MEM_mapallocN(memh->len, name);
}
else {
sprintf(name, "%s %s", "dupli_alloc", memh->name);
newp = MEM_mallocN(memh->len, name);
}
if (newp == NULL) return NULL;
nmemh = newp;
nmemh--;
nmemh->need_free_name = 1;
}
#endif
memcpy(newp, vmemh, memh->len); memcpy(newp, vmemh, memh->len);
} }
@ -290,6 +325,10 @@ static void make_memhead_header(MemHead *memh, size_t len, const char *str)
memh->mmap = 0; memh->mmap = 0;
memh->tag2 = MEMTAG2; memh->tag2 = MEMTAG2;
#ifdef DEBUG_MEMDUPLINAME
memh->need_free_name = 0;
#endif
memt = (MemTail *)(((char *) memh) + sizeof(MemHead) + len); memt = (MemTail *)(((char *) memh) + sizeof(MemHead) + len);
memt->tag3 = MEMTAG3; memt->tag3 = MEMTAG3;
@ -605,7 +644,7 @@ void MEM_printmemlist_pydict(void)
MEM_printmemlist_internal(1); MEM_printmemlist_internal(1);
} }
short MEM_freeN(void *vmemh) /* anders compileertie niet meer */ short MEM_freeN(void *vmemh)
{ {
short error = 0; short error = 0;
MemTail *memt; MemTail *memt;
@ -733,6 +772,11 @@ static void rem_memblock(MemHead *memh)
totblock--; totblock--;
mem_in_use -= memh->len; mem_in_use -= memh->len;
#ifdef DEBUG_MEMDUPLINAME
if (memh->need_free_name)
free((char *) memh->name);
#endif
if (memh->mmap) { if (memh->mmap) {
mmap_in_use -= memh->len; mmap_in_use -= memh->len;
if (munmap(memh, memh->len + sizeof(MemHead) + sizeof(MemTail))) if (munmap(memh, memh->len + sizeof(MemHead) + sizeof(MemTail)))

@ -163,6 +163,9 @@ float IK_SolverGetPoleAngle(IK_Solver *solver);
int IK_Solve(IK_Solver *solver, float tolerance, int max_iterations); int IK_Solve(IK_Solver *solver, float tolerance, int max_iterations);
#define IK_STRETCH_STIFF_EPS 0.001f
#define IK_STRETCH_STIFF_MIN 0.001f
#define IK_STRETCH_STIFF_MAX 1e10
#ifdef __cplusplus #ifdef __cplusplus
} }

@ -106,14 +106,14 @@ void IK_QJacobian::ArmMatrices(int dof, int task_size)
void IK_QJacobian::SetBetas(int id, int, const MT_Vector3& v) void IK_QJacobian::SetBetas(int id, int, const MT_Vector3& v)
{ {
m_beta[id] = v.x(); m_beta[id + 0] = v.x();
m_beta[id + 1] = v.y(); m_beta[id + 1] = v.y();
m_beta[id + 2] = v.z(); m_beta[id + 2] = v.z();
} }
void IK_QJacobian::SetDerivatives(int id, int dof_id, const MT_Vector3& v, MT_Scalar norm_weight) void IK_QJacobian::SetDerivatives(int id, int dof_id, const MT_Vector3& v, MT_Scalar norm_weight)
{ {
m_jacobian[id][dof_id] = v.x()*m_weight_sqrt[dof_id]; m_jacobian[id + 0][dof_id] = v.x() * m_weight_sqrt[dof_id];
m_jacobian[id + 1][dof_id] = v.y() * m_weight_sqrt[dof_id]; m_jacobian[id + 1][dof_id] = v.y() * m_weight_sqrt[dof_id];
m_jacobian[id + 2][dof_id] = v.z() * m_weight_sqrt[dof_id]; m_jacobian[id + 2][dof_id] = v.z() * m_weight_sqrt[dof_id];

@ -46,18 +46,18 @@ IK_QJacobianSolver::IK_QJacobianSolver()
MT_Scalar IK_QJacobianSolver::ComputeScale() MT_Scalar IK_QJacobianSolver::ComputeScale()
{ {
std::vector<IK_QSegment *>::iterator seg; std::vector<IK_QSegment *>::iterator seg;
float length = 0.0f; MT_Scalar length = 0.0f;
for (seg = m_segments.begin(); seg != m_segments.end(); seg++) for (seg = m_segments.begin(); seg != m_segments.end(); seg++)
length += (*seg)->MaxExtension(); length += (*seg)->MaxExtension();
if(length == 0.0f) if (length == 0.0)
return 1.0f; return 1.0;
else else
return 1.0f/length; return 1.0 / length;
} }
void IK_QJacobianSolver::Scale(float scale, std::list<IK_QTask*>& tasks) void IK_QJacobianSolver::Scale(MT_Scalar scale, std::list<IK_QTask *>& tasks)
{ {
std::list<IK_QTask *>::iterator task; std::list<IK_QTask *>::iterator task;
std::vector<IK_QSegment *>::iterator seg; std::vector<IK_QSegment *>::iterator seg;
@ -172,8 +172,8 @@ void IK_QJacobianSolver::SetPoleVectorConstraint(IK_QSegment *tip, MT_Vector3& g
static MT_Scalar safe_acos(MT_Scalar f) static MT_Scalar safe_acos(MT_Scalar f)
{ {
// acos that does not return NaN with rounding errors // acos that does not return NaN with rounding errors
if (f <= -1.0f) return MT_PI; if (f <= -1.0) return MT_PI;
else if (f >= 1.0f) return 0.0; else if (f >= 1.0) return 0.0;
else return acos(f); else return acos(f);
} }
@ -245,7 +245,7 @@ void IK_QJacobianSolver::ConstrainPoleVector(IK_QSegment *root, std::list<IK_QTa
// we compute the pole angle that to rotate towards the target // we compute the pole angle that to rotate towards the target
m_poleangle = angle(mat[1], polemat[1]); m_poleangle = angle(mat[1], polemat[1]);
if(rootz.dot(mat[1]*cos(m_poleangle) + mat[0]*sin(m_poleangle)) > 0.0f) if (rootz.dot(mat[1] * cos(m_poleangle) + mat[0] * sin(m_poleangle)) > 0.0)
m_poleangle = -m_poleangle; m_poleangle = -m_poleangle;
// solve again, with the pole angle we just computed // solve again, with the pole angle we just computed

@ -77,7 +77,7 @@ private:
void ConstrainPoleVector(IK_QSegment *root, std::list<IK_QTask*>& tasks); void ConstrainPoleVector(IK_QSegment *root, std::list<IK_QTask*>& tasks);
MT_Scalar ComputeScale(); MT_Scalar ComputeScale();
void Scale(float scale, std::list<IK_QTask*>& tasks); void Scale(MT_Scalar scale, std::list<IK_QTask*>& tasks);
private: private:

@ -66,7 +66,8 @@ static MT_Scalar EulerAngleFromMatrix(const MT_Matrix3x3& R, int axis)
if (axis == 0) return -atan2(R[1][2], R[2][2]); if (axis == 0) return -atan2(R[1][2], R[2][2]);
else if (axis == 1) return atan2(-R[0][2], t); else if (axis == 1) return atan2(-R[0][2], t);
else return -atan2(R[0][1], R[0][0]); else return -atan2(R[0][1], R[0][0]);
} else { }
else {
if (axis == 0) return -atan2(-R[2][1], R[1][1]); if (axis == 0) return -atan2(-R[2][1], R[1][1]);
else if (axis == 1) return atan2(-R[0][2], t); else if (axis == 1) return atan2(-R[0][2], t);
else return 0.0f; else return 0.0f;
@ -75,9 +76,9 @@ static MT_Scalar EulerAngleFromMatrix(const MT_Matrix3x3& R, int axis)
static MT_Scalar safe_acos(MT_Scalar f) static MT_Scalar safe_acos(MT_Scalar f)
{ {
if (f <= -1.0f) if (f <= -1.0)
return MT_PI; return MT_PI;
else if (f >= 1.0f) else if (f >= 1.0)
return 0.0; return 0.0;
else else
return acos(f); return acos(f);
@ -89,7 +90,7 @@ static MT_Scalar ComputeTwist(const MT_Matrix3x3& R)
MT_Scalar qy = R[0][2] - R[2][0]; MT_Scalar qy = R[0][2] - R[2][0];
MT_Scalar qw = R[0][0] + R[1][1] + R[2][2] + 1; MT_Scalar qw = R[0][0] + R[1][1] + R[2][2] + 1;
MT_Scalar tau = 2*atan2(qy, qw); MT_Scalar tau = 2.0 * atan2(qy, qw);
return tau; return tau;
} }
@ -345,7 +346,7 @@ void IK_QSegment::PrependBasis(const MT_Matrix3x3& mat)
m_basis = m_rest_basis.inverse() * mat * m_rest_basis * m_basis; m_basis = m_rest_basis.inverse() * mat * m_rest_basis * m_basis;
} }
void IK_QSegment::Scale(float scale) void IK_QSegment::Scale(MT_Scalar scale)
{ {
m_start *= scale; m_start *= scale;
m_translation *= scale; m_translation *= scale;
@ -1035,7 +1036,7 @@ void IK_QTranslateSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax)
m_limit[axis] = true; m_limit[axis] = true;
} }
void IK_QTranslateSegment::Scale(float scale) void IK_QTranslateSegment::Scale(MT_Scalar scale)
{ {
int i; int i;

@ -170,7 +170,7 @@ public:
void Reset(); void Reset();
// scale // scale
virtual void Scale(float scale); virtual void Scale(MT_Scalar scale);
protected: protected:
@ -338,7 +338,7 @@ public:
void SetWeight(int axis, MT_Scalar weight); void SetWeight(int axis, MT_Scalar weight);
void SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax); void SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax);
void Scale(float scale); void Scale(MT_Scalar scale);
private: private:
int m_axis[3]; int m_axis[3];

@ -78,7 +78,7 @@ public:
virtual bool PositionTask() const { return false; } virtual bool PositionTask() const { return false; }
virtual void Scale(float) {} virtual void Scale(MT_Scalar) {}
protected: protected:
int m_id; int m_id;
@ -103,7 +103,7 @@ public:
MT_Scalar Distance() const; MT_Scalar Distance() const;
bool PositionTask() const { return true; } bool PositionTask() const { return true; }
void Scale(float scale) { m_goal *= scale; m_clamp_length *= scale; } void Scale(MT_Scalar scale) { m_goal *= scale; m_clamp_length *= scale; }
private: private:
MT_Vector3 m_goal; MT_Vector3 m_goal;
@ -141,7 +141,7 @@ public:
MT_Scalar Distance() const; MT_Scalar Distance() const;
void Scale(float scale) { m_goal_center *= scale; m_distance *= scale; } void Scale(MT_Scalar scale) { m_goal_center *= scale; m_distance *= scale; }
private: private:
MT_Scalar ComputeTotalMass(const IK_QSegment *segment); MT_Scalar ComputeTotalMass(const IK_QSegment *segment);

@ -42,7 +42,8 @@ using namespace std;
class IK_QSolver { class IK_QSolver {
public: public:
IK_QSolver() : root(NULL) {}; IK_QSolver() : root(NULL) {
};
IK_QJacobianSolver solver; IK_QJacobianSolver solver;
IK_QSegment *root; IK_QSegment *root;
@ -197,14 +198,14 @@ void IK_SetLimit(IK_Segment *seg, IK_SegmentAxis axis, float lmin, float lmax)
void IK_SetStiffness(IK_Segment *seg, IK_SegmentAxis axis, float stiffness) void IK_SetStiffness(IK_Segment *seg, IK_SegmentAxis axis, float stiffness)
{ {
if (stiffness < 0.0) if (stiffness < 0.0f)
return; return;
if (stiffness > 0.999) if (stiffness > (1.0 - IK_STRETCH_STIFF_EPS))
stiffness = 0.999; stiffness = (1.0 - IK_STRETCH_STIFF_EPS);
IK_QSegment *qseg = (IK_QSegment *)seg; IK_QSegment *qseg = (IK_QSegment *)seg;
MT_Scalar weight = 1.0-stiffness; MT_Scalar weight = 1.0f - stiffness;
if (axis >= IK_TRANS_X) { if (axis >= IK_TRANS_X) {
if (!qseg->Translational()) { if (!qseg->Translational()) {

@ -40,8 +40,8 @@
void void
MT_ExpMap:: MT_ExpMap::
setRotation( setRotation(
const MT_Quaternion &q const MT_Quaternion &q)
) { {
// ok first normalize the quaternion // ok first normalize the quaternion
// then compute theta the axis-angle and the normalized axis v // then compute theta the axis-angle and the normalized axis v
// scale v by theta and that's it hopefully! // scale v by theta and that's it hopefully!
@ -64,8 +64,8 @@ setRotation(
const MT_Quaternion& const MT_Quaternion&
MT_ExpMap:: MT_ExpMap::
getRotation( getRotation() const
) const { {
return m_q; return m_q;
} }
@ -75,8 +75,8 @@ getRotation(
MT_Matrix3x3 MT_Matrix3x3
MT_ExpMap:: MT_ExpMap::
getMatrix( getMatrix() const
) const { {
return MT_Matrix3x3(m_q); return MT_Matrix3x3(m_q);
} }
@ -87,8 +87,8 @@ getMatrix(
void void
MT_ExpMap:: MT_ExpMap::
update( update(
const MT_Vector3& dv const MT_Vector3& dv)
){ {
m_v += dv; m_v += dv;
angleUpdated(); angleUpdated();
@ -105,9 +105,8 @@ MT_ExpMap::
partialDerivatives( partialDerivatives(
MT_Matrix3x3& dRdx, MT_Matrix3x3& dRdx,
MT_Matrix3x3& dRdy, MT_Matrix3x3& dRdy,
MT_Matrix3x3& dRdz MT_Matrix3x3& dRdz) const
) const { {
MT_Quaternion dQdx[3]; MT_Quaternion dQdx[3];
compute_dQdVi(dQdx); compute_dQdVi(dQdx);
@ -121,9 +120,8 @@ partialDerivatives(
MT_ExpMap:: MT_ExpMap::
compute_dRdVi( compute_dRdVi(
const MT_Quaternion &dQdvi, const MT_Quaternion &dQdvi,
MT_Matrix3x3 & dRdvi MT_Matrix3x3 & dRdvi) const
) const { {
MT_Scalar prod[9]; MT_Scalar prod[9];
/* This efficient formulation is arrived at by writing out the /* This efficient formulation is arrived at by writing out the
@ -160,9 +158,8 @@ compute_dRdVi(
void void
MT_ExpMap:: MT_ExpMap::
compute_dQdVi( compute_dQdVi(
MT_Quaternion *dQdX MT_Quaternion *dQdX) const
) const { {
/* This is an efficient implementation of the derivatives given /* This is an efficient implementation of the derivatives given
* in Appendix A of the paper with common subexpressions factored out */ * in Appendix A of the paper with common subexpressions factored out */
@ -199,8 +196,8 @@ compute_dQdVi(
void void
MT_ExpMap:: MT_ExpMap::
reParametrize( reParametrize()
){ {
if (m_theta > MT_PI) { if (m_theta > MT_PI) {
MT_Scalar scl = m_theta; MT_Scalar scl = m_theta;
if (m_theta > MT_2_PI) { /* first get theta into range 0..2PI */ if (m_theta > MT_2_PI) { /* first get theta into range 0..2PI */
@ -221,8 +218,8 @@ reParametrize(
void void
MT_ExpMap:: MT_ExpMap::
angleUpdated( angleUpdated()
){ {
m_theta = m_v.length(); m_theta = m_v.length();
reParametrize(); reParametrize();
@ -238,7 +235,8 @@ angleUpdated(
m_q.y() = temp.y(); m_q.y() = temp.y();
m_q.z() = temp.z(); m_q.z() = temp.z();
m_q.w() = MT_Scalar(1.0); m_q.w() = MT_Scalar(1.0);
} else { }
else {
m_sinp = MT_Scalar(sin(.5 * m_theta)); m_sinp = MT_Scalar(sin(.5 * m_theta));
/* Taylor Series for sinc */ /* Taylor Series for sinc */
@ -246,7 +244,7 @@ angleUpdated(
m_q.x() = temp.x(); m_q.x() = temp.x();
m_q.y() = temp.y(); m_q.y() = temp.y();
m_q.z() = temp.z(); m_q.z() = temp.z();
m_q.w() = MT_Scalar(cos(.5*m_theta)); m_q.w() = MT_Scalar(cos(0.5 * m_theta));
} }
} }

@ -106,7 +106,7 @@ int _EatSpace( std::istream& is,int* countp=NULL) {
// Eats whites, returns, tabs and the delim character // Eats whites, returns, tabs and the delim character
// Checks wether delim char. is encountered. // Checks whether delim char. is encountered.
void Eat( std::istream& is, int delim ) void Eat( std::istream& is, int delim )
{ {
int ch; int ch;
@ -119,7 +119,7 @@ void Eat( std::istream& is, int delim )
} }
// Eats whites, returns, tabs and the delim character // Eats whites, returns, tabs and the delim character
// Checks wether delim char. is encountered. // Checks whether delim char. is encountered.
// EatEnd does not eat all space-like char's at the end. // EatEnd does not eat all space-like char's at the end.
void EatEnd( std::istream& is, int delim ) void EatEnd( std::istream& is, int delim )
{ {

@ -130,7 +130,7 @@ protected :
/** /**
* Protected constructors * Protected constructors
* This class is not for direct instanciation. Sub classes * This class is not for direct instantiation. Sub classes
* should only be allocated on the heap. * should only be allocated on the heap.
*/ */

@ -37,6 +37,15 @@
#endif #endif
// this is needed for inlining behavior
#if defined _WIN32
# define DO_INLINE __inline
#elif defined (__sun) || defined (__sun__)
# define DO_INLINE
#else
# define DO_INLINE static inline
#endif
/* /*
* Sort all the edges of the input polygon by Y, then by X, of the "first" vertex encountered. * Sort all the edges of the input polygon by Y, then by X, of the "first" vertex encountered.
@ -814,14 +823,14 @@ int get_range_expanded_pixel_coord(float normalized_value, int max_value) {
return (int)((normalized_value * (float)(max_value)) + 0.5f); return (int)((normalized_value * (float)(max_value)) + 0.5f);
} }
__inline float get_pixel_intensity(float *buf, int buf_x, int buf_y, int pos_x, int pos_y) { DO_INLINE float get_pixel_intensity(float *buf, int buf_x, int buf_y, int pos_x, int pos_y) {
if(pos_x < 0 || pos_x >= buf_x || pos_y < 0 || pos_y >= buf_y) { if(pos_x < 0 || pos_x >= buf_x || pos_y < 0 || pos_y >= buf_y) {
return 0.0f; return 0.0f;
} }
return buf[(pos_y * buf_x) + pos_x]; return buf[(pos_y * buf_x) + pos_x];
} }
__inline float get_pixel_intensity_bilinear(float *buf, int buf_x, int buf_y, float u, float v) { DO_INLINE float get_pixel_intensity_bilinear(float *buf, int buf_x, int buf_y, float u, float v) {
int a; int a;
int b; int b;
int a_plus_1; int a_plus_1;
@ -847,7 +856,7 @@ __inline float get_pixel_intensity_bilinear(float *buf, int buf_x, int buf_y, fl
} }
__inline void set_pixel_intensity(float *buf, int buf_x, int buf_y, int pos_x, int pos_y, float intensity) { DO_INLINE void set_pixel_intensity(float *buf, int buf_x, int buf_y, int pos_x, int pos_y, float intensity) {
if(pos_x < 0 || pos_x >= buf_x || pos_y < 0 || pos_y >= buf_y) { if(pos_x < 0 || pos_x >= buf_x || pos_y < 0 || pos_y >= buf_y) {
return; return;
} }

@ -270,7 +270,6 @@ def dump_messages_rna(messages, check_ctxt):
walk_keymap_hierarchy(KM_HIERARCHY, "KM_HIERARCHY") walk_keymap_hierarchy(KM_HIERARCHY, "KM_HIERARCHY")
def dump_messages_pytext(messages, check_ctxt): def dump_messages_pytext(messages, check_ctxt):
""" dumps text inlined in the python user interface: eg. """ dumps text inlined in the python user interface: eg.

@ -94,7 +94,6 @@ def main():
help="Restrict processed languages to those.") help="Restrict processed languages to those.")
args = parser.parse_args() args = parser.parse_args()
if args.pot: if args.pot:
global FILE_NAME_POT global FILE_NAME_POT
FILE_NAME_POT = args.pot FILE_NAME_POT = args.pot
@ -152,15 +151,15 @@ def main():
_ctx_txt = "s are" _ctx_txt = "s are"
else: else:
_ctx_txt = " is" _ctx_txt = " is"
print("\nAverage stats for all {:.0f} processed files:\n" \ print("\nAverage stats for all {:.0f} processed files:\n"
" {:>6.1%} done!\n" \ " {:>6.1%} done!\n"
" {:>6.1%} of messages are tooltips.\n" \ " {:>6.1%} of messages are tooltips.\n"
" {:>6.1%} of tooltips are translated.\n" \ " {:>6.1%} of tooltips are translated.\n"
" {:>6.1%} of translated messages are tooltips.\n" \ " {:>6.1%} of translated messages are tooltips.\n"
" {:>6.1%} of messages are commented.\n" \ " {:>6.1%} of messages are commented.\n"
" The org msgids are currently made of {} signs.\n" \ " The org msgids are currently made of {} signs.\n"
" All processed translations are currently made of {} signs.\n" \ " All processed translations are currently made of {} signs.\n"
" {} specific context{} present:\n {}\n" \ " {} specific context{} present:\n {}\n"
"".format(glob_stats["nbr"], glob_stats["lvl"] / glob_stats["nbr"], "".format(glob_stats["nbr"], glob_stats["lvl"] / glob_stats["nbr"],
glob_stats["lvl_ttips"] / glob_stats["nbr"], glob_stats["lvl_ttips"] / glob_stats["nbr"],
glob_stats["lvl_trans_ttips"]/glob_stats["nbr"], glob_stats["lvl_trans_ttips"]/glob_stats["nbr"],

@ -65,7 +65,6 @@ def main():
help="Restrict processed languages to those.") help="Restrict processed languages to those.")
args = parser.parse_args() args = parser.parse_args()
ret = 0 ret = 0
if args.langs: if args.langs:

@ -56,7 +56,6 @@ def main():
help="Restrict processed languages to those.") help="Restrict processed languages to those.")
args = parser.parse_args() args = parser.parse_args()
ret = 0 ret = 0
threshold = float(settings.IMPORT_MIN_LEVEL) / 100.0 threshold = float(settings.IMPORT_MIN_LEVEL) / 100.0

@ -59,7 +59,6 @@ def main():
help="The po's to merge into the dst.po one.") help="The po's to merge into the dst.po one.")
args = parser.parse_args() args = parser.parse_args()
ret = 0 ret = 0
done_msgkeys = set() done_msgkeys = set()
done_fuzzy_msgkeys = set() done_fuzzy_msgkeys = set()

@ -86,6 +86,7 @@ FRIBIDI_FLAGS_DEFAULT = FRIBIDI_FLAG_SHAPE_MIRRORING | \
FRIBIDI_FLAGS_ARABIC = FRIBIDI_FLAG_SHAPE_ARAB_PRES | \ FRIBIDI_FLAGS_ARABIC = FRIBIDI_FLAG_SHAPE_ARAB_PRES | \
FRIBIDI_FLAG_SHAPE_ARAB_LIGA FRIBIDI_FLAG_SHAPE_ARAB_LIGA
##### Kernel processing funcs. ##### ##### Kernel processing funcs. #####
def protect_format_seq(msg): def protect_format_seq(msg):
""" """
@ -185,6 +186,7 @@ def log2vis(msgs):
yield fbc_str.value yield fbc_str.value
##### Command line stuff. ##### ##### Command line stuff. #####
def main(): def main():
import argparse import argparse
@ -208,7 +210,6 @@ def main():
help="The po's to pre-process messages.") help="The po's to pre-process messages.")
args = parser.parse_args() args = parser.parse_args()
msgs, state, u1 = utils.parse_messages(args.src) msgs, state, u1 = utils.parse_messages(args.src)
if state["is_broken"]: if state["is_broken"]:
print("Source po is BROKEN, aborting.") print("Source po is BROKEN, aborting.")

@ -376,7 +376,7 @@ dict_uimsgs = {
"chebychev", "chebychev",
"kutta", "kutta",
"lennard", "lennard",
"minkowsky", "minkowski",
"minnaert", "minnaert",
"musgrave", "musgrave",
"nayar", "nayar",

@ -38,6 +38,7 @@ except:
PY3 = settings.PYTHON3_EXEC PY3 = settings.PYTHON3_EXEC
def main(): def main():
import argparse import argparse
parser = argparse.ArgumentParser(description="" \ parser = argparse.ArgumentParser(description="" \
@ -59,7 +60,6 @@ def main():
help="Restrict processed languages to those.") help="Restrict processed languages to those.")
args = parser.parse_args() args = parser.parse_args()
ret = 0 ret = 0
# Generate a temp messages file. # Generate a temp messages file.

@ -74,6 +74,7 @@ pygettexts = tuple(re.compile(r).search
_clean_str = re.compile(settings.str_clean_re).finditer _clean_str = re.compile(settings.str_clean_re).finditer
clean_str = lambda s: "".join(m.group("clean") for m in _clean_str(s)) clean_str = lambda s: "".join(m.group("clean") for m in _clean_str(s))
def check_file(path, rel_path, messages): def check_file(path, rel_path, messages):
with open(path, encoding="utf-8") as f: with open(path, encoding="utf-8") as f:
f = f.read() f = f.read()
@ -149,6 +150,8 @@ from spell_check_utils import (dict_uimsgs,
) )
_spell_checked = set() _spell_checked = set()
def spell_check(txt, cache): def spell_check(txt, cache):
ret = [] ret = []
@ -194,6 +197,8 @@ def gen_empty_pot():
escape_re = tuple(re.compile(r[0]) for r in settings.ESCAPE_RE) escape_re = tuple(re.compile(r[0]) for r in settings.ESCAPE_RE)
escape = lambda s, n: escape_re[n].sub(settings.ESCAPE_RE[n][1], s) escape = lambda s, n: escape_re[n].sub(settings.ESCAPE_RE[n][1], s)
def merge_messages(msgs, states, messages, do_checks, spell_cache): def merge_messages(msgs, states, messages, do_checks, spell_cache):
num_added = num_present = 0 num_added = num_present = 0
for (context, msgid), srcs in messages.items(): for (context, msgid), srcs in messages.items():

@ -65,7 +65,6 @@ def main():
help="Restrict processed languages to those.") help="Restrict processed languages to those.")
args = parser.parse_args() args = parser.parse_args()
ret = 0 ret = 0
failed = set() failed = set()

@ -40,6 +40,7 @@ def stripeol(s):
def is_tooltip(msgid): def is_tooltip(msgid):
return len(msgid) > 30 return len(msgid) > 30
def parse_messages(fname): def parse_messages(fname):
""" """
Returns a tupple (messages, states, stats). Returns a tupple (messages, states, stats).
@ -82,7 +83,6 @@ def parse_messages(fname):
fuzzy_messages = set() fuzzy_messages = set()
commented_messages = set() commented_messages = set()
def clean_vars(): def clean_vars():
nonlocal reading_msgid, reading_msgstr, reading_msgctxt, \ nonlocal reading_msgid, reading_msgstr, reading_msgctxt, \
reading_comment, is_fuzzy, is_translated, is_commented, \ reading_comment, is_fuzzy, is_translated, is_commented, \
@ -143,7 +143,6 @@ def parse_messages(fname):
clean_vars() clean_vars()
with open(fname, 'r', encoding="utf-8") as f: with open(fname, 'r', encoding="utf-8") as f:
for line_nr, line in enumerate(f): for line_nr, line in enumerate(f):
line = stripeol(line) line = stripeol(line)
@ -373,4 +372,3 @@ def print_stats(stats, glob_stats=None, prefix=""):
"".format(nbr_trans_signs)) "".format(nbr_trans_signs))
print(prefix.join(lines)) print(prefix.join(lines))
return 0 return 0

@ -34,13 +34,14 @@ __all__ = (
"register_class", "register_class",
"register_module", "register_module",
"resource_path", "resource_path",
"script_path_user",
"script_path_pref",
"script_paths", "script_paths",
"smpte_from_frame", "smpte_from_frame",
"smpte_from_seconds", "smpte_from_seconds",
"unregister_class", "unregister_class",
"unregister_module", "unregister_module",
"user_resource", "user_resource",
"user_script_path",
) )
from _bpy import register_class, unregister_class, blend_paths, resource_path from _bpy import register_class, unregister_class, blend_paths, resource_path
@ -252,15 +253,16 @@ _scripts = _os.path.join(_os.path.dirname(__file__),
_scripts = (_os.path.normpath(_scripts), ) _scripts = (_os.path.normpath(_scripts), )
def user_script_path(): def script_path_user():
# returns the env var and falls back to userprefs """returns the env var and falls back to home dir or None"""
path = _user_resource('SCRIPTS') path = _user_resource('SCRIPTS')
return _os.path.normpath(path) if path else None
if path:
path = _os.path.normpath(path) def script_path_pref():
return path """returns the user preference or None"""
else: path = _bpy.context.user_preferences.filepaths.script_directory
return None return _os.path.normpath(path) if path else None
def script_paths(subdir=None, user_pref=True, check_all=False): def script_paths(subdir=None, user_pref=True, check_all=False):
@ -278,10 +280,6 @@ def script_paths(subdir=None, user_pref=True, check_all=False):
:rtype: list :rtype: list
""" """
scripts = list(_scripts) scripts = list(_scripts)
prefs = _bpy.context.user_preferences
# add user scripts dir
user_script = user_script_path()
if check_all: if check_all:
# all possible paths # all possible paths
@ -291,7 +289,7 @@ def script_paths(subdir=None, user_pref=True, check_all=False):
# only paths blender uses # only paths blender uses
base_paths = _bpy_script_paths() base_paths = _bpy_script_paths()
for path in base_paths + (user_script, ): for path in base_paths + (script_path_user(), script_path_pref()):
if path: if path:
path = _os.path.normpath(path) path = _os.path.normpath(path)
if path not in scripts and _os.path.isdir(path): if path not in scripts and _os.path.isdir(path):

@ -308,7 +308,8 @@ def banner(context):
'OUTPUT') 'OUTPUT')
add_scrollback("Convenience Imports: from mathutils import *; " add_scrollback("Convenience Imports: from mathutils import *; "
"from math import *", 'OUTPUT') "from math import *", 'OUTPUT')
add_scrollback("Convenience Variables: C = bpy.context, D = bpy.data", 'OUTPUT') add_scrollback("Convenience Variables: C = bpy.context, D = bpy.data",
'OUTPUT')
add_scrollback("", 'OUTPUT') add_scrollback("", 'OUTPUT')
sc.prompt = PROMPT sc.prompt = PROMPT

@ -87,7 +87,8 @@ def write_sysinfo(op):
output.write("\nDirectories:\n") output.write("\nDirectories:\n")
output.write(lilies) output.write(lilies)
output.write("scripts: %r\n" % (bpy.utils.script_paths())) output.write("scripts: %r\n" % (bpy.utils.script_paths()))
output.write("user scripts: %r\n" % (bpy.utils.user_script_path())) output.write("user scripts: %r\n" % (bpy.utils.script_path_user()))
output.write("pref scripts: %r\n" % (bpy.utils.script_path_pref()))
output.write("datafiles: %r\n" % (bpy.utils.user_resource('DATAFILES'))) output.write("datafiles: %r\n" % (bpy.utils.user_resource('DATAFILES')))
output.write("config: %r\n" % (bpy.utils.user_resource('CONFIG'))) output.write("config: %r\n" % (bpy.utils.user_resource('CONFIG')))
output.write("scripts : %r\n" % (bpy.utils.user_resource('SCRIPTS'))) output.write("scripts : %r\n" % (bpy.utils.user_resource('SCRIPTS')))

@ -101,7 +101,6 @@ def operator_value_is_undo(value):
return (isinstance(id_data, bpy.types.ID) and return (isinstance(id_data, bpy.types.ID) and
(not isinstance(id_data, (bpy.types.WindowManager, (not isinstance(id_data, (bpy.types.WindowManager,
bpy.types.Screen, bpy.types.Screen,
bpy.types.Scene,
bpy.types.Brush, bpy.types.Brush,
)))) ))))

@ -38,6 +38,7 @@ _modules = (
"properties_data_modifier", "properties_data_modifier",
"properties_data_speaker", "properties_data_speaker",
"properties_game", "properties_game",
"properties_mask_common",
"properties_material", "properties_material",
"properties_object_constraint", "properties_object_constraint",
"properties_object", "properties_object",

@ -323,6 +323,7 @@ class DATA_PT_onion_skinning(OnionSkinButtonsPanel): # , Panel): # inherit from
def draw(self, context): def draw(self, context):
ob = context.object ob = context.object
self.draw_settings(context, ob.pose.animation_visualization, bones=True) self.draw_settings(context, ob.pose.animation_visualization, bones=True)

@ -148,7 +148,7 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, Panel):
col = row.column(align=True) col = row.column(align=True)
col.operator("object.vertex_group_add", icon='ZOOMIN', text="") col.operator("object.vertex_group_add", icon='ZOOMIN', text="")
col.operator("object.vertex_group_remove", icon='ZOOMOUT', text="") col.operator("object.vertex_group_remove", icon='ZOOMOUT', text="").all = False
col.menu("MESH_MT_vertex_group_specials", icon='DOWNARROW_HLT', text="") col.menu("MESH_MT_vertex_group_specials", icon='DOWNARROW_HLT', text="")
if group: if group:
col.separator() col.separator()

@ -105,14 +105,13 @@ class DATA_PT_cone(DataButtonsPanel, Panel):
speaker = context.speaker speaker = context.speaker
split = layout.split() split = layout.split()
col = split.column()
col = split.column()
col.label("Angle:") col.label("Angle:")
col.prop(speaker, "cone_angle_outer", text="Outer") col.prop(speaker, "cone_angle_outer", text="Outer")
col.prop(speaker, "cone_angle_inner", text="Inner") col.prop(speaker, "cone_angle_inner", text="Inner")
col = split.column() col = split.column()
col.label("Volume:") col.label("Volume:")
col.prop(speaker, "cone_volume_outer", text="Outer") col.prop(speaker, "cone_volume_outer", text="Outer")

@ -337,7 +337,6 @@ class RENDER_PT_game_stereo(RenderButtonsPanel, Panel):
if dome_type in {'FISHEYE', 'TRUNCATED_REAR', 'TRUNCATED_FRONT'}: if dome_type in {'FISHEYE', 'TRUNCATED_REAR', 'TRUNCATED_FRONT'}:
col = split.column() col = split.column()
col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True) col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
col.prop(gs, "dome_angle", slider=True) col.prop(gs, "dome_angle", slider=True)
@ -347,14 +346,13 @@ class RENDER_PT_game_stereo(RenderButtonsPanel, Panel):
elif dome_type == 'PANORAM_SPH': elif dome_type == 'PANORAM_SPH':
col = split.column() col = split.column()
col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True) col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
col = split.column() col = split.column()
col.prop(gs, "dome_tessellation", text="Tessellation") col.prop(gs, "dome_tessellation", text="Tessellation")
else: # cube map else: # cube map
col = split.column() col = split.column()
col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True) col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
col = split.column() col = split.column()
@ -396,6 +394,7 @@ class RENDER_PT_game_system(RenderButtonsPanel, Panel):
layout = self.layout layout = self.layout
gs = context.scene.game_settings gs = context.scene.game_settings
row = layout.row() row = layout.row()
row.prop(gs, "use_frame_rate") row.prop(gs, "use_frame_rate")
row.prop(gs, "restrict_animation_updates") row.prop(gs, "restrict_animation_updates")
@ -415,10 +414,10 @@ class RENDER_PT_game_display(RenderButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
row = layout.row()
row.prop(context.scene.render, "fps", text="Animation Frame Rate", slider=False)
gs = context.scene.game_settings gs = context.scene.game_settings
layout.prop(context.scene.render, "fps", text="Animation Frame Rate", slider=False)
flow = layout.column_flow() flow = layout.column_flow()
flow.prop(gs, "show_debug_properties", text="Debug Properties") flow.prop(gs, "show_debug_properties", text="Debug Properties")
flow.prop(gs, "show_framerate_profile", text="Framerate and Profile") flow.prop(gs, "show_framerate_profile", text="Framerate and Profile")
@ -582,14 +581,14 @@ class WORLD_PT_game_mist(WorldButtonsPanel, Panel):
world = context.world world = context.world
layout.active = world.mist_settings.use_mist layout.active = world.mist_settings.use_mist
row = layout.row()
row.prop(world.mist_settings, "falloff") layout.prop(world.mist_settings, "falloff")
row = layout.row(align=True) row = layout.row(align=True)
row.prop(world.mist_settings, "start") row.prop(world.mist_settings, "start")
row.prop(world.mist_settings, "depth") row.prop(world.mist_settings, "depth")
row = layout.row()
row.prop(world.mist_settings, "intensity", text="Minimum Intensity") layout.prop(world.mist_settings, "intensity", text="Minimum Intensity")
class WORLD_PT_game_physics(WorldButtonsPanel, Panel): class WORLD_PT_game_physics(WorldButtonsPanel, Panel):

@ -0,0 +1,317 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8-80 compliant>
# panels get subclassed (not registered directly)
# menus are referenced `as is`
import bpy
from bpy.types import Menu
class MASK_PT_mask:
# subclasses must define...
#~ bl_space_type = 'CLIP_EDITOR'
#~ bl_region_type = 'UI'
bl_label = "Mask Settings"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
space_data = context.space_data
return space_data.mask and space_data.mode == 'MASK'
def draw(self, context):
layout = self.layout
sc = context.space_data
mask = sc.mask
col = layout.column(align=True)
col.prop(mask, "frame_start")
col.prop(mask, "frame_end")
class MASK_PT_layers:
# subclasses must define...
#~ bl_space_type = 'CLIP_EDITOR'
#~ bl_region_type = 'UI'
bl_label = "Mask Layers"
@classmethod
def poll(cls, context):
space_data = context.space_data
return space_data.mask and space_data.mode == 'MASK'
def draw(self, context):
layout = self.layout
sc = context.space_data
mask = sc.mask
active_layer = mask.layers.active
rows = 5 if active_layer else 2
row = layout.row()
row.template_list(mask, "layers",
mask, "active_layer_index", rows=rows)
sub = row.column(align=True)
sub.operator("mask.layer_new", icon='ZOOMIN', text="")
sub.operator("mask.layer_remove", icon='ZOOMOUT', text="")
if active_layer:
sub.separator()
props = sub.operator("mask.layer_move", icon='TRIA_UP', text="")
props.direction = 'UP'
props = sub.operator("mask.layer_move", icon='TRIA_DOWN', text="")
props.direction = 'DOWN'
layout.prop(active_layer, "name")
# blending
row = layout.row(align=True)
row.prop(active_layer, "alpha")
row.prop(active_layer, "invert", text="", icon='IMAGE_ALPHA')
layout.prop(active_layer, "blend")
layout.prop(active_layer, "falloff")
class MASK_PT_spline():
# subclasses must define...
#~ bl_space_type = 'CLIP_EDITOR'
#~ bl_region_type = 'UI'
bl_label = "Active Spline"
@classmethod
def poll(cls, context):
sc = context.space_data
mask = sc.mask
if mask and sc.mode == 'MASK':
return mask.layers.active and mask.layers.active.splines.active
return False
def draw(self, context):
layout = self.layout
sc = context.space_data
mask = sc.mask
spline = mask.layers.active.splines.active
col = layout.column()
col.prop(spline, "weight_interpolation")
row = col.row()
row.prop(spline, "use_cyclic")
row.prop(spline, "use_fill")
class MASK_PT_point():
# subclasses must define...
#~ bl_space_type = 'CLIP_EDITOR'
#~ bl_region_type = 'UI'
bl_label = "Active Point"
@classmethod
def poll(cls, context):
sc = context.space_data
mask = sc.mask
if mask and sc.mode == 'MASK':
mask_layer_active = mask.layers.active
return (mask_layer_active and
mask_layer_active.splines.active_point)
return False
def draw(self, context):
layout = self.layout
sc = context.space_data
mask = sc.mask
point = mask.layers.active.splines.active_point
parent = point.parent
col = layout.column()
col.prop(point, "handle_type")
col = layout.column()
# Currently only parenting yo movie clip is allowed, so do not
# ver-oplicate things for now and use single template_ID
#col.template_any_ID(parent, "id", "id_type", text="")
col.label("Parent:")
col.prop(parent, "id", text="")
if parent.id_type == 'MOVIECLIP' and parent.id:
clip = parent.id
tracking = clip.tracking
col.prop_search(parent, "parent", tracking,
"objects", icon='OBJECT_DATA', text="Object:")
if parent.parent in tracking.objects:
object = tracking.objects[parent.parent]
col.prop_search(parent, "sub_parent", object,
"tracks", icon='ANIM_DATA', text="Track:")
else:
col.prop_search(parent, "sub_parent", tracking,
"tracks", icon='ANIM_DATA', text="Track:")
class MASK_PT_display():
# subclasses must define...
#~ bl_space_type = 'CLIP_EDITOR'
#~ bl_region_type = 'UI'
bl_label = "Mask Display"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
space_data = context.space_data
return space_data.mask and space_data.mode == 'MASK'
def draw(self, context):
layout = self.layout
space_data = context.space_data
layout.prop(space_data, "mask_draw_type", text="")
layout.prop(space_data, "show_mask_smooth")
class MASK_PT_tools():
# subclasses must define...
#~ bl_space_type = 'CLIP_EDITOR'
#~ bl_region_type = 'TOOLS'
bl_label = "Mask Tools"
@classmethod
def poll(cls, context):
space_data = context.space_data
return space_data.mask and space_data.mode == 'MASK'
def draw(self, context):
layout = self.layout
col = layout.column(align=True)
col.label(text="Transform:")
col.operator("transform.translate")
col.operator("transform.rotate")
col.operator("transform.resize", text="Scale")
props = col.operator("transform.transform", text="Shrink/Fatten")
props.mode = 'MASK_SHRINKFATTEN'
col = layout.column(align=True)
col.label(text="Spline:")
col.operator("mask.delete")
col.operator("mask.cyclic_toggle")
col.operator("mask.switch_direction")
col = layout.column(align=True)
col.label(text="Parenting:")
col.operator("mask.parent_set")
col.operator("mask.parent_clear")
class MASK_MT_mask(Menu):
bl_label = "Mask"
def draw(self, context):
layout = self.layout
layout.operator("mask.delete")
layout.separator()
layout.operator("mask.cyclic_toggle")
layout.operator("mask.switch_direction")
layout.operator("mask.normals_make_consistent")
layout.operator("mask.feather_weight_clear") # TODO, better place?
layout.separator()
layout.operator("mask.parent_clear")
layout.operator("mask.parent_set")
layout.separator()
layout.menu("MASK_MT_visibility")
layout.menu("MASK_MT_transform")
layout.menu("MASK_MT_animation")
class MASK_MT_visibility(Menu):
bl_label = "Show/Hide"
def draw(self, context):
layout = self.layout
layout.operator("mask.hide_view_clear", text="Show Hidden")
layout.operator("mask.hide_view_set", text="Hide Selected")
props = layout.operator("mask.hide_view_set", text="Hide Unselected")
props.unselected = True
class MASK_MT_transform(Menu):
bl_label = "Transform"
def draw(self, context):
layout = self.layout
layout.operator("transform.translate")
layout.operator("transform.rotate")
layout.operator("transform.resize")
props = layout.operator("transform.transform", text="Shrink/Fatten")
props.mode = 'MASK_SHRINKFATTEN'
class MASK_MT_animation(Menu):
bl_label = "Animation"
def draw(self, context):
layout = self.layout
layout.operator("mask.shape_key_clear")
layout.operator("mask.shape_key_insert")
layout.operator("mask.shape_key_feather_reset")
layout.operator("mask.shape_key_rekey")
class MASK_MT_select(Menu):
bl_label = "Select"
def draw(self, context):
layout = self.layout
sc = context.space_data
layout.operator("mask.select_border")
layout.operator("mask.select_circle")
layout.separator()
layout.operator("mask.select_all").action = 'TOGGLE'
layout.operator("mask.select_all", text="Inverse").action = 'INVERT'
if __name__ == "__main__": # only for live edit.
bpy.utils.register_module(__name__)

@ -350,7 +350,6 @@ class MATERIAL_PT_shading(MaterialButtonsPanel, Panel):
class MATERIAL_PT_transp(MaterialButtonsPanel, Panel): class MATERIAL_PT_transp(MaterialButtonsPanel, Panel):
bl_label = "Transparency" bl_label = "Transparency"
# bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'} COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod @classmethod

@ -259,7 +259,6 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, Panel):
layout.prop(ob, "use_dupli_vertices_rotation", text="Rotation") layout.prop(ob, "use_dupli_vertices_rotation", text="Rotation")
elif ob.dupli_type == 'FACES': elif ob.dupli_type == 'FACES':
row = layout.row() row = layout.row()
row.prop(ob, "use_dupli_faces_scale", text="Scale") row.prop(ob, "use_dupli_faces_scale", text="Scale")
row.prop(ob, "dupli_faces_scale", text="Inherit Scale") row.prop(ob, "dupli_faces_scale", text="Inherit Scale")

@ -186,11 +186,8 @@ def effector_weights_ui(self, context, weights):
split = layout.split() split = layout.split()
col = split.column() split.prop(weights, "gravity", slider=True)
col.prop(weights, "gravity", slider=True) split.prop(weights, "all", slider=True)
col = split.column()
col.prop(weights, "all", slider=True)
layout.separator() layout.separator()

@ -168,7 +168,6 @@ class PHYSICS_PT_field(PhysicButtonsPanel, Panel):
class PHYSICS_PT_collision(PhysicButtonsPanel, Panel): class PHYSICS_PT_collision(PhysicButtonsPanel, Panel):
bl_label = "Collision" bl_label = "Collision"
#bl_options = {'DEFAULT_CLOSED'}
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):

@ -39,6 +39,7 @@ class SCENE_PT_scene(SceneButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
scene = context.scene scene = context.scene
layout.prop(scene, "camera") layout.prop(scene, "camera")
@ -52,6 +53,7 @@ class SCENE_PT_audio(SceneButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
scene = context.scene scene = context.scene
rd = context.scene.render rd = context.scene.render
ffmpeg = rd.ffmpeg ffmpeg = rd.ffmpeg
@ -81,6 +83,7 @@ class SCENE_PT_unit(SceneButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
unit = context.scene.unit_settings unit = context.scene.unit_settings
col = layout.column() col = layout.column()

@ -116,6 +116,7 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
slot = getattr(context, "texture_slot", None) slot = getattr(context, "texture_slot", None)
node = getattr(context, "texture_node", None) node = getattr(context, "texture_node", None)
space = context.space_data space = context.space_data

@ -82,6 +82,7 @@ class WORLD_PT_world(WorldButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
world = context.world world = context.world
row = layout.row() row = layout.row()
@ -111,6 +112,7 @@ class WORLD_PT_ambient_occlusion(WorldButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
light = context.world.light_settings light = context.world.light_settings
layout.active = light.use_ambient_occlusion layout.active = light.use_ambient_occlusion
@ -130,6 +132,7 @@ class WORLD_PT_environment_lighting(WorldButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
light = context.world.light_settings light = context.world.light_settings
layout.active = light.use_environment_light layout.active = light.use_environment_light
@ -149,6 +152,7 @@ class WORLD_PT_indirect_lighting(WorldButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
light = context.world.light_settings light = context.world.light_settings
layout.active = light.use_indirect_light and light.gather_method == 'APPROXIMATE' layout.active = light.use_indirect_light and light.gather_method == 'APPROXIMATE'
@ -167,6 +171,7 @@ class WORLD_PT_gather(WorldButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
light = context.world.light_settings light = context.world.light_settings
layout.active = light.use_ambient_occlusion or light.use_environment_light or light.use_indirect_light layout.active = light.use_ambient_occlusion or light.use_environment_light or light.use_indirect_light
@ -221,6 +226,7 @@ class WORLD_PT_mist(WorldButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
world = context.world world = context.world
layout.active = world.mist_settings.use_mist layout.active = world.mist_settings.use_mist
@ -250,6 +256,7 @@ class WORLD_PT_stars(WorldButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
world = context.world world = context.world
layout.active = world.star_settings.use_stars layout.active = world.star_settings.use_stars

@ -115,11 +115,11 @@ class CLIP_HT_header(Header):
sub.menu("CLIP_MT_view") sub.menu("CLIP_MT_view")
if clip: if clip:
sub.menu("CLIP_MT_select") sub.menu("MASK_MT_select")
sub.menu("CLIP_MT_clip") sub.menu("CLIP_MT_clip") # XXX - remove?
sub.menu("CLIP_MT_mask") sub.menu("MASK_MT_mask")
else: else:
sub.menu("CLIP_MT_clip") sub.menu("CLIP_MT_clip") # XXX - remove?
row = layout.row() row = layout.row()
row.template_ID(sc, "clip", open="clip.open") row.template_ID(sc, "clip", open="clip.open")
@ -161,16 +161,6 @@ class CLIP_PT_clip_view_panel:
return clip and sc.view == 'CLIP' return clip and sc.view == 'CLIP'
class CLIP_PT_mask_view_panel:
@classmethod
def poll(cls, context):
sc = context.space_data
clip = sc.clip
return clip and sc.view == 'CLIP' and sc.mode == 'MASKEDIT'
class CLIP_PT_tracking_panel: class CLIP_PT_tracking_panel:
@classmethod @classmethod
@ -197,10 +187,11 @@ class CLIP_PT_tools_marker(CLIP_PT_tracking_panel, Panel):
bl_label = "Marker" bl_label = "Marker"
def draw(self, context): def draw(self, context):
layout = self.layout
sc = context.space_data sc = context.space_data
clip = sc.clip clip = sc.clip
settings = clip.tracking.settings settings = clip.tracking.settings
layout = self.layout
col = layout.column(align=True) col = layout.column(align=True)
col.operator("clip.add_marker_move") col.operator("clip.add_marker_move")
@ -302,6 +293,7 @@ class CLIP_PT_tools_solve(CLIP_PT_tracking_panel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
clip = context.space_data.clip clip = context.space_data.clip
tracking = clip.tracking tracking = clip.tracking
settings = tracking.settings settings = tracking.settings
@ -422,34 +414,6 @@ class CLIP_PT_tools_object(CLIP_PT_reconstruction_panel, Panel):
col.prop(settings, "object_distance") col.prop(settings, "object_distance")
class CLIP_PT_tools_mask(CLIP_PT_mask_view_panel, Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'TOOLS'
bl_label = "Mask Tools"
def draw(self, context):
layout = self.layout
col = layout.column(align=True)
col.label(text="Transform:")
col.operator("transform.translate")
col.operator("transform.rotate")
col.operator("transform.resize", text="Scale")
props = col.operator("transform.transform", text="Shrink/Fatten")
props.mode = 'MASK_SHRINKFATTEN'
col = layout.column(align=True)
col.label(text="Spline:")
col.operator("mask.delete")
col.operator("mask.cyclic_toggle")
col.operator("mask.switch_direction")
col = layout.column(align=True)
col.label(text="Parenting:")
col.operator("mask.parent_set")
col.operator("mask.parent_clear")
class CLIP_PT_tools_grease_pencil(Panel): class CLIP_PT_tools_grease_pencil(Panel):
bl_space_type = 'CLIP_EDITOR' bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'TOOLS' bl_region_type = 'TOOLS'
@ -465,7 +429,7 @@ class CLIP_PT_tools_grease_pencil(Panel):
if sc.mode == 'DISTORTION': if sc.mode == 'DISTORTION':
return sc.view == 'CLIP' return sc.view == 'CLIP'
elif sc.mode == 'MASKEDIT': elif sc.mode == 'MASK':
return True return True
return False return False
@ -520,6 +484,7 @@ class CLIP_PT_track(CLIP_PT_tracking_panel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
sc = context.space_data sc = context.space_data
clip = context.space_data.clip clip = context.space_data.clip
act_track = clip.tracking.tracks.active act_track = clip.tracking.tracks.active
@ -586,6 +551,7 @@ class CLIP_PT_track_settings(CLIP_PT_tracking_panel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
clip = context.space_data.clip clip = context.space_data.clip
settings = clip.tracking.settings settings = clip.tracking.settings
@ -661,136 +627,6 @@ class CLIP_PT_tracking_camera(Panel):
col.prop(clip.tracking.camera, "k3") col.prop(clip.tracking.camera, "k3")
class CLIP_PT_mask_layers(Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'UI'
bl_label = "Mask Layers"
@classmethod
def poll(cls, context):
sc = context.space_data
return sc.mask and sc.mode == 'MASKEDIT'
def draw(self, context):
layout = self.layout
sc = context.space_data
mask = sc.mask
active_layer = mask.layers.active
rows = 5 if active_layer else 2
row = layout.row()
row.template_list(mask, "layers",
mask, "active_layer_index", rows=rows)
sub = row.column(align=True)
sub.operator("mask.layer_new", icon='ZOOMIN', text="")
sub.operator("mask.layer_remove", icon='ZOOMOUT', text="")
if active_layer:
sub.separator()
props = sub.operator("mask.layer_move", icon='TRIA_UP', text="")
props.direction = 'UP'
props = sub.operator("mask.layer_move", icon='TRIA_DOWN', text="")
props.direction = 'DOWN'
layout.prop(active_layer, "name")
# blending
row = layout.row(align=True)
row.prop(active_layer, "alpha")
row.prop(active_layer, "invert", text="", icon='IMAGE_ALPHA')
layout.prop(active_layer, "blend")
layout.prop(active_layer, "falloff")
class CLIP_PT_active_mask_spline(Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'UI'
bl_label = "Active Spline"
@classmethod
def poll(cls, context):
sc = context.space_data
mask = sc.mask
if mask and sc.mode == 'MASKEDIT':
return mask.layers.active and mask.layers.active.splines.active
return False
def draw(self, context):
layout = self.layout
sc = context.space_data
mask = sc.mask
spline = mask.layers.active.splines.active
col = layout.column()
col.prop(spline, "weight_interpolation")
rowsub = col.row()
rowsub.prop(spline, "use_cyclic")
rowsub.prop(spline, "use_fill")
class CLIP_PT_active_mask_point(Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'UI'
bl_label = "Active Point"
@classmethod
def poll(cls, context):
sc = context.space_data
mask = sc.mask
if mask and sc.mode == 'MASKEDIT':
mask_layer_active = mask.layers.active
return (mask_layer_active and
mask_layer_active.splines.active_point)
return False
def draw(self, context):
layout = self.layout
sc = context.space_data
mask = sc.mask
point = mask.layers.active.splines.active_point
parent = point.parent
col = layout.column()
col.prop(point, "handle_type")
col = layout.column()
# Currently only parenting yo movie clip is allowed, so do not
# ver-oplicate things for now and use single template_ID
#col.template_any_ID(parent, "id", "id_type", text="")
col.label("Parent:")
col.prop(parent, "id", text="")
if parent.id_type == 'MOVIECLIP' and parent.id:
clip = parent.id
tracking = clip.tracking
col.prop_search(parent, "parent", tracking,
"objects", icon='OBJECT_DATA', text="Object:")
if parent.parent in tracking.objects:
object = tracking.objects[parent.parent]
col.prop_search(parent, "sub_parent", object,
"tracks", icon='ANIM_DATA', text="Track:")
else:
col.prop_search(parent, "sub_parent", tracking,
"tracks", icon='ANIM_DATA', text="Track:")
class CLIP_PT_display(CLIP_PT_clip_view_panel, Panel): class CLIP_PT_display(CLIP_PT_clip_view_panel, Panel):
bl_space_type = 'CLIP_EDITOR' bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'UI' bl_region_type = 'UI'
@ -835,29 +671,6 @@ class CLIP_PT_display(CLIP_PT_clip_view_panel, Panel):
row = col.row() row = col.row()
row.prop(clip, "display_aspect", text="") row.prop(clip, "display_aspect", text="")
if sc.mode == 'MASKEDIT':
col = layout.column()
col.prop(sc, "mask_draw_type", text="")
col.prop(sc, "show_mask_smooth")
# TODO, move into its own file
class CLIP_PT_mask(CLIP_PT_mask_view_panel, Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'UI'
bl_label = "Mask Settings"
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
sc = context.space_data
mask = sc.mask
col = layout.column(align=True)
col.prop(mask, "frame_start")
col.prop(mask, "frame_end")
class CLIP_PT_marker_display(CLIP_PT_clip_view_panel, Panel): class CLIP_PT_marker_display(CLIP_PT_clip_view_panel, Panel):
bl_space_type = 'CLIP_EDITOR' bl_space_type = 'CLIP_EDITOR'
@ -868,7 +681,7 @@ class CLIP_PT_marker_display(CLIP_PT_clip_view_panel, Panel):
def poll(cls, context): def poll(cls, context):
sc = context.space_data sc = context.space_data
return sc.mode != 'MASKEDIT' return sc.mode != 'MASK'
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@ -973,6 +786,7 @@ class CLIP_PT_proxy(CLIP_PT_clip_view_panel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
sc = context.space_data sc = context.space_data
clip = sc.clip clip = sc.clip
@ -1050,6 +864,7 @@ class CLIP_MT_view(Menu):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
sc = context.space_data sc = context.space_data
if sc.view == 'CLIP': if sc.view == 'CLIP':
@ -1213,19 +1028,7 @@ class CLIP_MT_select(Menu):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
sc = context.space_data
if sc.mode == 'MASKEDIT':
layout.operator("mask.select_border")
layout.operator("mask.select_circle")
layout.separator()
layout.operator("mask.select_all"
).action = 'TOGGLE'
layout.operator("mask.select_all",
text="Inverse").action = 'INVERT'
else:
layout.operator("clip.select_border") layout.operator("clip.select_border")
layout.operator("clip.select_circle") layout.operator("clip.select_circle")
@ -1280,30 +1083,6 @@ class CLIP_MT_tracking_specials(Menu):
props.action = 'UNLOCK' props.action = 'UNLOCK'
class CLIP_MT_mask(Menu):
bl_label = "Mask"
def draw(self, context):
layout = self.layout
layout.operator("mask.delete")
layout.separator()
layout.operator("mask.cyclic_toggle")
layout.operator("mask.switch_direction")
layout.operator("mask.normals_make_consistent")
layout.operator("mask.feather_weight_clear") # TODO, better place?
layout.separator()
layout.operator("mask.parent_clear")
layout.operator("mask.parent_set")
layout.separator()
layout.menu("CLIP_MT_mask_visibility")
layout.menu("CLIP_MT_mask_transform")
layout.menu("CLIP_MT_mask_animation")
class CLIP_MT_select_mode(Menu): class CLIP_MT_select_mode(Menu):
bl_label = "Select Mode" bl_label = "Select Mode"
@ -1315,44 +1094,6 @@ class CLIP_MT_select_mode(Menu):
layout.operator_enum("clip.mode_set", "mode") layout.operator_enum("clip.mode_set", "mode")
class CLIP_MT_mask_visibility(Menu):
bl_label = "Show/Hide"
def draw(self, context):
layout = self.layout
layout.operator("mask.hide_view_clear", text="Show Hidden")
layout.operator("mask.hide_view_set", text="Hide Selected")
props = layout.operator("mask.hide_view_set", text="Hide Unselected")
props.unselected = True
class CLIP_MT_mask_transform(Menu):
bl_label = "Transform"
def draw(self, context):
layout = self.layout
layout.operator("transform.translate")
layout.operator("transform.rotate")
layout.operator("transform.resize")
props = layout.operator("transform.transform", text="Shrink/Fatten")
props.mode = 'MASK_SHRINKFATTEN'
class CLIP_MT_mask_animation(Menu):
bl_label = "Animation"
def draw(self, context):
layout = self.layout
layout.operator("mask.shape_key_clear")
layout.operator("mask.shape_key_insert")
layout.operator("mask.shape_key_feather_reset")
layout.operator("mask.shape_key_rekey")
class CLIP_MT_camera_presets(Menu): class CLIP_MT_camera_presets(Menu):
"""Predefined tracking camera intrinsics""" """Predefined tracking camera intrinsics"""
bl_label = "Camera Presets" bl_label = "Camera Presets"
@ -1394,5 +1135,49 @@ class CLIP_MT_stabilize_2d_specials(Menu):
layout.operator("clip.stabilize_2d_select") layout.operator("clip.stabilize_2d_select")
# -----------------------------------------------------------------------------
# Mask (similar code in space_image.py, keep in sync)
from bl_ui.properties_mask_common import (MASK_PT_mask,
MASK_PT_layers,
MASK_PT_spline,
MASK_PT_point,
MASK_PT_display,
MASK_PT_tools)
class CLIP_PT_mask(MASK_PT_mask, Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'UI'
class CLIP_PT_mask_layers(MASK_PT_layers, Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'UI'
class CLIP_PT_mask_display(MASK_PT_display, Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'UI'
class CLIP_PT_active_mask_spline(MASK_PT_spline, Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'UI'
class CLIP_PT_active_mask_point(MASK_PT_point, Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'UI'
class CLIP_PT_tools_mask(MASK_PT_tools, Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'TOOLS'
# --- end mask ---
if __name__ == "__main__": # only for live edit. if __name__ == "__main__": # only for live edit.
bpy.utils.register_module(__name__) bpy.utils.register_module(__name__)

@ -27,7 +27,7 @@ class ImagePaintPanel(UnifiedPaintPanel):
bl_region_type = 'UI' bl_region_type = 'UI'
class BrushButtonsPanel(): class BrushButtonsPanel:
bl_space_type = 'IMAGE_EDITOR' bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'UI' bl_region_type = 'UI'
@ -153,10 +153,6 @@ class IMAGE_MT_image(Menu):
if ima.source in {'FILE', 'GENERATED'} and ima.type != 'OPEN_EXR_MULTILAYER': if ima.source in {'FILE', 'GENERATED'} and ima.type != 'OPEN_EXR_MULTILAYER':
layout.operator("image.pack", text="Pack As PNG").as_png = True layout.operator("image.pack", text="Pack As PNG").as_png = True
if not context.tool_settings.use_uv_sculpt:
layout.separator()
layout.prop(sima, "use_image_paint")
layout.separator() layout.separator()
@ -217,6 +213,7 @@ class IMAGE_MT_uvs_snap(Menu):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.operator_context = 'EXEC_REGION_WIN' layout.operator_context = 'EXEC_REGION_WIN'
layout.operator("uv.snap_selected", text="Selected to Pixels").target = 'PIXELS' layout.operator("uv.snap_selected", text="Selected to Pixels").target = 'PIXELS'
@ -234,6 +231,7 @@ class IMAGE_MT_uvs_mirror(Menu):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.operator_context = 'EXEC_REGION_WIN' layout.operator_context = 'EXEC_REGION_WIN'
layout.operator("transform.mirror", text="X Axis").constraint_axis[0] = True layout.operator("transform.mirror", text="X Axis").constraint_axis[0] = True
@ -353,10 +351,12 @@ class IMAGE_HT_header(Header):
ima = sima.image ima = sima.image
iuser = sima.image_user iuser = sima.image_user
toolsettings = context.tool_settings toolsettings = context.tool_settings
mode = sima.mode
show_render = sima.show_render show_render = sima.show_render
# show_paint = sima.show_paint # show_paint = sima.show_paint
show_uvedit = sima.show_uvedit show_uvedit = sima.show_uvedit
show_maskedit = sima.show_maskedit
row = layout.row(align=True) row = layout.row(align=True)
row.template_header() row.template_header()
@ -381,6 +381,8 @@ class IMAGE_HT_header(Header):
if not show_render: if not show_render:
layout.prop(sima, "use_image_pin", text="") layout.prop(sima, "use_image_pin", text="")
layout.prop(sima, "mode", text="")
# uv editing # uv editing
if show_uvedit: if show_uvedit:
uvedit = sima.uv_editor uvedit = sima.uv_editor
@ -406,13 +408,18 @@ class IMAGE_HT_header(Header):
mesh = context.edit_object.data mesh = context.edit_object.data
layout.prop_search(mesh.uv_textures, "active", mesh, "uv_textures", text="") layout.prop_search(mesh.uv_textures, "active", mesh, "uv_textures", text="")
if show_maskedit:
row = layout.row()
row.template_ID(sima, "mask", new="mask.new")
# reused for mask
uvedit = sima.uv_editor
layout.prop(uvedit, "pivot_point", text="", icon_only=True)
if ima: if ima:
# layers # layers
layout.template_image_layers(ima, iuser) layout.template_image_layers(ima, iuser)
# painting
layout.prop(sima, "use_image_paint", text="")
# draw options # draw options
row = layout.row(align=True) row = layout.row(align=True)
row.prop(sima, "draw_channels", text="", expand=True) row.prop(sima, "draw_channels", text="", expand=True)
@ -423,7 +430,7 @@ class IMAGE_HT_header(Header):
if ima.type == 'COMPOSITE' and ima.source in {'MOVIE', 'SEQUENCE'}: if ima.type == 'COMPOSITE' and ima.source in {'MOVIE', 'SEQUENCE'}:
row.operator("image.play_composite", icon='PLAY') row.operator("image.play_composite", icon='PLAY')
if show_uvedit or sima.use_image_paint: if show_uvedit or mode == 'PAINT':
layout.prop(sima, "use_realtime_update", text="", icon_only=True, icon='LOCKED') layout.prop(sima, "use_realtime_update", text="", icon_only=True, icon='LOCKED')
@ -834,20 +841,57 @@ class IMAGE_UV_sculpt(Panel, ImagePaintPanel):
self.prop_unified_strength(row, context, brush, "strength", slider=True, text="Strength") self.prop_unified_strength(row, context, brush, "strength", slider=True, text="Strength")
self.prop_unified_strength(row, context, brush, "use_pressure_strength") self.prop_unified_strength(row, context, brush, "use_pressure_strength")
split = layout.split() col = layout.column()
col = split.column()
col.prop(toolsettings, "uv_sculpt_lock_borders") col.prop(toolsettings, "uv_sculpt_lock_borders")
col.prop(toolsettings, "uv_sculpt_all_islands") col.prop(toolsettings, "uv_sculpt_all_islands")
split = layout.split()
col = split.column()
col.prop(toolsettings, "uv_sculpt_tool") col.prop(toolsettings, "uv_sculpt_tool")
if toolsettings.uv_sculpt_tool == 'RELAX': if toolsettings.uv_sculpt_tool == 'RELAX':
col.prop(toolsettings, "uv_relax_method") col.prop(toolsettings, "uv_relax_method")
# -----------------------------------------------------------------------------
# Mask (similar code in space_clip.py, keep in sync)
# note! - panel placement does _not_ fit well with image panels... need to fix
from bl_ui.properties_mask_common import (MASK_PT_mask,
MASK_PT_layers,
MASK_PT_spline,
MASK_PT_point,
MASK_PT_display,
MASK_PT_tools)
class IMAGE_PT_mask(MASK_PT_mask, Panel):
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'PREVIEW'
class IMAGE_PT_mask_layers(MASK_PT_layers, Panel):
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'PREVIEW'
class IMAGE_PT_mask_display(MASK_PT_display, Panel):
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'PREVIEW'
class IMAGE_PT_active_mask_spline(MASK_PT_spline, Panel):
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'PREVIEW'
class IMAGE_PT_active_mask_point(MASK_PT_point, Panel):
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'PREVIEW'
class IMAGE_PT_tools_mask(MASK_PT_tools, Panel):
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'UI' # is 'TOOLS' in the clip editor
# --- end mask ---
if __name__ == "__main__": # only for live edit. if __name__ == "__main__": # only for live edit.
bpy.utils.register_module(__name__) bpy.utils.register_module(__name__)

@ -135,7 +135,8 @@ class NODE_MT_select(Menu):
layout.operator("node.select_border") layout.operator("node.select_border")
layout.separator() layout.separator()
layout.operator("node.select_all") layout.operator("node.select_all").action = 'TOGGLE'
layout.operator("node.select_all", text="Inverse").action = 'INVERT'
layout.operator("node.select_linked_from") layout.operator("node.select_linked_from")
layout.operator("node.select_linked_to") layout.operator("node.select_linked_to")
layout.operator("node.select_same_type") layout.operator("node.select_same_type")
@ -226,15 +227,20 @@ class NODE_PT_quality(bpy.types.Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
snode = context.space_data snode = context.space_data
tree = snode.node_tree tree = snode.node_tree
layout.prop(tree, "render_quality", text="Render") col = layout.column()
layout.prop(tree, "edit_quality", text="Edit") col.prop(tree, "render_quality", text="Render")
layout.prop(tree, "chunk_size") col.prop(tree, "edit_quality", text="Edit")
layout.prop(tree, "use_opencl") col.prop(tree, "chunk_size")
layout.prop(tree, "two_pass")
layout.prop(snode, "show_highlight") col = layout.column()
col.prop(tree, "use_opencl")
col.prop(tree, "two_pass")
col.prop(snode, "show_highlight")
col.prop(snode, "use_hidden_preview")
class NODE_MT_node_color_presets(Menu): class NODE_MT_node_color_presets(Menu):

@ -184,6 +184,7 @@ class SEQUENCER_MT_add(Menu):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN' layout.operator_context = 'INVOKE_REGION_WIN'
if len(bpy.data.scenes) > 10: if len(bpy.data.scenes) > 10:
@ -216,6 +217,7 @@ class SEQUENCER_MT_add_effect(Menu):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN' layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("sequencer.effect_strip_add", text="Add").type = 'ADD' layout.operator("sequencer.effect_strip_add", text="Add").type = 'ADD'
@ -834,6 +836,7 @@ class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
render = context.scene.render render = context.scene.render
col = layout.column() col = layout.column()

@ -302,6 +302,7 @@ class TEXT_MT_toolbox(Menu):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.operator_context = 'INVOKE_DEFAULT' layout.operator_context = 'INVOKE_DEFAULT'
layout.operator("text.cut") layout.operator("text.cut")

@ -160,8 +160,7 @@ class TIME_MT_frame(Menu):
layout.separator() layout.separator()
sub = layout.row() layout.menu("TIME_MT_autokey")
sub.menu("TIME_MT_autokey")
class TIME_MT_playback(Menu): class TIME_MT_playback(Menu):

@ -79,6 +79,7 @@ class USERPREF_HT_header(Header):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.template_header(menus=False) layout.template_header(menus=False)
userpref = context.user_preferences userpref = context.user_preferences
@ -137,6 +138,7 @@ class USERPREF_MT_splash(Menu):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
split = layout.split() split = layout.split()
row = split.row() row = split.row()
row.label("") row.label("")
@ -850,6 +852,7 @@ class USERPREF_MT_ndof_settings(Menu):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
input_prefs = context.user_preferences.inputs input_prefs = context.user_preferences.inputs
layout.separator() layout.separator()
@ -979,6 +982,7 @@ class USERPREF_MT_addons_dev_guides(Menu):
# menu to open web-pages with addons development guides # menu to open web-pages with addons development guides
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.operator("wm.url_open", text="API Concepts", icon='URL').url = "http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro" layout.operator("wm.url_open", text="API Concepts", icon='URL').url = "http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro"
layout.operator("wm.url_open", text="Addon Guidelines", icon='URL').url = "http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons" layout.operator("wm.url_open", text="Addon Guidelines", icon='URL').url = "http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons"
layout.operator("wm.url_open", text="How to share your addon", icon='URL').url = "http://wiki.blender.org/index.php/Dev:Py/Sharing" layout.operator("wm.url_open", text="How to share your addon", icon='URL').url = "http://wiki.blender.org/index.php/Dev:Py/Sharing"
@ -1004,10 +1008,10 @@ class USERPREF_PT_addons(Panel):
@staticmethod @staticmethod
def is_user_addon(mod, user_addon_paths): def is_user_addon(mod, user_addon_paths):
if not user_addon_paths: if not user_addon_paths:
user_script_path = bpy.utils.user_script_path() for path in (bpy.utils.script_path_user(),
if user_script_path is not None: bpy.utils.script_path_pref()):
user_addon_paths.append(os.path.join(user_script_path, "addons")) if path is not None:
user_addon_paths.append(os.path.join(bpy.utils.resource_path('USER'), "scripts", "addons")) user_addon_paths.append(os.path.join(path, "addons"))
for path in user_addon_paths: for path in user_addon_paths:
if bpy.path.is_subdir(mod.__file__, path): if bpy.path.is_subdir(mod.__file__, path):

@ -64,28 +64,29 @@ class VIEW3D_HT_header(Header):
layout.template_header_3D() layout.template_header_3D()
if obj: if obj:
mode = obj.mode
# Particle edit # Particle edit
if obj.mode == 'PARTICLE_EDIT': if mode == 'PARTICLE_EDIT':
row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True) row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True)
# Occlude geometry # Occlude geometry
if view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'} and (obj.mode == 'PARTICLE_EDIT' or (obj.mode == 'EDIT' and obj.type == 'MESH')): if view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'} and (mode == 'PARTICLE_EDIT' or (mode == 'EDIT' and obj.type == 'MESH')):
row.prop(view, "use_occlude_geometry", text="") row.prop(view, "use_occlude_geometry", text="")
# Proportional editing # Proportional editing
if obj.mode in {'EDIT', 'PARTICLE_EDIT'}: if mode in {'EDIT', 'PARTICLE_EDIT'}:
row = layout.row(align=True) row = layout.row(align=True)
row.prop(toolsettings, "proportional_edit", text="", icon_only=True) row.prop(toolsettings, "proportional_edit", text="", icon_only=True)
if toolsettings.proportional_edit != 'DISABLED': if toolsettings.proportional_edit != 'DISABLED':
row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True) row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
elif obj.mode == 'OBJECT': elif mode == 'OBJECT':
row = layout.row(align=True) row = layout.row(align=True)
row.prop(toolsettings, "use_proportional_edit_objects", text="", icon_only=True) row.prop(toolsettings, "use_proportional_edit_objects", text="", icon_only=True)
if toolsettings.use_proportional_edit_objects: if toolsettings.use_proportional_edit_objects:
row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True) row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
# Snap # Snap
if not obj or obj.mode not in {'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT'}: if not obj or mode not in {'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT'}:
snap_element = toolsettings.snap_element snap_element = toolsettings.snap_element
row = layout.row(align=True) row = layout.row(align=True)
row.prop(toolsettings, "use_snap", text="") row.prop(toolsettings, "use_snap", text="")
@ -93,9 +94,9 @@ class VIEW3D_HT_header(Header):
if snap_element != 'INCREMENT': if snap_element != 'INCREMENT':
row.prop(toolsettings, "snap_target", text="") row.prop(toolsettings, "snap_target", text="")
if obj: if obj:
if obj.mode in {'OBJECT', 'POSE'} and snap_element != 'VOLUME': if mode in {'OBJECT', 'POSE'} and snap_element != 'VOLUME':
row.prop(toolsettings, "use_snap_align_rotation", text="") row.prop(toolsettings, "use_snap_align_rotation", text="")
elif obj.mode == 'EDIT': elif mode == 'EDIT':
row.prop(toolsettings, "use_snap_self", text="") row.prop(toolsettings, "use_snap_self", text="")
if snap_element == 'VOLUME': if snap_element == 'VOLUME':
@ -110,7 +111,7 @@ class VIEW3D_HT_header(Header):
props.animation = True props.animation = True
# Pose # Pose
if obj and obj.mode == 'POSE': if obj and mode == 'POSE':
row = layout.row(align=True) row = layout.row(align=True)
row.operator("pose.copy", text="", icon='COPYDOWN') row.operator("pose.copy", text="", icon='COPYDOWN')
row.operator("pose.paste", text="", icon='PASTEDOWN') row.operator("pose.paste", text="", icon='PASTEDOWN')
@ -176,11 +177,12 @@ class VIEW3D_MT_transform(VIEW3D_MT_transform_base):
# Object-specific extensions to Transform menu # Object-specific extensions to Transform menu
class VIEW3D_MT_transform_object(VIEW3D_MT_transform_base): class VIEW3D_MT_transform_object(VIEW3D_MT_transform_base):
def draw(self, context): def draw(self, context):
layout = self.layout
# base menu # base menu
VIEW3D_MT_transform_base.draw(self, context) VIEW3D_MT_transform_base.draw(self, context)
# object-specific option follow... # object-specific option follow...
layout = self.layout
layout.separator() layout.separator()
layout.operator("transform.translate", text="Move Texture Space").texture_space = True layout.operator("transform.translate", text="Move Texture Space").texture_space = True
@ -212,11 +214,12 @@ class VIEW3D_MT_transform_object(VIEW3D_MT_transform_base):
# Armature EditMode extensions to Transform menu # Armature EditMode extensions to Transform menu
class VIEW3D_MT_transform_armature(VIEW3D_MT_transform_base): class VIEW3D_MT_transform_armature(VIEW3D_MT_transform_base):
def draw(self, context): def draw(self, context):
layout = self.layout
# base menu # base menu
VIEW3D_MT_transform_base.draw(self, context) VIEW3D_MT_transform_base.draw(self, context)
# armature specific extensions follow... # armature specific extensions follow...
layout = self.layout
layout.separator() layout.separator()
obj = context.object obj = context.object
@ -429,18 +432,23 @@ class VIEW3D_MT_view_align_selected(Menu):
props = layout.operator("view3d.viewnumpad", text="Top") props = layout.operator("view3d.viewnumpad", text="Top")
props.align_active = True props.align_active = True
props.type = 'TOP' props.type = 'TOP'
props = layout.operator("view3d.viewnumpad", text="Bottom") props = layout.operator("view3d.viewnumpad", text="Bottom")
props.align_active = True props.align_active = True
props.type = 'BOTTOM' props.type = 'BOTTOM'
props = layout.operator("view3d.viewnumpad", text="Front") props = layout.operator("view3d.viewnumpad", text="Front")
props.align_active = True props.align_active = True
props.type = 'FRONT' props.type = 'FRONT'
props = layout.operator("view3d.viewnumpad", text="Back") props = layout.operator("view3d.viewnumpad", text="Back")
props.align_active = True props.align_active = True
props.type = 'BACK' props.type = 'BACK'
props = layout.operator("view3d.viewnumpad", text="Right") props = layout.operator("view3d.viewnumpad", text="Right")
props.align_active = True props.align_active = True
props.type = 'RIGHT' props.type = 'RIGHT'
props = layout.operator("view3d.viewnumpad", text="Left") props = layout.operator("view3d.viewnumpad", text="Left")
props.align_active = True props.align_active = True
props.type = 'LEFT' props.type = 'LEFT'
@ -1191,6 +1199,7 @@ class VIEW3D_MT_vertex_group(Menu):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.operator_context = 'EXEC_AREA' layout.operator_context = 'EXEC_AREA'
layout.operator("object.vertex_group_assign", text="Assign to New Group").new = True layout.operator("object.vertex_group_assign", text="Assign to New Group").new = True
@ -1349,6 +1358,7 @@ class VIEW3D_MT_particle_specials(Menu):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
particle_edit = context.tool_settings.particle_edit particle_edit = context.tool_settings.particle_edit
layout.operator("particle.rekey") layout.operator("particle.rekey")
@ -1792,6 +1802,7 @@ class VIEW3D_MT_edit_mesh_edges(Menu):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN' layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("mesh.edge_face_add") layout.operator("mesh.edge_face_add")
@ -1844,6 +1855,7 @@ class VIEW3D_MT_edit_mesh_faces(Menu):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN' layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("mesh.flip_normals") layout.operator("mesh.flip_normals")
@ -2644,6 +2656,7 @@ class VIEW3D_PT_etch_a_ton(Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
toolsettings = context.scene.tool_settings toolsettings = context.scene.tool_settings
col = layout.column() col = layout.column()

@ -1124,6 +1124,7 @@ class VIEW3D_MT_tools_projectpaint_clone(Menu):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
for i, tex in enumerate(context.active_object.data.uv_textures): for i, tex in enumerate(context.active_object.data.uv_textures):
props = layout.operator("wm.context_set_int", text=tex.name) props = layout.operator("wm.context_set_int", text=tex.name)
props.data_path = "active_object.data.uv_texture_clone_index" props.data_path = "active_object.data.uv_texture_clone_index"

@ -0,0 +1,56 @@
import bpy
class LayoutDemoPanel(bpy.types.Panel):
"""Creates a Panel in the scene context of the properties editor"""
bl_label = "Layout Demo"
bl_idname = "SCENE_PT_layout"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "scene"
def draw(self, context):
layout = self.layout
sc = context.scene
#Create a simple row.
layout.label(text=" Simple Row:")
row = layout.row()
row.prop(sc, "frame_start")
row.prop(sc, "frame_end")
#Create an row where the buttons are aligned to each other.
layout.label(text=" Aligned Row")
row = layout.row(align=True)
row.prop(sc, "frame_start")
row.prop(sc, "frame_end")
#Create two columns, by using a split layout.
split = layout.split()
# First column
col = split.column()
col.label(text="Column One:")
col.prop(sc, "frame_end")
col.prop(sc, "frame_start")
# Second column, aligned
col = split.column(align=True)
col.label(text="Column Two")
col.prop(sc, "frame_start")
col.prop(sc, "frame_end")
def register():
bpy.utils.register_class(LayoutDemoPanel)
def unregister():
bpy.utils.unregister_class(LayoutDemoPanel)
if __name__ == "__main__":
register()

@ -965,11 +965,15 @@ AviError AVI_write_frame(AviMovie *movie, int frame_num, ...)
/* Allocate the new memory for the index entry */ /* Allocate the new memory for the index entry */
if (frame_num + 1 > movie->index_entries) { if (frame_num + 1 > movie->index_entries) {
temp = (AviIndexEntry *) MEM_mallocN((frame_num + 1) * const size_t entry_size = (movie->header->Streams + 1) * sizeof(AviIndexEntry);
(movie->header->Streams + 1) * sizeof(AviIndexEntry), "newidxentry");
if (movie->entries != NULL) { if (movie->entries != NULL) {
memcpy(temp, movie->entries, movie->index_entries * (movie->header->Streams + 1) * sizeof(AviIndexEntry)); temp = (AviIndexEntry *)MEM_reallocN(movie->entries, (frame_num + 1) * entry_size);
MEM_freeN(movie->entries); /* clear new bytes */
memset(&temp[movie->index_entries], 0, ((frame_num + 1) - movie->index_entries) * entry_size);
}
else {
temp = (AviIndexEntry *) MEM_callocN((frame_num + 1) * entry_size, "newidxentry");
} }
movie->entries = temp; movie->entries = temp;

@ -82,7 +82,7 @@ static const char *locales[] = {
"spanish", "es", "spanish", "es",
"catalan", "ca_AD", "catalan", "ca_AD",
"czech", "cs_CZ", "czech", "cs_CZ",
"ptb", "pt", "portuguese", "pt",
#if defined(_WIN32) && !defined(FREE_WINDOWS) #if defined(_WIN32) && !defined(FREE_WINDOWS)
"Chinese (Simplified)_China.1252", "zh_CN", "Chinese (Simplified)_China.1252", "zh_CN",
"Chinese (Traditional)_China.1252", "zh_TW", "Chinese (Traditional)_China.1252", "zh_TW",

@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines. * and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */ * Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 263 #define BLENDER_VERSION 263
#define BLENDER_SUBVERSION 14 #define BLENDER_SUBVERSION 17
#define BLENDER_MINVERSION 250 #define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0 #define BLENDER_MINSUBVERSION 0

@ -61,12 +61,14 @@ DerivedMesh *CDDM_from_BMEditMesh(struct BMEditMesh *em, struct Mesh *me, int us
/* merge verts */ /* merge verts */
DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap); DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap);
DerivedMesh *CDDM_from_curve_orco(struct Scene *scene, struct Object *ob);
/* creates a CDDerivedMesh from the given curve object */ /* creates a CDDerivedMesh from the given curve object */
struct DerivedMesh *CDDM_from_curve(struct Object *ob); struct DerivedMesh *CDDM_from_curve(struct Object *ob);
/* creates a CDDerivedMesh from the given curve object and specified dispbase */ /* creates a CDDerivedMesh from the given curve object and specified dispbase */
/* useful for OrcoDM creation for curves with constructive modifiers */ /* useful for OrcoDM creation for curves with constructive modifiers */
DerivedMesh *CDDM_from_curve_displist(struct Object *ob, struct ListBase *dispbase); DerivedMesh *CDDM_from_curve_displist(struct Object *ob, struct ListBase *dispbase, int **orco_index_ptr);
/* Copies the given DerivedMesh with verts, faces & edges stored as /* Copies the given DerivedMesh with verts, faces & edges stored as
* custom element data. * custom element data.

@ -122,12 +122,16 @@ void BKE_mask_point_select_set_handle(struct MaskSplinePoint *point, const short
/* general */ /* general */
struct Mask *BKE_mask_new(const char *name); struct Mask *BKE_mask_new(const char *name);
struct Mask *BKE_mask_copy_nolib(struct Mask *mask);
struct Mask *BKE_mask_copy(struct Mask *mask);
void BKE_mask_free(struct Mask *mask); void BKE_mask_free(struct Mask *mask);
void BKE_mask_unlink(struct Main *bmain, struct Mask *mask); void BKE_mask_unlink(struct Main *bmain, struct Mask *mask);
void BKE_mask_coord_from_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2]); void BKE_mask_coord_from_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2]);
void BKE_mask_coord_from_frame(float r_co[2], const float co[2], const float frame_size[2]);
void BKE_mask_coord_to_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2]); void BKE_mask_coord_to_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2]);
void BKE_mask_coord_to_frame(float r_co[2], const float co[2], const float frame_size[2]);
/* parenting */ /* parenting */
@ -181,23 +185,8 @@ void BKE_mask_layer_shape_changed_add(struct MaskLayer *masklay, int index,
void BKE_mask_layer_shape_changed_remove(struct MaskLayer *masklay, int index, int count); void BKE_mask_layer_shape_changed_remove(struct MaskLayer *masklay, int index, int count);
/* rasterization */
int BKE_mask_get_duration(struct Mask *mask); int BKE_mask_get_duration(struct Mask *mask);
void BKE_mask_rasterize_layers(struct ListBase *masklayers, int width, int height, float *buffer,
const short do_aspect_correct, const short do_mask_aa,
const short do_feather);
void BKE_mask_rasterize(struct Mask *mask, int width, int height, float *buffer,
const short do_aspect_correct, const short do_mask_aa,
const short do_feather);
/* initialization for tiling */
#ifdef __PLX_RASKTER_MT__
void BKE_mask_init_layers(Mask *mask, struct layer_init_data *mlayer_data, int width, int height,
const short do_aspect_correct);
#endif
#define MASKPOINT_ISSEL_ANY(p) ( ((p)->bezt.f1 | (p)->bezt.f2 | (p)->bezt.f2) & SELECT) #define MASKPOINT_ISSEL_ANY(p) ( ((p)->bezt.f1 | (p)->bezt.f2 | (p)->bezt.f2) & SELECT)
#define MASKPOINT_ISSEL_KNOT(p) ( (p)->bezt.f2 & SELECT) #define MASKPOINT_ISSEL_KNOT(p) ( (p)->bezt.f2 & SELECT)
#define MASKPOINT_ISSEL_HANDLE_ONLY(p) ( (((p)->bezt.f1 | (p)->bezt.f2) & SELECT) && (((p)->bezt.f2 & SELECT) == 0) ) #define MASKPOINT_ISSEL_HANDLE_ONLY(p) ( (((p)->bezt.f1 | (p)->bezt.f2) & SELECT) && (((p)->bezt.f2 & SELECT) == 0) )
@ -210,11 +199,9 @@ void BKE_mask_init_layers(Mask *mask, struct layer_init_data *mlayer_data, int w
#define MASKPOINT_SEL_HANDLE(p) { (p)->bezt.f1 |= SELECT; (p)->bezt.f3 |= SELECT; } (void)0 #define MASKPOINT_SEL_HANDLE(p) { (p)->bezt.f1 |= SELECT; (p)->bezt.f3 |= SELECT; } (void)0
#define MASKPOINT_DESEL_HANDLE(p) { (p)->bezt.f1 &= ~SELECT; (p)->bezt.f3 &= ~SELECT; } (void)0 #define MASKPOINT_DESEL_HANDLE(p) { (p)->bezt.f1 &= ~SELECT; (p)->bezt.f3 &= ~SELECT; } (void)0
/* disable to test alternate rasterizer */ #define MASK_RESOL_MAX 128
/* #define USE_RASKTER */
/* mask_rasterize.c */ /* mask_rasterize.c */
#ifndef USE_RASKTER
struct MaskRasterHandle; struct MaskRasterHandle;
typedef struct MaskRasterHandle MaskRasterHandle; typedef struct MaskRasterHandle MaskRasterHandle;
@ -225,6 +212,9 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, str
const short do_aspect_correct, const short do_mask_aa, const short do_aspect_correct, const short do_mask_aa,
const short do_feather); const short do_feather);
float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float xy[2]); float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float xy[2]);
#endif /* USE_RASKTER */
void BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle,
const unsigned int width, const unsigned int height,
float *buffer);
#endif /* __BKE_MASK_H__ */ #endif /* __BKE_MASK_H__ */

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