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':
print B.bc.OKGREEN + "Detected Xcode version: -- " + B.bc.ENDC + env['XCODE_CUR_VER'] + " --"
print "Available " + env['MACOSX_SDK_CHECK']
if not 'Mac OS X 10.5' in env['MACOSX_SDK_CHECK']:
print B.bc.OKGREEN + "MacOSX10.5.sdk not available:" + B.bc.ENDC + " using MacOSX10.6.sdk"
if not 'Mac OS X 10.6' in env['MACOSX_SDK_CHECK']:
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:
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'
elif cmd_res[:2]=='11':
MAC_CUR_VER='10.7'
elif cmd_res[:2]=='12':
MAC_CUR_VER='10.8'
cmd = 'xcodebuild -version'
cmd_xcode=commands.getoutput(cmd)
XCODE_CUR_VER=cmd_xcode[6:][:3] # truncate output to major.minor version
@ -75,7 +77,7 @@ else :
LCGDIR = '#../lib/darwin-9.x.universal'
CC = 'gcc-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
MAC_MIN_VERS = '10.6'
MACOSX_DEPLOYMENT_TARGET = '10.6'
@ -83,6 +85,14 @@ else :
LCGDIR = '#../lib/darwin-9.x.universal'
CC = 'gcc-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}'
@ -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
#for 10.7.sdk, SystemStubs needs to be excluded (lib doesn't exist anymore)
if MACOSX_DEPLOYMENT_TARGET == '10.7':
#for > 10.7.sdk, SystemStubs needs to be excluded (lib doesn't exist anymore)
if MACOSX_SDK.endswith("10.7.sdk") or MACOSX_SDK.endswith("10.8.sdk"):
LLIBS = ['stdc++']
else:
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 -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 '__pycache__' -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)
#### END ACTION STUFF #########
def bsc(env, target, source):

@ -135,7 +135,7 @@ def validate_arguments(args, bc):
'BF_CXX', 'WITH_BF_STATICCXX', 'BF_CXX_LIB_STATIC',
'BF_TWEAK_MODE', 'BF_SPLIT_SRC',
'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',
'WITH_BF_OPENMP', 'BF_OPENMP', 'BF_OPENMP_LIBPATH',
'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('WITHOUT_BF_INSTALL', 'dont install 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_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)),

@ -172,7 +172,7 @@ General functions
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.
@ -186,6 +186,8 @@ General functions
:type load_actions: bool
:arg verbose: Whether or not to print debugging information (e.g., "SceneName: Scene")
: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)

@ -56,7 +56,69 @@ To enable line length checks use this instead.
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

@ -979,6 +979,7 @@ def pycontext2sphinx(basepath):
"meta_ball": ("MetaBall", False),
"object": ("Object", False),
"particle_edit_object": ("Object", False),
"particle_settings": ("ParticleSettings", False),
"particle_system": ("ParticleSystem", False),
"particle_system_editable": ("ParticleSystem", 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
side and bullet side.
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)
return btScalar(1.0);
if (!convexResult.m_hitCollisionObject->hasContactResponse())
return btScalar(1.0);
btVector3 hitNormalWorld;
if (normalInWorldSpace)
{
@ -173,6 +176,11 @@ bool btKinematicCharacterController::recoverFromPenetration ( btCollisionWorld*
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);

@ -209,7 +209,7 @@ void CameraIntrinsics::ComputeLookupGrid(Grid* grid, int width, int height, doub
if( ix >= width-2 ) ix = width-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;
}
}

@ -66,7 +66,7 @@ std::vector<Feature> DetectFAST(const unsigned char* data, int width, int height
Feature *all_features = new Feature[num_features];
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;
}
@ -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 x=16; x<width-16; 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;
}
}

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

@ -33,7 +33,7 @@
#ifndef 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_set>
#else

@ -321,7 +321,7 @@ static void simplifyContour(rcIntArray& points, rcIntArray& simplified,
// Find maximum deviation from the segment.
float maxd = 0;
int maxi = -1;
int i_max = -1;
int ci, cinc, endi;
// Traverse the segment in lexilogical order so that the
@ -350,7 +350,7 @@ static void simplifyContour(rcIntArray& points, rcIntArray& simplified,
if (d > maxd)
{
maxd = d;
maxi = ci;
i_max = ci;
}
ci = (ci+cinc) % pn;
}
@ -359,7 +359,7 @@ static void simplifyContour(rcIntArray& points, rcIntArray& simplified,
// If the max deviation is larger than accepted error,
// 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.
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];
}
// Add the point.
simplified[(i+1)*4+0] = points[maxi*4+0];
simplified[(i+1)*4+1] = points[maxi*4+1];
simplified[(i+1)*4+2] = points[maxi*4+2];
simplified[(i+1)*4+3] = maxi;
simplified[(i+1)*4+0] = points[i_max*4+0];
simplified[(i+1)*4+1] = points[i_max*4+1];
simplified[(i+1)*4+2] = points[i_max*4+2];
simplified[(i+1)*4+3] = i_max;
}
else
{
@ -399,7 +399,7 @@ static void simplifyContour(rcIntArray& points, rcIntArray& simplified,
const int bi = simplified[ii*4+3];
// Find maximum deviation from the segment.
int maxi = -1;
int i_max = -1;
int ci = (ai+1) % pn;
// 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))
{
const int n = bi < ai ? (bi+pn - ai) : (bi - ai);
maxi = (ai + n/2) % pn;
i_max = (ai + n/2) % pn;
}
else
{
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,
// add new point, else continue to next segment.
if (maxi != -1)
if (i_max != -1)
{
// Add space for the new point.
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];
}
// Add the point.
simplified[(i+1)*4+0] = points[maxi*4+0];
simplified[(i+1)*4+1] = points[maxi*4+1];
simplified[(i+1)*4+2] = points[maxi*4+2];
simplified[(i+1)*4+3] = maxi;
simplified[(i+1)*4+0] = points[i_max*4+0];
simplified[(i+1)*4+1] = points[i_max*4+1];
simplified[(i+1)*4+2] = points[i_max*4+2];
simplified[(i+1)*4+3] = i_max;
}
else
{

@ -305,7 +305,7 @@ static int triangulate(int n, const int* verts, int* indices, int* tris)
while (n > 3)
{
int minLen = -1;
int mini = -1;
int i_min = -1;
for (int i = 0; i < n; i++)
{
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)
{
minLen = len;
mini = i;
i_min = i;
}
}
}
if (mini == -1)
if (i_min == -1)
{
// Should not happen.
/* 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;
}
int i = mini;
int i = i_min;
int i1 = next(i, 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];
// Find maximum deviation along the segment.
float maxd = 0;
int maxi = -1;
int i_max = -1;
for (int m = a+1; m < b; ++m)
{
float d = distancePtSeg(&edge[m*3],va,vb);
if (d > maxd)
{
maxd = d;
maxi = m;
i_max = m;
}
}
// If the max deviation is larger than accepted error,
// 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)
idx[m] = idx[m-1];
idx[k+1] = maxi;
idx[k+1] = i_max;
nidx++;
}
else

@ -547,13 +547,32 @@ static uint quadMerge(std::map<MeshSet<3>::vertex_t*, uint> *vertexToIndex_map,
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 */
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;
}
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) +
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();
for (i = 0; face_iter != poly->faceEnd(); ++face_iter, ++i) {
MeshSet<3>::face_t *f = *face_iter;
if (Carve_checkDegeneratedFace(&vertexToIndex_map, f))
continue;
ofaces[oface_num.getAttribute(f)].push_back(i);
MeshSet<3>::face_t::edge_iter_t edge_iter = f->begin();
for (; edge_iter != f->end(); ++edge_iter) {
int index = vertexToIndex_map[edge_iter->vert];
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
outputMesh->FaceSet().push_back(BSP_MFace());
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
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) {
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));
CYCLES_LOCAL_LAYER_HACK(render_layer.use_localview, ob_layer);
hide = hide || !(ob_layer & scene_layer);
if(!hide) {

@ -144,16 +144,20 @@ void BlenderSync::sync_particles(Object *ob, BL::Object b_ob)
BL::Object::particle_systems_iterator 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)) {
int pa_index = 0;
BL::ParticleSystem::particles_iterator b_pa;
for(b_psys->particles.begin(b_pa), index = 0; b_pa != b_psys->particles.end(); ++b_pa, ++index) {
if(use_particle(*b_pa)) {
Particle pa;
pa.index = pa_index;
pa.age = b_scene.frame_current() - b_pa->birth_time();
pa.lifetime = b_pa->lifetime();
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();
}
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());
CYCLES_LOCAL_LAYER_HACK(render_layer.use_localview, render_layer.scene_layer);
render_layer.layer = render_layer.scene_layer;
render_layer.holdout_layer = 0;
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.use_background = b_rlay->use_sky();
render_layer.use_viewport_visibility = false;
render_layer.use_localview = false;
render_layer.samples = b_rlay->samples();
}

@ -127,10 +127,25 @@ private:
BL::Material material_override;
bool use_background;
bool use_viewport_visibility;
bool use_localview;
int samples;
} 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
#endif /* __BLENDER_SYNC_H__ */

@ -378,19 +378,10 @@ void BVH::pack_instances(size_t nodes_size)
int mesh_tri_offset = mesh->tri_offset;
/* fill in node indexes for instances */
if(
/* 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])
{
if((bvh->pack.is_leaf.size() != 0) && bvh->pack.is_leaf[0])
pack.object_node[object_offset++] = -noffset-1;
}
else {
else
pack.object_node[object_offset++] = noffset;
}
mesh_map[mesh] = pack.object_node[object_offset-1];

@ -298,15 +298,12 @@ public:
{
string build_options = " -cl-fast-relaxed-math ";
/* Multi Closure for nVidia cards */
if(platform_name == "NVIDIA CUDA")
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")
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")
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);
}
__device float particle_age(KernelGlobals *kg, int particle)
__device_inline float particle_index(KernelGlobals *kg, int particle)
{
int offset = particle*PARTICLE_SIZE;
float4 f = kernel_tex_fetch(__particles, offset);
return f.x;
}
__device float particle_lifetime(KernelGlobals *kg, int particle)
__device float particle_age(KernelGlobals *kg, int particle)
{
int offset = particle*PARTICLE_SIZE;
float4 f = kernel_tex_fetch(__particles, offset);
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

@ -288,7 +288,7 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
if(sd.flag & SD_HOLDOUT_MASK)
holdout_weight = make_float3(1.0f, 1.0f, 1.0f);
else
shader_holdout_eval(kg, &sd);
holdout_weight = shader_holdout_eval(kg, &sd);
/* any throughput is ok, should all be identical here */
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)
holdout_weight = make_float3(1.0f, 1.0f, 1.0f);
else
shader_holdout_eval(kg, &sd);
holdout_weight = shader_holdout_eval(kg, &sd);
/* any throughput is ok, should all be identical here */
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),
/* this gives collisions with localview bits
* see: CYCLES_LOCAL_LAYER_HACK(), grr - Campbell */
PATH_RAY_LAYER_SHIFT = (32-20)
};

@ -101,6 +101,12 @@ __device void svm_node_particle_info(KernelGlobals *kg, ShaderData *sd, float *s
float data;
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: {
uint particle_id = object_particle_id(kg, sd->object);
data = particle_age(kg, particle_id);

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

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

@ -1798,12 +1798,15 @@ void ObjectInfoNode::compile(OSLCompiler& compiler)
ParticleInfoNode::ParticleInfoNode()
: ShaderNode("particle_info")
{
add_output("Index", SHADER_SOCKET_FLOAT);
add_output("Age", SHADER_SOCKET_FLOAT);
add_output("Lifetime", SHADER_SOCKET_FLOAT);
}
void ParticleInfoNode::attributes(AttributeRequestSet *attributes)
{
if(!output("Index")->links.empty())
attributes->add(ATTR_STD_PARTICLE);
if(!output("Age")->links.empty())
attributes->add(ATTR_STD_PARTICLE);
if(!output("Lifetime")->links.empty())
@ -1816,6 +1819,12 @@ void ParticleInfoNode::compile(SVMCompiler& compiler)
{
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");
if(!out->links.empty()) {
compiler.stack_assign(out);

@ -112,7 +112,8 @@ void Object::apply_transform()
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)
@ -269,7 +270,7 @@ void ObjectManager::device_update_particles(Device *device, DeviceScene *dscene,
/* pack in texture */
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++;

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

@ -26,6 +26,12 @@
#include "util_path.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/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;
for(; it != it_end; it++) {
#if (BOOST_FILESYSTEM_VERSION == 2)
string filename = it->path().filename();
#else
string filename = it->path().filename().string();
#endif
if(boost::starts_with(filename, name))
if(except.find(filename) == except.end())

@ -26,6 +26,12 @@ OIIO_NAMESPACE_USING
#include <stdio.h>
#include <boost/version.hpp>
#if (BOOST_VERSION < 104400)
# define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
@ -58,7 +64,11 @@ string path_user_get(const string& sub)
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();
#endif
}
string path_dirname(const string& path)

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

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

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

@ -58,8 +58,11 @@ GHOST_NDOFManagerX11::GHOST_NDOFManagerX11(GHOST_System& sys)
}
}
else {
#ifdef DEBUG
/* annoying for official builds, just adds noise and most prople don't own these */
puts("ndof: spacenavd not found");
/* 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 <unistd.h>
#include <stdio.h> // for fprintf only
#include <cstdlib> // for exit
#include <stdio.h> /* for fprintf only */
#include <cstdlib> /* for exit */
#include <pwd.h> // for get home without use getenv()
#include <limits.h> // for PATH_MAX
#include <pwd.h> /* for get home without use getenv() */
#include <limits.h> /* for PATH_MAX */
#ifdef PREFIX
static const char *static_path = PREFIX "/share";

@ -32,7 +32,6 @@
* \ingroup GHOST
*/
#include "GHOST_SystemX11.h"
#include "GHOST_WindowX11.h"
#include "GHOST_WindowManager.h"
@ -61,20 +60,19 @@
#include <X11/XF86keysym.h>
#endif
// For timing
/* For timing */
#include <sys/time.h>
#include <unistd.h>
#include <iostream>
#include <vector>
#include <stdio.h> // for fprintf only
#include <cstdlib> // for exit
#include <stdio.h> /* for fprintf only */
#include <cstdlib> /* for exit */
static GHOST_TKey
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_select_buffer = NULL;
@ -90,7 +88,7 @@ GHOST_SystemX11(
if (!m_display) {
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)
@ -128,13 +126,13 @@ GHOST_SystemX11(
m_last_warp = 0;
// compute the initial time
/* compute the initial time */
timeval tv;
if (gettimeofday(&tv, NULL) == -1) {
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;
@ -190,7 +188,7 @@ getMilliSeconds() const
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;
}
@ -254,16 +252,16 @@ createWindow(
window = new GHOST_WindowX11(
this, m_display, title, left, top, width, height, state, parentWindow, type, stereoVisual
);
window = new GHOST_WindowX11(this, m_display, title,
left, top, width, height,
state, parentWindow, type, stereoVisual);
if (window) {
// Both are now handle in GHOST_WindowX11.cpp
// Focus and Delete atoms.
/* Both are now handle in GHOST_WindowX11.cpp
* Focus and Delete atoms. */
if (window->getValid()) {
// Store the pointer to the window
/* Store the pointer to the window */
m_windowManager->addWindow(window);
m_windowManager->setActiveWindow(window);
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) );
@ -313,10 +311,10 @@ findGhostWindow(
if (xwind == 0) return NULL;
// It is not entirely safe to do this as the backptr may point
// to a window that has recently been removed.
// We should always check the window manager's list of windows
// and only process events on these windows.
/* It is not entirely safe to do this as the backptr may point
* to a window that has recently been removed.
* We should always check the window manager's list of windows
* and only process events on these windows. */
vector<GHOST_IWindow *> & win_vec = m_windowManager->getWindows();
@ -411,8 +409,8 @@ GHOST_SystemX11::
processEvents(
bool waitForEvent)
{
// Get all the current events -- translate them into
// ghost events and call base class pushEvent() method.
/* Get all the current events -- translate them into
* ghost events and call base class pushEvent() method. */
bool anyProcessed = false;
@ -519,8 +517,8 @@ GHOST_SystemX11::processEvent(XEvent *xe)
XExposeEvent & xee = xe->xexpose;
if (xee.count == 0) {
// Only generate a single expose event
// per read of the event queue.
/* Only generate a single expose event
* per read of the event queue. */
g_event = new
GHOST_Event(
@ -761,7 +759,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
break;
}
// change of size, border, layer etc.
/* change of size, border, layer etc. */
case ConfigureNotify:
{
/* XConfigureEvent & xce = xe->xconfigure; */
@ -780,11 +778,10 @@ GHOST_SystemX11::processEvent(XEvent *xe)
{
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);
// May have to look at the type of event and filter some
// out.
/* May have to look at the type of event and filter some out. */
GHOST_TEventType gtype = (xfe.type == FocusIn) ?
GHOST_kEventWindowActivate : GHOST_kEventWindowDeactivate;
@ -860,7 +857,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
case DestroyNotify:
::exit(-1);
// We're not interested in the following things.(yet...)
/* We're not interested in the following things.(yet...) */
case NoExpose:
case GraphicsExpose:
break;
@ -946,7 +943,11 @@ GHOST_SystemX11::processEvent(XEvent *xe)
nxe.xselection.time = xse->time;
/* 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)) {
XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 8, PropModeReplace,
(unsigned char *)txt_select_buffer, strlen(txt_select_buffer));
@ -968,11 +969,11 @@ GHOST_SystemX11::processEvent(XEvent *xe)
XFlush(m_display);
}
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;
}
//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);
XFlush(m_display);
break;
@ -1023,14 +1024,14 @@ getModifierKeys(
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));
XQueryKeymap(m_display, (char *)m_keyboard_vector);
// now translate key symobols into keycodes and
// test with vector.
/* now translate key symobols into keycodes and
* test with vector. */
const static KeyCode shift_l = XKeysymToKeycode(m_display, XK_Shift_L);
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_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_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_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_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) ||
((m_keyboard_vector[super_r >> 3] >> (super_r & 7)) & 1) ) != 0);
@ -1123,9 +1124,9 @@ setCursorPosition(
GHOST_TInt32 y
) {
// This is a brute force move in screen coordinates
// XWarpPointer does relative moves so first determine the
// current pointer position.
/* This is a brute force move in screen coordinates
* XWarpPointer does relative moves so first determine the
* current pointer position. */
int cx, cy;
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_TEXT 6
// Retrieves the contents of a selections.
/* Retrieves the contents of a selections. */
void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
Atom sel, Atom target, unsigned char **txt,
unsigned long *len, unsigned int *context) const
@ -1361,15 +1362,15 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
Window win = window->getXWindow();
switch (*context) {
// There is no context, do an XConvertSelection()
/* There is no context, do an XConvertSelection() */
case XCLIB_XCOUT_NONE:
// Initialise return length to 0
/* Initialise return length to 0 */
if (*len > 0) {
free(*txt);
*len = 0;
}
// Send a selection request
/* Send a selection request */
XConvertSelection(m_display, sel, target, m_xclip_out, win, CurrentTime);
*context = XCLIB_XCOUT_SENTCONVSEL;
return;
@ -1391,22 +1392,22 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
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,
AnyPropertyType, &pty_type, &pty_format,
&pty_items, &pty_size, &buffer);
XFree(buffer);
if (pty_type == m_incr) {
// start INCR mechanism by deleting property
/* start INCR mechanism by deleting property */
XDeleteProperty(m_display, win, m_xclip_out);
XFlush(m_display);
*context = XCLIB_XCOUT_INCR;
return;
}
// if it's not incr, and not format == 8, then there's
// nothing in the selection (that xclip understands, anyway)
/* if it's not incr, and not format == 8, then there's
* nothing in the selection (that xclip understands, anyway) */
if (pty_format != 8) {
*context = XCLIB_XCOUT_NONE;
@ -1418,73 +1419,73 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
False, AnyPropertyType, &pty_type,
&pty_format, &pty_items, &pty_size, &buffer);
// finished with property, delete it
/* finished with property, delete it */
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);
memcpy(ltxt, buffer, pty_items);
// set the length of the returned data
/* set the length of the returned data */
*len = pty_items;
*txt = ltxt;
// free the buffer
/* free the buffer */
XFree(buffer);
*context = XCLIB_XCOUT_NONE;
// complete contents of selection fetched, return 1
/* complete contents of selection fetched, return 1 */
return;
case XCLIB_XCOUT_INCR:
// To use the INCR method, we basically delete the
// property with the selection in it, wait for an
// event indicating that the property has been created,
// then read it, delete it, etc.
/* To use the INCR method, we basically delete the
* property with the selection in it, wait for an
* event indicating that the property has been created,
* then read it, delete it, etc. */
// make sure that the event is relevant
/* make sure that the event is relevant */
if (evt.type != PropertyNotify)
return;
// skip unless the property has a new value
/* skip unless the property has a new value */
if (evt.xproperty.state != PropertyNewValue)
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,
AnyPropertyType, &pty_type, &pty_format,
&pty_items, &pty_size, (unsigned char **) &buffer);
if (pty_format != 8) {
// property does not contain text, delete it
// to tell the other X client that we have read
// it and to send the next property
/* property does not contain text, delete it
* to tell the other X client that we have read
* it and to send the next property */
XFree(buffer);
XDeleteProperty(m_display, win, m_xclip_out);
return;
}
if (pty_size == 0) {
// no more data, exit from loop
/* no more data, exit from loop */
XFree(buffer);
XDeleteProperty(m_display, win, m_xclip_out);
*context = XCLIB_XCOUT_NONE;
// this means that an INCR transfer is now
// complete, return 1
/* this means that an INCR transfer is now
* complete, return 1 */
return;
}
XFree(buffer);
// if we have come this far, the propery contains
// text, we know the size.
/* if we have come this far, the property contains
* text, we know the size. */
XGetWindowProperty(m_display, win, m_xclip_out, 0, (long) pty_size,
False, AnyPropertyType, &pty_type, &pty_format,
&pty_items, &pty_size, (unsigned char **) &buffer);
// allocate memory to accommodate data in *txt
/* allocate memory to accommodate data in *txt */
if (*len == 0) {
*len = pty_items;
ltxt = (unsigned char *) malloc(*len);
@ -1494,13 +1495,13 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
ltxt = (unsigned char *) realloc(ltxt, *len);
}
// add data to ltxt
/* add data to ltxt */
memcpy(&ltxt[*len - pty_items], buffer, pty_items);
*txt = ltxt;
XFree(buffer);
// delete property to get the next item
/* delete property to get the next item */
XDeleteProperty(m_display, win, m_xclip_out);
XFlush(m_display);
return;
@ -1514,7 +1515,7 @@ GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const
Atom target = m_utf8_string;
Window owner;
// from xclip.c doOut() v0.11
/* from xclip.c doOut() v0.11 */
unsigned char *sel_buf;
unsigned long sel_len = 0;
XEvent evt;

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

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

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

@ -54,6 +54,14 @@
#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:
* lets you count the allocations so as to find the allocator of unfreed memory
* in situations where the leak is predictable */
@ -96,6 +104,10 @@ typedef struct MemHead {
#ifdef DEBUG_MEMCOUNTER
int _count;
#endif
#ifdef DEBUG_MEMDUPLINAME
int need_free_name, pad;
#endif
} MemHead;
typedef struct MemTail {
@ -244,12 +256,35 @@ void *MEM_dupallocN(void *vmemh)
MemHead *memh = vmemh;
memh--;
#ifndef DEBUG_MEMDUPLINAME
if (memh->mmap)
newp = MEM_mapallocN(memh->len, "dupli_mapalloc");
else
newp = MEM_mallocN(memh->len, "dupli_alloc");
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);
}
@ -290,6 +325,10 @@ static void make_memhead_header(MemHead *memh, size_t len, const char *str)
memh->mmap = 0;
memh->tag2 = MEMTAG2;
#ifdef DEBUG_MEMDUPLINAME
memh->need_free_name = 0;
#endif
memt = (MemTail *)(((char *) memh) + sizeof(MemHead) + len);
memt->tag3 = MEMTAG3;
@ -605,7 +644,7 @@ void MEM_printmemlist_pydict(void)
MEM_printmemlist_internal(1);
}
short MEM_freeN(void *vmemh) /* anders compileertie niet meer */
short MEM_freeN(void *vmemh)
{
short error = 0;
MemTail *memt;
@ -733,6 +772,11 @@ static void rem_memblock(MemHead *memh)
totblock--;
mem_in_use -= memh->len;
#ifdef DEBUG_MEMDUPLINAME
if (memh->need_free_name)
free((char *) memh->name);
#endif
if (memh->mmap) {
mmap_in_use -= memh->len;
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);
#define IK_STRETCH_STIFF_EPS 0.001f
#define IK_STRETCH_STIFF_MIN 0.001f
#define IK_STRETCH_STIFF_MAX 1e10
#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)
{
m_beta[id] = v.x();
m_beta[id + 0] = v.x();
m_beta[id + 1] = v.y();
m_beta[id + 2] = v.z();
}
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 + 2][dof_id] = v.z() * m_weight_sqrt[dof_id];

@ -46,18 +46,18 @@ IK_QJacobianSolver::IK_QJacobianSolver()
MT_Scalar IK_QJacobianSolver::ComputeScale()
{
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++)
length += (*seg)->MaxExtension();
if(length == 0.0f)
return 1.0f;
if (length == 0.0)
return 1.0;
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::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)
{
// acos that does not return NaN with rounding errors
if (f <= -1.0f) return MT_PI;
else if (f >= 1.0f) return 0.0;
if (f <= -1.0) return MT_PI;
else if (f >= 1.0) return 0.0;
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
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;
// solve again, with the pole angle we just computed

@ -77,7 +77,7 @@ private:
void ConstrainPoleVector(IK_QSegment *root, std::list<IK_QTask*>& tasks);
MT_Scalar ComputeScale();
void Scale(float scale, std::list<IK_QTask*>& tasks);
void Scale(MT_Scalar scale, std::list<IK_QTask*>& tasks);
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]);
else if (axis == 1) return atan2(-R[0][2], t);
else return -atan2(R[0][1], R[0][0]);
} else {
}
else {
if (axis == 0) return -atan2(-R[2][1], R[1][1]);
else if (axis == 1) return atan2(-R[0][2], t);
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)
{
if (f <= -1.0f)
if (f <= -1.0)
return MT_PI;
else if (f >= 1.0f)
else if (f >= 1.0)
return 0.0;
else
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 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;
}
@ -345,7 +346,7 @@ void IK_QSegment::PrependBasis(const MT_Matrix3x3& mat)
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_translation *= scale;
@ -1035,7 +1036,7 @@ void IK_QTranslateSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax)
m_limit[axis] = true;
}
void IK_QTranslateSegment::Scale(float scale)
void IK_QTranslateSegment::Scale(MT_Scalar scale)
{
int i;

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

@ -78,7 +78,7 @@ public:
virtual bool PositionTask() const { return false; }
virtual void Scale(float) {}
virtual void Scale(MT_Scalar) {}
protected:
int m_id;
@ -103,7 +103,7 @@ public:
MT_Scalar Distance() const;
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:
MT_Vector3 m_goal;
@ -141,7 +141,7 @@ public:
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:
MT_Scalar ComputeTotalMass(const IK_QSegment *segment);

@ -42,7 +42,8 @@ using namespace std;
class IK_QSolver {
public:
IK_QSolver() : root(NULL) {};
IK_QSolver() : root(NULL) {
};
IK_QJacobianSolver solver;
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)
{
if (stiffness < 0.0)
if (stiffness < 0.0f)
return;
if (stiffness > 0.999)
stiffness = 0.999;
if (stiffness > (1.0 - IK_STRETCH_STIFF_EPS))
stiffness = (1.0 - IK_STRETCH_STIFF_EPS);
IK_QSegment *qseg = (IK_QSegment *)seg;
MT_Scalar weight = 1.0-stiffness;
MT_Scalar weight = 1.0f - stiffness;
if (axis >= IK_TRANS_X) {
if (!qseg->Translational()) {

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

@ -130,7 +130,7 @@ protected :
/**
* 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.
*/

@ -37,6 +37,15 @@
#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.
@ -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);
}
__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) {
return 0.0f;
}
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 b;
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) {
return;
}

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

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

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

@ -56,7 +56,6 @@ def main():
help="Restrict processed languages to those.")
args = parser.parse_args()
ret = 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.")
args = parser.parse_args()
ret = 0
done_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_FLAG_SHAPE_ARAB_LIGA
##### Kernel processing funcs. #####
def protect_format_seq(msg):
"""
@ -185,6 +186,7 @@ def log2vis(msgs):
yield fbc_str.value
##### Command line stuff. #####
def main():
import argparse
@ -208,7 +210,6 @@ def main():
help="The po's to pre-process messages.")
args = parser.parse_args()
msgs, state, u1 = utils.parse_messages(args.src)
if state["is_broken"]:
print("Source po is BROKEN, aborting.")

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

@ -38,6 +38,7 @@ except:
PY3 = settings.PYTHON3_EXEC
def main():
import argparse
parser = argparse.ArgumentParser(description="" \
@ -59,7 +60,6 @@ def main():
help="Restrict processed languages to those.")
args = parser.parse_args()
ret = 0
# 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 = lambda s: "".join(m.group("clean") for m in _clean_str(s))
def check_file(path, rel_path, messages):
with open(path, encoding="utf-8") as f:
f = f.read()
@ -149,6 +150,8 @@ from spell_check_utils import (dict_uimsgs,
)
_spell_checked = set()
def spell_check(txt, cache):
ret = []
@ -194,6 +197,8 @@ def gen_empty_pot():
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)
def merge_messages(msgs, states, messages, do_checks, spell_cache):
num_added = num_present = 0
for (context, msgid), srcs in messages.items():

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

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

@ -34,13 +34,14 @@ __all__ = (
"register_class",
"register_module",
"resource_path",
"script_path_user",
"script_path_pref",
"script_paths",
"smpte_from_frame",
"smpte_from_seconds",
"unregister_class",
"unregister_module",
"user_resource",
"user_script_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), )
def user_script_path():
# returns the env var and falls back to userprefs
def script_path_user():
"""returns the env var and falls back to home dir or None"""
path = _user_resource('SCRIPTS')
return _os.path.normpath(path) if path else None
if path:
path = _os.path.normpath(path)
return path
else:
return None
def script_path_pref():
"""returns the user preference or None"""
path = _bpy.context.user_preferences.filepaths.script_directory
return _os.path.normpath(path) if path else None
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
"""
scripts = list(_scripts)
prefs = _bpy.context.user_preferences
# add user scripts dir
user_script = user_script_path()
if check_all:
# all possible paths
@ -291,7 +289,7 @@ def script_paths(subdir=None, user_pref=True, check_all=False):
# only paths blender uses
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:
path = _os.path.normpath(path)
if path not in scripts and _os.path.isdir(path):

@ -308,7 +308,8 @@ def banner(context):
'OUTPUT')
add_scrollback("Convenience Imports: from mathutils import *; "
"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')
sc.prompt = PROMPT

@ -87,7 +87,8 @@ def write_sysinfo(op):
output.write("\nDirectories:\n")
output.write(lilies)
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("config: %r\n" % (bpy.utils.user_resource('CONFIG')))
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
(not isinstance(id_data, (bpy.types.WindowManager,
bpy.types.Screen,
bpy.types.Scene,
bpy.types.Brush,
))))

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

@ -323,6 +323,7 @@ class DATA_PT_onion_skinning(OnionSkinButtonsPanel): # , Panel): # inherit from
def draw(self, context):
ob = context.object
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.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="")
if group:
col.separator()

@ -105,14 +105,13 @@ class DATA_PT_cone(DataButtonsPanel, Panel):
speaker = context.speaker
split = layout.split()
col = split.column()
col = split.column()
col.label("Angle:")
col.prop(speaker, "cone_angle_outer", text="Outer")
col.prop(speaker, "cone_angle_inner", text="Inner")
col = split.column()
col.label("Volume:")
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'}:
col = split.column()
col.prop(gs, "dome_buffer_resolution", text="Resolution", 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':
col = split.column()
col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
col = split.column()
col.prop(gs, "dome_tessellation", text="Tessellation")
else: # cube map
col = split.column()
col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
col = split.column()
@ -396,6 +394,7 @@ class RENDER_PT_game_system(RenderButtonsPanel, Panel):
layout = self.layout
gs = context.scene.game_settings
row = layout.row()
row.prop(gs, "use_frame_rate")
row.prop(gs, "restrict_animation_updates")
@ -415,10 +414,10 @@ class RENDER_PT_game_display(RenderButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
row = layout.row()
row.prop(context.scene.render, "fps", text="Animation Frame Rate", slider=False)
gs = context.scene.game_settings
layout.prop(context.scene.render, "fps", text="Animation Frame Rate", slider=False)
flow = layout.column_flow()
flow.prop(gs, "show_debug_properties", text="Debug Properties")
flow.prop(gs, "show_framerate_profile", text="Framerate and Profile")
@ -582,14 +581,14 @@ class WORLD_PT_game_mist(WorldButtonsPanel, Panel):
world = context.world
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.prop(world.mist_settings, "start")
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):

@ -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):
bl_label = "Transparency"
# bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod

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

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

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

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

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

@ -82,6 +82,7 @@ class WORLD_PT_world(WorldButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
world = context.world
row = layout.row()
@ -111,6 +112,7 @@ class WORLD_PT_ambient_occlusion(WorldButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
light = context.world.light_settings
layout.active = light.use_ambient_occlusion
@ -130,6 +132,7 @@ class WORLD_PT_environment_lighting(WorldButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
light = context.world.light_settings
layout.active = light.use_environment_light
@ -149,6 +152,7 @@ class WORLD_PT_indirect_lighting(WorldButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
light = context.world.light_settings
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):
layout = self.layout
light = context.world.light_settings
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):
layout = self.layout
world = context.world
layout.active = world.mist_settings.use_mist
@ -250,6 +256,7 @@ class WORLD_PT_stars(WorldButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
world = context.world
layout.active = world.star_settings.use_stars

@ -115,11 +115,11 @@ class CLIP_HT_header(Header):
sub.menu("CLIP_MT_view")
if clip:
sub.menu("CLIP_MT_select")
sub.menu("CLIP_MT_clip")
sub.menu("CLIP_MT_mask")
sub.menu("MASK_MT_select")
sub.menu("CLIP_MT_clip") # XXX - remove?
sub.menu("MASK_MT_mask")
else:
sub.menu("CLIP_MT_clip")
sub.menu("CLIP_MT_clip") # XXX - remove?
row = layout.row()
row.template_ID(sc, "clip", open="clip.open")
@ -161,16 +161,6 @@ class CLIP_PT_clip_view_panel:
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:
@classmethod
@ -197,10 +187,11 @@ class CLIP_PT_tools_marker(CLIP_PT_tracking_panel, Panel):
bl_label = "Marker"
def draw(self, context):
layout = self.layout
sc = context.space_data
clip = sc.clip
settings = clip.tracking.settings
layout = self.layout
col = layout.column(align=True)
col.operator("clip.add_marker_move")
@ -302,6 +293,7 @@ class CLIP_PT_tools_solve(CLIP_PT_tracking_panel, Panel):
def draw(self, context):
layout = self.layout
clip = context.space_data.clip
tracking = clip.tracking
settings = tracking.settings
@ -422,34 +414,6 @@ class CLIP_PT_tools_object(CLIP_PT_reconstruction_panel, Panel):
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):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'TOOLS'
@ -465,7 +429,7 @@ class CLIP_PT_tools_grease_pencil(Panel):
if sc.mode == 'DISTORTION':
return sc.view == 'CLIP'
elif sc.mode == 'MASKEDIT':
elif sc.mode == 'MASK':
return True
return False
@ -520,6 +484,7 @@ class CLIP_PT_track(CLIP_PT_tracking_panel, Panel):
def draw(self, context):
layout = self.layout
sc = context.space_data
clip = context.space_data.clip
act_track = clip.tracking.tracks.active
@ -586,6 +551,7 @@ class CLIP_PT_track_settings(CLIP_PT_tracking_panel, Panel):
def draw(self, context):
layout = self.layout
clip = context.space_data.clip
settings = clip.tracking.settings
@ -661,136 +627,6 @@ class CLIP_PT_tracking_camera(Panel):
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):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'UI'
@ -835,29 +671,6 @@ class CLIP_PT_display(CLIP_PT_clip_view_panel, Panel):
row = col.row()
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):
bl_space_type = 'CLIP_EDITOR'
@ -868,7 +681,7 @@ class CLIP_PT_marker_display(CLIP_PT_clip_view_panel, Panel):
def poll(cls, context):
sc = context.space_data
return sc.mode != 'MASKEDIT'
return sc.mode != 'MASK'
def draw(self, context):
layout = self.layout
@ -973,6 +786,7 @@ class CLIP_PT_proxy(CLIP_PT_clip_view_panel, Panel):
def draw(self, context):
layout = self.layout
sc = context.space_data
clip = sc.clip
@ -1050,6 +864,7 @@ class CLIP_MT_view(Menu):
def draw(self, context):
layout = self.layout
sc = context.space_data
if sc.view == 'CLIP':
@ -1213,19 +1028,7 @@ class CLIP_MT_select(Menu):
def draw(self, context):
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_circle")
@ -1280,30 +1083,6 @@ class CLIP_MT_tracking_specials(Menu):
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):
bl_label = "Select Mode"
@ -1315,44 +1094,6 @@ class CLIP_MT_select_mode(Menu):
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):
"""Predefined tracking camera intrinsics"""
bl_label = "Camera Presets"
@ -1394,5 +1135,49 @@ class CLIP_MT_stabilize_2d_specials(Menu):
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.
bpy.utils.register_module(__name__)

@ -27,7 +27,7 @@ class ImagePaintPanel(UnifiedPaintPanel):
bl_region_type = 'UI'
class BrushButtonsPanel():
class BrushButtonsPanel:
bl_space_type = 'IMAGE_EDITOR'
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':
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()
@ -217,6 +213,7 @@ class IMAGE_MT_uvs_snap(Menu):
def draw(self, context):
layout = self.layout
layout.operator_context = 'EXEC_REGION_WIN'
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):
layout = self.layout
layout.operator_context = 'EXEC_REGION_WIN'
layout.operator("transform.mirror", text="X Axis").constraint_axis[0] = True
@ -353,10 +351,12 @@ class IMAGE_HT_header(Header):
ima = sima.image
iuser = sima.image_user
toolsettings = context.tool_settings
mode = sima.mode
show_render = sima.show_render
# show_paint = sima.show_paint
show_uvedit = sima.show_uvedit
show_maskedit = sima.show_maskedit
row = layout.row(align=True)
row.template_header()
@ -381,6 +381,8 @@ class IMAGE_HT_header(Header):
if not show_render:
layout.prop(sima, "use_image_pin", text="")
layout.prop(sima, "mode", text="")
# uv editing
if show_uvedit:
uvedit = sima.uv_editor
@ -406,13 +408,18 @@ class IMAGE_HT_header(Header):
mesh = context.edit_object.data
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:
# layers
layout.template_image_layers(ima, iuser)
# painting
layout.prop(sima, "use_image_paint", text="")
# draw options
row = layout.row(align=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'}:
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')
@ -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, "use_pressure_strength")
split = layout.split()
col = split.column()
col = layout.column()
col.prop(toolsettings, "uv_sculpt_lock_borders")
col.prop(toolsettings, "uv_sculpt_all_islands")
split = layout.split()
col = split.column()
col.prop(toolsettings, "uv_sculpt_tool")
if toolsettings.uv_sculpt_tool == 'RELAX':
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.
bpy.utils.register_module(__name__)

@ -135,7 +135,8 @@ class NODE_MT_select(Menu):
layout.operator("node.select_border")
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_to")
layout.operator("node.select_same_type")
@ -226,15 +227,20 @@ class NODE_PT_quality(bpy.types.Panel):
def draw(self, context):
layout = self.layout
snode = context.space_data
tree = snode.node_tree
layout.prop(tree, "render_quality", text="Render")
layout.prop(tree, "edit_quality", text="Edit")
layout.prop(tree, "chunk_size")
layout.prop(tree, "use_opencl")
layout.prop(tree, "two_pass")
layout.prop(snode, "show_highlight")
col = layout.column()
col.prop(tree, "render_quality", text="Render")
col.prop(tree, "edit_quality", text="Edit")
col.prop(tree, "chunk_size")
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):

@ -184,6 +184,7 @@ class SEQUENCER_MT_add(Menu):
def draw(self, context):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
if len(bpy.data.scenes) > 10:
@ -216,6 +217,7 @@ class SEQUENCER_MT_add_effect(Menu):
def draw(self, context):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
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):
layout = self.layout
render = context.scene.render
col = layout.column()

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

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

@ -79,6 +79,7 @@ class USERPREF_HT_header(Header):
def draw(self, context):
layout = self.layout
layout.template_header(menus=False)
userpref = context.user_preferences
@ -137,6 +138,7 @@ class USERPREF_MT_splash(Menu):
def draw(self, context):
layout = self.layout
split = layout.split()
row = split.row()
row.label("")
@ -850,6 +852,7 @@ class USERPREF_MT_ndof_settings(Menu):
def draw(self, context):
layout = self.layout
input_prefs = context.user_preferences.inputs
layout.separator()
@ -979,6 +982,7 @@ class USERPREF_MT_addons_dev_guides(Menu):
# menu to open web-pages with addons development guides
def draw(self, context):
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="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"
@ -1004,10 +1008,10 @@ class USERPREF_PT_addons(Panel):
@staticmethod
def is_user_addon(mod, user_addon_paths):
if not user_addon_paths:
user_script_path = bpy.utils.user_script_path()
if user_script_path is not None:
user_addon_paths.append(os.path.join(user_script_path, "addons"))
user_addon_paths.append(os.path.join(bpy.utils.resource_path('USER'), "scripts", "addons"))
for path in (bpy.utils.script_path_user(),
bpy.utils.script_path_pref()):
if path is not None:
user_addon_paths.append(os.path.join(path, "addons"))
for path in user_addon_paths:
if bpy.path.is_subdir(mod.__file__, path):

@ -64,28 +64,29 @@ class VIEW3D_HT_header(Header):
layout.template_header_3D()
if obj:
mode = obj.mode
# Particle edit
if obj.mode == 'PARTICLE_EDIT':
if mode == 'PARTICLE_EDIT':
row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True)
# 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="")
# Proportional editing
if obj.mode in {'EDIT', 'PARTICLE_EDIT'}:
if mode in {'EDIT', 'PARTICLE_EDIT'}:
row = layout.row(align=True)
row.prop(toolsettings, "proportional_edit", text="", icon_only=True)
if toolsettings.proportional_edit != 'DISABLED':
row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
elif obj.mode == 'OBJECT':
elif mode == 'OBJECT':
row = layout.row(align=True)
row.prop(toolsettings, "use_proportional_edit_objects", text="", icon_only=True)
if toolsettings.use_proportional_edit_objects:
row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
# 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
row = layout.row(align=True)
row.prop(toolsettings, "use_snap", text="")
@ -93,9 +94,9 @@ class VIEW3D_HT_header(Header):
if snap_element != 'INCREMENT':
row.prop(toolsettings, "snap_target", text="")
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="")
elif obj.mode == 'EDIT':
elif mode == 'EDIT':
row.prop(toolsettings, "use_snap_self", text="")
if snap_element == 'VOLUME':
@ -110,7 +111,7 @@ class VIEW3D_HT_header(Header):
props.animation = True
# Pose
if obj and obj.mode == 'POSE':
if obj and mode == 'POSE':
row = layout.row(align=True)
row.operator("pose.copy", text="", icon='COPYDOWN')
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
class VIEW3D_MT_transform_object(VIEW3D_MT_transform_base):
def draw(self, context):
layout = self.layout
# base menu
VIEW3D_MT_transform_base.draw(self, context)
# object-specific option follow...
layout = self.layout
layout.separator()
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
class VIEW3D_MT_transform_armature(VIEW3D_MT_transform_base):
def draw(self, context):
layout = self.layout
# base menu
VIEW3D_MT_transform_base.draw(self, context)
# armature specific extensions follow...
layout = self.layout
layout.separator()
obj = context.object
@ -429,18 +432,23 @@ class VIEW3D_MT_view_align_selected(Menu):
props = layout.operator("view3d.viewnumpad", text="Top")
props.align_active = True
props.type = 'TOP'
props = layout.operator("view3d.viewnumpad", text="Bottom")
props.align_active = True
props.type = 'BOTTOM'
props = layout.operator("view3d.viewnumpad", text="Front")
props.align_active = True
props.type = 'FRONT'
props = layout.operator("view3d.viewnumpad", text="Back")
props.align_active = True
props.type = 'BACK'
props = layout.operator("view3d.viewnumpad", text="Right")
props.align_active = True
props.type = 'RIGHT'
props = layout.operator("view3d.viewnumpad", text="Left")
props.align_active = True
props.type = 'LEFT'
@ -1191,6 +1199,7 @@ class VIEW3D_MT_vertex_group(Menu):
def draw(self, context):
layout = self.layout
layout.operator_context = 'EXEC_AREA'
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):
layout = self.layout
particle_edit = context.tool_settings.particle_edit
layout.operator("particle.rekey")
@ -1792,6 +1802,7 @@ class VIEW3D_MT_edit_mesh_edges(Menu):
def draw(self, context):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("mesh.edge_face_add")
@ -1844,6 +1855,7 @@ class VIEW3D_MT_edit_mesh_faces(Menu):
def draw(self, context):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("mesh.flip_normals")
@ -2644,6 +2656,7 @@ class VIEW3D_PT_etch_a_ton(Panel):
def draw(self, context):
layout = self.layout
toolsettings = context.scene.tool_settings
col = layout.column()

@ -1124,6 +1124,7 @@ class VIEW3D_MT_tools_projectpaint_clone(Menu):
def draw(self, context):
layout = self.layout
for i, tex in enumerate(context.active_object.data.uv_textures):
props = layout.operator("wm.context_set_int", text=tex.name)
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 */
if (frame_num + 1 > movie->index_entries) {
temp = (AviIndexEntry *) MEM_mallocN((frame_num + 1) *
(movie->header->Streams + 1) * sizeof(AviIndexEntry), "newidxentry");
const size_t entry_size = (movie->header->Streams + 1) * sizeof(AviIndexEntry);
if (movie->entries != NULL) {
memcpy(temp, movie->entries, movie->index_entries * (movie->header->Streams + 1) * sizeof(AviIndexEntry));
MEM_freeN(movie->entries);
temp = (AviIndexEntry *)MEM_reallocN(movie->entries, (frame_num + 1) * entry_size);
/* 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;

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

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

@ -61,12 +61,14 @@ DerivedMesh *CDDM_from_BMEditMesh(struct BMEditMesh *em, struct Mesh *me, int us
/* merge verts */
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 */
struct DerivedMesh *CDDM_from_curve(struct Object *ob);
/* creates a CDDerivedMesh from the given curve object and specified dispbase */
/* 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
* custom element data.

@ -122,12 +122,16 @@ void BKE_mask_point_select_set_handle(struct MaskSplinePoint *point, const short
/* general */
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_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_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_frame(float r_co[2], const float co[2], const float frame_size[2]);
/* 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);
/* rasterization */
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_KNOT(p) ( (p)->bezt.f2 & SELECT)
#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_DESEL_HANDLE(p) { (p)->bezt.f1 &= ~SELECT; (p)->bezt.f3 &= ~SELECT; } (void)0
/* disable to test alternate rasterizer */
/* #define USE_RASKTER */
#define MASK_RESOL_MAX 128
/* mask_rasterize.c */
#ifndef USE_RASKTER
struct 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_feather);
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__ */

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