soc-2008-mxcurioni: merged changes to revision 14967

This commit is contained in:
Maxime Curioni 2008-05-25 18:28:52 +00:00
commit 59df5a23b4
132 changed files with 2276 additions and 2083 deletions

@ -871,12 +871,25 @@ static int EnumPixelFormats(HDC hdc) {
for(i=1; i<=n; i++) { /* not the idiom, but it's right */
::DescribePixelFormat( hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd );
w = WeightPixelFormat(pfd);
if(w > weight) {
weight = w;
iPixelFormat = i;
// be strict on stereo
if (!((sPreferredFormat.dwFlags ^ pfd.dwFlags) & PFD_STEREO)) {
if(w > weight) {
weight = w;
iPixelFormat = i;
}
}
}
if (weight == 0) {
// we could find the correct stereo setting, just find any suitable format
for(i=1; i<=n; i++) { /* not the idiom, but it's right */
::DescribePixelFormat( hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd );
w = WeightPixelFormat(pfd);
if(w > weight) {
weight = w;
iPixelFormat = i;
}
}
}
return iPixelFormat;
}

@ -1 +1 @@
2.44
2.46

@ -419,7 +419,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
ob.setMatrix(contextMatrix_rot)
importedObjects.append(ob)
bmesh.calcNormals()
for matName, faces in myContextMeshMaterials.iteritems():
makeMeshMaterialCopy(matName, faces)
@ -664,9 +664,8 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
#print contextLamp.name,
elif (new_chunk.ID==OBJECT_MESH):
## @@ PATCH
print 'Found an OBJECT_MESH chunk'
# print 'Found an OBJECT_MESH chunk'
pass
elif (new_chunk.ID==OBJECT_VERTICES):
'''
Worldspace vertex locations

File diff suppressed because it is too large Load Diff

@ -1101,12 +1101,12 @@ def write(filename, batch_objects = None, \
file.write('\n\t\t\tProperty: "ShadingModel", "KString", "", "%s"' % mat_shader)
file.write('\n\t\t\tProperty: "MultiLayer", "bool", "",0')
file.write('\n\t\t\tProperty: "EmissiveColor", "ColorRGB", "",%.4f,%.4f,%.4f' % mat_cold) # emit and diffuse color are he same in blender
file.write('\n\t\t\tProperty: "EmissiveFactor", "double", "",%.4f' % mat_dif)
file.write('\n\t\t\tProperty: "EmissiveFactor", "double", "",%.4f' % mat_emit)
file.write('\n\t\t\tProperty: "AmbientColor", "ColorRGB", "",%.4f,%.4f,%.4f' % mat_colamb)
file.write('\n\t\t\tProperty: "AmbientFactor", "double", "",%.4f' % mat_amb)
file.write('\n\t\t\tProperty: "DiffuseColor", "ColorRGB", "",%.4f,%.4f,%.4f' % mat_cold)
file.write('\n\t\t\tProperty: "DiffuseFactor", "double", "",%.4f' % mat_emit)
file.write('\n\t\t\tProperty: "DiffuseFactor", "double", "",%.4f' % mat_dif)
file.write('\n\t\t\tProperty: "Bump", "Vector3D", "",0,0,0')
file.write('\n\t\t\tProperty: "TransparentColor", "ColorRGB", "",1,1,1')
file.write('\n\t\t\tProperty: "TransparencyFactor", "double", "",%.4f' % (1.0 - mat_alpha))

@ -44,6 +44,8 @@ from flt_filewalker import FltOut
from flt_filewalker import FileFinder
from flt_properties import *
import shutil
import trace
import sys
FF = FileFinder()
records = process_recordDefs()
@ -639,18 +641,35 @@ class FLTNode(Node):
#first pass: do open faces
for vert in wireverts:
if not visited[vert] and vertuse[vert.index][1] == 1:
visited[vert] = True
loop = [vert]
othervert = edge_get_othervert(vert, disk[vert][0])
self.vertwalk(othervert, loop, disk, visited)
loop = list()
done = 0
startvert = vert
while not done:
done = 1
visited[startvert] = True
loop.append(startvert)
for edge in disk[startvert]:
othervert = edge_get_othervert(startvert, edge)
if not visited[othervert]:
done = 0
startvert = othervert
break
if len(loop) > 2: loops.append( ('Open', loop) )
for vert in wireverts:
if not visited[vert]:
visited[vert] = True
loop = [vert]
othervert = edge_get_othervert(vert,disk[vert][0])
self.vertwalk(othervert, loop, disk, visited)
loop = list()
done = 0
startvert = vert
while not done:
done = 1
visited[startvert] = True
loop.append(startvert)
for edge in disk[startvert]:
othervert = edge_get_othervert(startvert,edge)
if not visited[othervert]:
done = 0
startvert = othervert
break
if len(loop) > 2: loops.append( ('closed', loop) )
#now go through the loops and append.
@ -666,6 +685,8 @@ class FLTNode(Node):
face_desc.color_index = 227
self.face_lst.append(face_desc)
def sortFLTFaces(self,a,b):
aindex = a.getProperty("FLT_ORIGINDEX")
bindex = b.getProperty("FLT_ORIGINDEX")
@ -1441,6 +1462,9 @@ FLTXAPPChooser = None
FLTAttrib = None
FLTWarn = None
def setshadingangle(ID,val):
global options
options.state['shading_default'] = val
@ -1504,6 +1528,8 @@ def but_event(evt):
global FLTAttrib
global FLTWarn
#choose base path for export
if evt == 4:
Blender.Window.FileSelector(setBpath, "DB Root", options.state['basepath'])
@ -1538,7 +1564,12 @@ def but_event(evt):
#Export DB
if evt == 1:
dbexport()
try:
dbexport()
except Exception, inst:
import traceback
FLTWarn = Draw.PupBlock("Export Error", ["See console for output!"])
traceback.print_exception(sys.exc_type, sys.exc_value, sys.exc_traceback)
#exit
if evt == 2:

@ -16,7 +16,7 @@ This script imports OpenFlight files into Blender. OpenFlight is a
registered trademark of MultiGen-Paradigm, Inc.
Feature overview and more availible at:
http://wiki.blender.org/index.php/Scripts/Manual/Import/openflight_flt
http://wiki.blender.org/index.php/Scripts/Manual/Import/openflight_fltss
Note: This file is a grab-bag of old and new code. It needs some cleanup still.
"""
@ -44,6 +44,7 @@ import BPyMesh
import BPyImage
import flt_filewalker
import flt_properties
import sys
reload(flt_properties)
from flt_properties import *
@ -61,6 +62,7 @@ FLTDoXRef = None
FLTScale = None
FLTShadeImport = None
FLTAttrib = None
FLTWarn = None
Vector= Blender.Mathutils.Vector
FLOAT_TOLERANCE = 0.01
@ -890,6 +892,17 @@ class InterNode(Node):
return weldmesh
def weldFuseFaces(self,weldmesh):
#retain original loose vertices
looseverts = dict()
for vert in self.mesh.verts:
looseverts[vert] = 0
for edge in self.mesh.edges:
looseverts[edge.v1] += 1
looseverts[edge.v2] += 1
#slight modification here: we need to walk around the mesh as many times as it takes to have no more matches
done = 0
while not done:
@ -937,7 +950,7 @@ class InterNode(Node):
vertuse[vert] += 1
delverts = list()
for vert in self.mesh.verts:
if not vertuse[vert] and vert.index != 0:
if not vertuse[vert] and vert.index != 0 and looseverts[vert]:
delverts.append(vert)
self.mesh.verts.delete(delverts)
@ -1024,8 +1037,9 @@ class InterNode(Node):
else: # fgon
mesh_face_indicies = [i+vert_index for i in xrange(face_len)]
tri_ngons= ngon(self.mesh, mesh_face_indicies)
new_faces.extend([ [mesh_face_indicies[t] for t in tri] for tri in tri_ngons])
new_faces_props.extend( [ (None, image, (uvs[tri[0]], uvs[tri[1]], uvs[tri[2]]), [flt_face.uverts[tri[0]], flt_face.uverts[tri[1]], flt_face.uverts[tri[2]]], flt_face.uvlayers, flt_face.color_index, flt_face.props,FLT_OrigIndex,1, flt_face.subfacelevel) for tri in tri_ngons ])
if len(tri_ngons) != 1:
new_faces.extend([ [mesh_face_indicies[t] for t in tri] for tri in tri_ngons])
new_faces_props.extend( [ (None, image, (uvs[tri[0]], uvs[tri[1]], uvs[tri[2]]), [flt_face.uverts[tri[0]], flt_face.uverts[tri[1]], flt_face.uverts[tri[2]]], flt_face.uvlayers, flt_face.color_index, flt_face.props,FLT_OrigIndex,1, flt_face.subfacelevel) for tri in tri_ngons ])
vert_index+= face_len
FLT_OrigIndex+=1
@ -2284,7 +2298,6 @@ def fixscale(root,childhash):
for v in rmesh.verts:
v.co = v.co * smat
def reparent(root,childhash,sce):
for child in childhash[root]:
reparent(child,childhash,sce)
@ -2405,6 +2418,10 @@ def setBpath(fname):
def event(evt,val):
pass
from Blender.BGL import *
from Blender import Draw
def but_event(evt):
global FLTBaseLabel
@ -2418,6 +2435,8 @@ def but_event(evt):
global FLTShadeImport
global FLTAttrib
global FLTWarn
#Import DB
if evt == 1:
if global_prefs['verbose'] >= 1:
@ -2429,7 +2448,14 @@ def but_event(evt):
print
GRR = GlobalResourceRepository()
select_file(global_prefs['fltfile'], GRR)
try:
select_file(global_prefs['fltfile'], GRR)
except:
import traceback
FLTWarn = Draw.PupBlock("Ixport Error", ["See console for output!"])
traceback.print_exception(sys.exc_type, sys.exc_value, sys.exc_traceback)
#choose base path for export
if evt == 4:
Blender.Window.FileSelector(setBpath, "DB Root", global_prefs['fltfile'])
@ -2451,9 +2477,6 @@ def but_event(evt):
d[key] = global_prefs[key]
Blender.Registry.SetKey('flt_import', d, 1)
from Blender.BGL import *
from Blender import Draw
def gui():
global FLTBaseLabel

@ -328,6 +328,9 @@ PREF_MARGIN_DIV= 512):
if curr_len/4 < side_len/PREF_MARGIN_DIV:
break
if not lengths:
lengths.append(curr_len)
# convert into ints
lengths_to_ints = {}
@ -517,7 +520,7 @@ def main():
if not Draw.PupBlock('Lightmap Pack', [\
'Context...',
('Active Object', PREF_ACT_ONLY, 'If disabled, use all objects for packing the lightmap.'),\
('Active Object', PREF_ACT_ONLY, 'If disabled, include other selected objects for packing the lightmap.'),\
('Selected Faces', PREF_SEL_ONLY, 'Use only selected faces from all selected meshes.'),\
'Image & UVs...',
('Share Tex Space', PREF_PACK_IN_ONE, 'Objects Share texture space, map all objects into 1 uvmap'),\
@ -538,7 +541,7 @@ def main():
return
meshes = [ ob.getData(mesh=1) ]
else:
meshes = dict([ (me.name, me) for ob in scn.objects.context for me in (ob.getData(mesh=1),) if not me.lib])
meshes = dict([ (me.name, me) for ob in scn.objects.context if ob.type == 'Mesh' for me in (ob.getData(mesh=1),) if not me.lib if len(me.faces)])
meshes = meshes.values()
if not meshes:
Draw.PupMenu('Error%t|No mesh objects selected.')

@ -40,11 +40,11 @@ extern "C" {
struct ListBase;
struct MemFile;
#define BLENDER_VERSION 245
#define BLENDER_SUBVERSION 17
#define BLENDER_VERSION 246
#define BLENDER_SUBVERSION 0
#define BLENDER_MINVERSION 240
#define BLENDER_MINSUBVERSION 0
#define BLENDER_MINVERSION 245
#define BLENDER_MINSUBVERSION 15
int BKE_read_file(char *dir, void *type_r);
int BKE_read_file_from_memory(char* filebuf, int filelength, void *type_r);

@ -171,4 +171,9 @@ void IDP_FreeProperty(struct IDProperty *prop);
/*Unlinks any struct IDProperty<->ID linkage that might be going on.*/
void IDP_UnlinkProperty(struct IDProperty *prop);
#define IDP_Int(prop) (prop->data.val)
#define IDP_Float(prop) (*(float*)&prop->data.val)
#define IDP_String(prop) ((char*)prop->data.pointer)
#define IDP_Array(prop) (prop->data.pointer)
#endif /* _BKE_IDPROP_H */

@ -91,7 +91,6 @@ typedef struct process { /* parameters, function, storage */
float (*function)(float, float, float);
float size, delta; /* cube size, normal delta */
int bounds; /* cube range within lattice */
MB_POINT start; /* start point on surface */
CUBES *cubes; /* active cubes */
VERTICES vertices; /* surface vertices */
CENTERLIST **centers; /* cube center hash table */
@ -151,7 +150,7 @@ void add_cube(PROCESS *mbproc, int i, int j, int k, int count);
void find_first_points(PROCESS *mbproc, struct MetaBall *mb, int a);
void fill_metaball_octal_node(octal_node *node, struct MetaElem *ml, short i);
void subdivide_metaball_octal_node(octal_node *node, float *size, short depth);
void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y, float size_z, short depth);
void free_metaball_octal_node(octal_node *node);
void init_metaball_octal_tree(int depth);
void polygonize(PROCESS *mbproc, struct MetaBall *mb);

@ -43,6 +43,7 @@ extern "C" {
#define FFMPEG_H264 6
#define FFMPEG_XVID 7
#define FFMPEG_FLV 8
#define FFMPEG_MKV 9
#define FFMPEG_CODEC_MPEG1 0
#define FFMPEG_CODEC_MPEG2 1
@ -58,6 +59,7 @@ extern "C" {
#define FFMPEG_PRESET_SVCD 2
#define FFMPEG_PRESET_VCD 3
#define FFMPEG_PRESET_DV 4
#define FFMPEG_PRESET_H264 5
struct RenderData;

@ -621,7 +621,8 @@ void BKE_write_undo(char *name)
}
}
/* 1= an undo, -1 is a redo. we have to make sure 'curundo' remains at current situation */
/* 1= an undo, -1 is a redo. we have to make sure 'curundo' remains at current situation
* Note, ALWAYS call sound_initialize_sounds after BKE_undo_step() */
void BKE_undo_step(int step)
{

@ -583,7 +583,7 @@ static void basisNurb(float t, short order, short pnts, float *knots, float *bas
/* this is for float inaccuracy */
if(t < knots[0]) t= knots[0];
else if(t > knots[opp2]) t= knots[opp2]; /* Valgrind reports an error here, use a nurbs torus and change u/v res to reproduce a crash TODO*/
else if(t > knots[opp2]) t= knots[opp2];
/* this part is order '1' */
o2 = order + 1;
@ -1476,7 +1476,9 @@ void makeBevelList(Object *ob)
else nu= cu->nurb.first;
while(nu) {
if(nu->pntsu<=1) {
/* check we are a single point? also check we are not a surface and that the orderu is sane,
* enforced in the UI but can go wrong possibly */
if(nu->pntsu<2 || ((nu->type & 7)==CU_NURBS && nu->pntsu < nu->orderu)) {
bl= MEM_callocN(sizeof(BevList)+1*sizeof(BevPoint), "makeBevelList");
BLI_addtail(&(cu->bev), bl);
bl->nr= 0;

@ -1241,7 +1241,8 @@ void CustomData_em_copy_data(const CustomData *source, CustomData *dest,
if(dest_i >= dest->totlayer) return;
/* if we found a matching layer, copy the data */
if(dest->layers[dest_i].type == source->layers[src_i].type) {
if(dest->layers[dest_i].type == source->layers[src_i].type &&
strcmp(dest->layers[dest_i].name, source->layers[src_i].name) == 0) {
char *src_data = (char*)src_block + source->layers[src_i].offset;
char *dest_data = (char*)*dest_block + dest->layers[dest_i].offset;

@ -783,7 +783,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase)
else
resolu= nu->resolu;
if(nu->pntsu<2);
if(nu->pntsu<2 || ((nu->type & 7)==CU_NURBS && nu->pntsu < nu->orderu));
else if((nu->type & 7)==CU_BEZIER) {
/* count */
@ -1171,7 +1171,7 @@ static ModifierData *curve_get_tesselate_point(Object *ob, int forRender, int ed
if ((md->mode & required_mode) != required_mode) continue;
if (mti->isDisabled && mti->isDisabled(md)) continue;
if (md->type==eModifierType_Hook || md->type==eModifierType_Softbody) {
if (ELEM3(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) {
preTesselatePoint = md;
}
}

@ -989,8 +989,11 @@ static void stampdata(StampData *stamp_data, int do_prefix)
}
if (G.scene->r.stamp & R_STAMP_CAMERA) {
if (do_prefix) sprintf(stamp_data->camera, "Camera %s", ((Camera *) G.scene->camera)->id.name+2);
else sprintf(stamp_data->camera, "%s", ((Camera *) G.scene->camera)->id.name+2);
if (G.scene->camera) strcpy(text, ((Camera *) G.scene->camera)->id.name+2);
else strcpy(text, "<none>");
if (do_prefix) sprintf(stamp_data->camera, "Camera %s", text);
else sprintf(stamp_data->camera, "%s", text);
} else {
stamp_data->camera[0] = '\0';
}
@ -1721,31 +1724,38 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser)
{
RenderResult *rr= RE_GetResult(RE_GetRender(G.scene->id.name));
if(rr && iuser) {
if(rr) {
RenderResult rres;
float *rectf;
unsigned int *rect;
int channels= 4, layer= iuser->layer;
float dither;
int channels, layer, pass;
channels= 4;
layer= (iuser)? iuser->layer: 0;
pass= (iuser)? iuser->pass: 0;
/* this gives active layer, composite or seqence result */
RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres);
rect= (unsigned int *)rres.rect32;
rectf= rres.rectf;
dither= G.scene->r.dither_intensity;
/* get compo/seq result by default */
if(rr->rectf && layer==0);
else if(rr->layers.first) {
RenderLayer *rl= BLI_findlink(&rr->layers, iuser->layer-(rr->rectf?1:0));
RenderLayer *rl= BLI_findlink(&rr->layers, layer-(rr->rectf?1:0));
if(rl) {
/* there's no combined pass, is in renderlayer itself */
if(iuser->pass==0) {
if(pass==0) {
rectf= rl->rectf;
}
else {
RenderPass *rpass= BLI_findlink(&rl->passes, iuser->pass-1);
RenderPass *rpass= BLI_findlink(&rl->passes, pass-1);
if(rpass) {
channels= rpass->channels;
rectf= rpass->rect;
dither= 0.0f; /* don't dither passes */
}
}
}
@ -1772,6 +1782,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser)
ibuf->channels= channels;
ibuf->zbuf_float= rres.rectz;
ibuf->flags |= IB_zbuffloat;
ibuf->dither= dither;
ima->ok= IMA_OK_LOADED;
return ibuf;

@ -375,7 +375,7 @@ Object *find_basis_mball(Object *basis)
#define RTF 7 /* right top far corner */
/* the LBN corner of cube (i, j, k), corresponds with location
* (start.x+(i-0.5)*size, start.y+(j-0.5)*size, start.z+(k-0.5)*size) */
* (i-0.5)*size, (j-0.5)*size, (k-0.5)*size) */
#define HASHBIT (5)
#define HASHSIZE (size_t)(1<<(3*HASHBIT)) /*! < hash table size (32768) */
@ -836,11 +836,11 @@ CORNER *setcorner (PROCESS* p, int i, int j, int k)
c = (CORNER *) new_pgn_element(sizeof(CORNER));
c->i = i;
c->x = p->start.x+((float)i-0.5f)*p->size;
c->x = ((float)i-0.5f)*p->size;
c->j = j;
c->y = p->start.y+((float)j-0.5f)*p->size;
c->y = ((float)j-0.5f)*p->size;
c->k = k;
c->z = p->start.z+((float)k-0.5f)*p->size;
c->z = ((float)k-0.5f)*p->size;
c->value = p->function(c->x, c->y, c->z);
c->next = p->corners[index];
@ -1373,39 +1373,38 @@ void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
nz = abs((out.z - in.z)/mbproc->size);
MAXN = MAX3(nx,ny,nz);
if(MAXN!=0.0f) {
dx = (out.x - in.x)/MAXN;
dy = (out.y - in.y)/MAXN;
dz = (out.z - in.z)/MAXN;
dx = (out.x - in.x)/MAXN;
dy = (out.y - in.y)/MAXN;
dz = (out.z - in.z)/MAXN;
len = 0.0;
while(len<=max_len) {
workp.x += dx;
workp.y += dy;
workp.z += dz;
/* compute value of implicite function */
tmp_v = mbproc->function(workp.x, workp.y, workp.z);
/* add cube to the stack, when value of implicite function crosses zero value */
if((tmp_v<0.0 && workp_v>=0.0)||(tmp_v>0.0 && workp_v<=0.0)) {
len = 0.0;
while(len<=max_len) {
workp.x += dx;
workp.y += dy;
workp.z += dz;
/* compute value of implicite function */
tmp_v = mbproc->function(workp.x, workp.y, workp.z);
/* add cube to the stack, when value of implicite function crosses zero value */
if((tmp_v<0.0 && workp_v>=0.0)||(tmp_v>0.0 && workp_v<=0.0)) {
/* indexes of CUBE, which includes "first point" */
c_i= (int)floor(workp.x/mbproc->size);
c_j= (int)floor(workp.y/mbproc->size);
c_k= (int)floor(workp.z/mbproc->size);
/* indexes of CUBE, which includes "first point" */
c_i= (int)floor(workp.x/mbproc->size);
c_j= (int)floor(workp.y/mbproc->size);
c_k= (int)floor(workp.z/mbproc->size);
/* add CUBE (with indexes c_i, c_j, c_k) to the stack,
* this cube includes found point of Implicit Surface */
if (ml->flag & MB_NEGATIVE)
add_cube(mbproc, c_i, c_j, c_k, 2);
else
add_cube(mbproc, c_i, c_j, c_k, 1);
}
len = sqrt((workp.x-in.x)*(workp.x-in.x) + (workp.y-in.y)*(workp.y-in.y) + (workp.z-in.z)*(workp.z-in.z));
workp_v = tmp_v;
/* add CUBE (with indexes c_i, c_j, c_k) to the stack,
* this cube includes found point of Implicit Surface */
if (ml->flag & MB_NEGATIVE)
add_cube(mbproc, c_i, c_j, c_k, 2);
else
add_cube(mbproc, c_i, c_j, c_k, 1);
}
len = sqrt((workp.x-in.x)*(workp.x-in.x) + (workp.y-in.y)*(workp.y-in.y) + (workp.z-in.z)*(workp.z-in.z));
workp_v = tmp_v;
}
mbproc->start.x= mbproc->start.y= mbproc->start.z= 0.0;
}
}
}
@ -1710,15 +1709,13 @@ void fill_metaball_octal_node(octal_node *node, MetaElem *ml, short i)
* +------+------+
*
*/
void subdivide_metaball_octal_node(octal_node *node, float *size, short depth)
void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y, float size_z, short depth)
{
MetaElem *ml;
ml_pointer *ml_p;
float x,y,z;
int a,i;
if(depth==0) return;
/* create new nodes */
for(a=0;a<8;a++){
node->nodes[a]= MEM_mallocN(sizeof(octal_node),"octal_node");
@ -1732,45 +1729,71 @@ void subdivide_metaball_octal_node(octal_node *node, float *size, short depth)
node->nodes[a]->pos= 0;
}
size[0]/=2; size[1]/=2; size[2]/=2;
size_x /= 2;
size_y /= 2;
size_z /= 2;
/* center of node */
node->x= x= node->x_min + size[0];
node->y= y= node->y_min + size[1];
node->z= z= node->z_min + size[2];
node->x = x = node->x_min + size_x;
node->y = y = node->y_min + size_y;
node->z = z = node->z_min + size_z;
/* setting up of border points of new nodes */
node->nodes[0]->x_min= node->x_min;
node->nodes[0]->y_min= node->y_min;
node->nodes[0]->z_min= node->z_min;
node->nodes[0]->x_min = node->x_min;
node->nodes[0]->y_min = node->y_min;
node->nodes[0]->z_min = node->z_min;
node->nodes[0]->x = node->nodes[0]->x_min + size_x/2;
node->nodes[0]->y = node->nodes[0]->y_min + size_y/2;
node->nodes[0]->z = node->nodes[0]->z_min + size_z/2;
node->nodes[1]->x_min= x;
node->nodes[1]->y_min= node->y_min;
node->nodes[1]->z_min= node->z_min;
node->nodes[1]->x_min = x;
node->nodes[1]->y_min = node->y_min;
node->nodes[1]->z_min = node->z_min;
node->nodes[1]->x = node->nodes[1]->x_min + size_x/2;
node->nodes[1]->y = node->nodes[1]->y_min + size_y/2;
node->nodes[1]->z = node->nodes[1]->z_min + size_z/2;
node->nodes[2]->x_min= x;
node->nodes[2]->y_min= y;
node->nodes[2]->z_min= node->z_min;
node->nodes[2]->x_min = x;
node->nodes[2]->y_min = y;
node->nodes[2]->z_min = node->z_min;
node->nodes[2]->x = node->nodes[2]->x_min + size_x/2;
node->nodes[2]->y = node->nodes[2]->y_min + size_y/2;
node->nodes[2]->z = node->nodes[2]->z_min + size_z/2;
node->nodes[3]->x_min= node->x_min;
node->nodes[3]->y_min= y;
node->nodes[3]->z_min= node->z_min;
node->nodes[3]->x_min = node->x_min;
node->nodes[3]->y_min = y;
node->nodes[3]->z_min = node->z_min;
node->nodes[3]->x = node->nodes[3]->x_min + size_x/2;
node->nodes[3]->y = node->nodes[3]->y_min + size_y/2;
node->nodes[3]->z = node->nodes[3]->z_min + size_z/2;
node->nodes[4]->x_min= node->x_min;
node->nodes[4]->y_min= node->y_min;
node->nodes[4]->z_min= z;
node->nodes[4]->x_min = node->x_min;
node->nodes[4]->y_min = node->y_min;
node->nodes[4]->z_min = z;
node->nodes[4]->x = node->nodes[4]->x_min + size_x/2;
node->nodes[4]->y = node->nodes[4]->y_min + size_y/2;
node->nodes[4]->z = node->nodes[4]->z_min + size_z/2;
node->nodes[5]->x_min= x;
node->nodes[5]->y_min= node->y_min;
node->nodes[5]->z_min= z;
node->nodes[5]->x_min = x;
node->nodes[5]->y_min = node->y_min;
node->nodes[5]->z_min = z;
node->nodes[5]->x = node->nodes[5]->x_min + size_x/2;
node->nodes[5]->y = node->nodes[5]->y_min + size_y/2;
node->nodes[5]->z = node->nodes[5]->z_min + size_z/2;
node->nodes[6]->x_min= x;
node->nodes[6]->y_min= y;
node->nodes[6]->z_min= z;
node->nodes[6]->x_min = x;
node->nodes[6]->y_min = y;
node->nodes[6]->z_min = z;
node->nodes[6]->x = node->nodes[6]->x_min + size_x/2;
node->nodes[6]->y = node->nodes[6]->y_min + size_y/2;
node->nodes[6]->z = node->nodes[6]->z_min + size_z/2;
node->nodes[7]->x_min= node->x_min;
node->nodes[7]->y_min= y;
node->nodes[7]->z_min= z;
node->nodes[7]->x_min = node->x_min;
node->nodes[7]->y_min = y;
node->nodes[7]->z_min = z;
node->nodes[7]->x = node->nodes[7]->x_min + size_x/2;
node->nodes[7]->y = node->nodes[7]->y_min + size_y/2;
node->nodes[7]->z = node->nodes[7]->z_min + size_z/2;
ml_p= node->elems.first;
@ -1937,7 +1960,7 @@ void subdivide_metaball_octal_node(octal_node *node, float *size, short depth)
if(depth>0){
for(a=0;a<8;a++){
if(node->nodes[a]->count > 0) /* if node is not empty, then it is subdivided */
subdivide_metaball_octal_node(node->nodes[a], size, depth);
subdivide_metaball_octal_node(node->nodes[a], size_x, size_y, size_z, depth);
}
}
}
@ -2009,7 +2032,7 @@ void init_metaball_octal_tree(int depth)
size[2]= node->z_max - node->z_min;
/* first node is subdivided recursively */
subdivide_metaball_octal_node(node, size, metaball_tree->depth);
subdivide_metaball_octal_node(node, size[0], size[1], size[2], metaball_tree->depth);
}
void metaball_polygonize(Object *ob)

@ -1248,7 +1248,8 @@ static DerivedMesh *arrayModifier_applyModifier(
result = arrayModifier_doArray(amd, ob, derivedData, 0);
CDDM_calc_normals(result);
if(result != derivedData)
CDDM_calc_normals(result);
return result;
}
@ -2674,7 +2675,8 @@ static DerivedMesh *edgesplitModifier_applyModifier(
result = edgesplitModifier_do(emd, ob, derivedData);
CDDM_calc_normals(result);
if(result != derivedData)
CDDM_calc_normals(result);
return result;
}
@ -5995,20 +5997,29 @@ static void explodeModifier_createFacepa(ExplodeModifierData *emd,
if(vertpa) MEM_freeN(vertpa);
BLI_kdtree_free(tree);
}
static int edgesplit_get(EdgeHash *edgehash, int v1, int v2)
{
return GET_INT_FROM_POINTER(BLI_edgehash_lookup(edgehash, v1, v2));
}
static DerivedMesh * explodeModifier_splitEdges(ExplodeModifierData *emd, DerivedMesh *dm){
DerivedMesh *splitdm;
MFace *mf=0,*df1=0,*df2=0,*df3=0;
MFace *mface=CDDM_get_faces(dm);
MVert *dupve, *mv;
EdgeHash *edgehash;
EdgeHashIterator *ehi;
int totvert=dm->getNumVerts(dm);
int totface=dm->getNumFaces(dm);
int *edgesplit = MEM_callocN(sizeof(int)*totvert*totvert,"explode_edgesplit");
int *facesplit = MEM_callocN(sizeof(int)*totface,"explode_edgesplit");
int *facesplit = MEM_callocN(sizeof(int)*totface,"explode_facesplit");
int *vertpa = MEM_callocN(sizeof(int)*totvert,"explode_vertpa2");
int *facepa = emd->facepa;
int *fs, totesplit=0,totfsplit=0,totin=0,curdupvert=0,curdupface=0,curdupin=0;
int i,j,v1,v2,v3,v4;
int i,j,v1,v2,v3,v4,esplit;
edgehash= BLI_edgehash_new();
/* recreate vertpa from facepa calculation */
for (i=0,mf=mface; i<totface; i++,mf++) {
@ -6028,22 +6039,22 @@ static DerivedMesh * explodeModifier_splitEdges(ExplodeModifierData *emd, Derive
v4=vertpa[mf->v4];
if(v1!=v2){
edgesplit[mf->v1*totvert+mf->v2]=edgesplit[mf->v2*totvert+mf->v1]=1;
BLI_edgehash_insert(edgehash, mf->v1, mf->v2, NULL);
(*fs)++;
}
if(v2!=v3){
edgesplit[mf->v2*totvert+mf->v3]=edgesplit[mf->v3*totvert+mf->v2]=1;
BLI_edgehash_insert(edgehash, mf->v2, mf->v3, NULL);
(*fs)++;
}
if(v3!=v4){
edgesplit[mf->v3*totvert+mf->v4]=edgesplit[mf->v4*totvert+mf->v3]=1;
BLI_edgehash_insert(edgehash, mf->v3, mf->v4, NULL);
(*fs)++;
}
if(v1!=v4){
edgesplit[mf->v1*totvert+mf->v4]=edgesplit[mf->v4*totvert+mf->v1]=1;
BLI_edgehash_insert(edgehash, mf->v1, mf->v4, NULL);
(*fs)++;
}
@ -6052,28 +6063,29 @@ static DerivedMesh * explodeModifier_splitEdges(ExplodeModifierData *emd, Derive
*fs=1;
else if(v1!=v2){
if(v1!=v4)
edgesplit[mf->v2*totvert+mf->v3]=edgesplit[mf->v3*totvert+mf->v2]=1;
BLI_edgehash_insert(edgehash, mf->v2, mf->v3, NULL);
else
edgesplit[mf->v3*totvert+mf->v4]=edgesplit[mf->v4*totvert+mf->v3]=1;
BLI_edgehash_insert(edgehash, mf->v3, mf->v4, NULL);
}
else{
if(v1!=v4)
edgesplit[mf->v1*totvert+mf->v2]=edgesplit[mf->v2*totvert+mf->v1]=1;
BLI_edgehash_insert(edgehash, mf->v1, mf->v2, NULL);
else
edgesplit[mf->v1*totvert+mf->v4]=edgesplit[mf->v4*totvert+mf->v1]=1;
BLI_edgehash_insert(edgehash, mf->v1, mf->v4, NULL);
}
}
}
}
/* count splits & reindex */
ehi= BLI_edgehashIterator_new(edgehash);
totesplit=totvert;
for(j=0; j<totvert; j++){
for(i=j+1; i<totvert; i++){
if(edgesplit[j*totvert+i])
edgesplit[j*totvert+i]=edgesplit[i*totvert+j]=totesplit++;
}
for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
BLI_edgehashIterator_setValue(ehi, SET_INT_IN_POINTER(totesplit));
totesplit++;
}
BLI_edgehashIterator_free(ehi);
/* count new faces due to splitting */
for(i=0,fs=facesplit; i<totface; i++,fs++){
if(*fs==1)
@ -6121,23 +6133,23 @@ static DerivedMesh * explodeModifier_splitEdges(ExplodeModifierData *emd, Derive
/* create new verts */
curdupvert=totvert;
for(j=0; j<totvert; j++){
for(i=j+1; i<totvert; i++){
if(edgesplit[j*totvert+i]){
mv=CDDM_get_vert(splitdm,j);
dupve=CDDM_get_vert(splitdm,edgesplit[j*totvert+i]);
ehi= BLI_edgehashIterator_new(edgehash);
for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
BLI_edgehashIterator_getKey(ehi, &i, &j);
esplit= GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi));
mv=CDDM_get_vert(splitdm,j);
dupve=CDDM_get_vert(splitdm,esplit);
DM_copy_vert_data(splitdm,splitdm,j,edgesplit[j*totvert+i],1);
DM_copy_vert_data(splitdm,splitdm,j,esplit,1);
*dupve=*mv;
*dupve=*mv;
mv=CDDM_get_vert(splitdm,i);
mv=CDDM_get_vert(splitdm,i);
VECADD(dupve->co,dupve->co,mv->co);
VecMulf(dupve->co,0.5);
}
}
VECADD(dupve->co,dupve->co,mv->co);
VecMulf(dupve->co,0.5);
}
BLI_edgehashIterator_free(ehi);
/* create new faces */
curdupface=totface;
@ -6158,14 +6170,14 @@ static DerivedMesh * explodeModifier_splitEdges(ExplodeModifierData *emd, Derive
curdupface++;
if(v1==v2){
df1->v1=edgesplit[mf->v1*totvert+mf->v4];
df1->v2=edgesplit[mf->v2*totvert+mf->v3];
df1->v1=edgesplit_get(edgehash, mf->v1, mf->v4);
df1->v2=edgesplit_get(edgehash, mf->v2, mf->v3);
mf->v3=df1->v2;
mf->v4=df1->v1;
}
else{
df1->v1=edgesplit[mf->v1*totvert+mf->v2];
df1->v4=edgesplit[mf->v3*totvert+mf->v4];
df1->v1=edgesplit_get(edgehash, mf->v1, mf->v2);
df1->v4=edgesplit_get(edgehash, mf->v3, mf->v4);
mf->v2=df1->v1;
mf->v3=df1->v4;
}
@ -6188,8 +6200,8 @@ static DerivedMesh * explodeModifier_splitEdges(ExplodeModifierData *emd, Derive
if(v1!=v2){
if(v1!=v4){
df1->v1=edgesplit[mf->v1*totvert+mf->v4];
df1->v2=edgesplit[mf->v1*totvert+mf->v2];
df1->v1=edgesplit_get(edgehash, mf->v1, mf->v4);
df1->v2=edgesplit_get(edgehash, mf->v1, mf->v2);
df2->v1=df1->v3=mf->v2;
df2->v3=df1->v4=mf->v4;
df2->v2=mf->v3;
@ -6202,8 +6214,8 @@ static DerivedMesh * explodeModifier_splitEdges(ExplodeModifierData *emd, Derive
facepa[i]=v1;
}
else{
df1->v2=edgesplit[mf->v1*totvert+mf->v2];
df1->v3=edgesplit[mf->v2*totvert+mf->v3];
df1->v2=edgesplit_get(edgehash, mf->v1, mf->v2);
df1->v3=edgesplit_get(edgehash, mf->v2, mf->v3);
df1->v4=mf->v3;
df2->v2=mf->v3;
df2->v3=mf->v4;
@ -6219,8 +6231,8 @@ static DerivedMesh * explodeModifier_splitEdges(ExplodeModifierData *emd, Derive
}
else{
if(v1!=v4){
df1->v3=edgesplit[mf->v3*totvert+mf->v4];
df1->v4=edgesplit[mf->v1*totvert+mf->v4];
df1->v3=edgesplit_get(edgehash, mf->v3, mf->v4);
df1->v4=edgesplit_get(edgehash, mf->v1, mf->v4);
df1->v2=mf->v3;
mf->v1=df1->v4;
@ -6232,8 +6244,8 @@ static DerivedMesh * explodeModifier_splitEdges(ExplodeModifierData *emd, Derive
facepa[i]=v4;
}
else{
df1->v3=edgesplit[mf->v2*totvert+mf->v3];
df1->v4=edgesplit[mf->v3*totvert+mf->v4];
df1->v3=edgesplit_get(edgehash, mf->v2, mf->v3);
df1->v4=edgesplit_get(edgehash, mf->v3, mf->v4);
df1->v1=mf->v4;
df1->v2=mf->v2;
df2->v3=mf->v4;
@ -6269,9 +6281,9 @@ static DerivedMesh * explodeModifier_splitEdges(ExplodeModifierData *emd, Derive
curdupface++;
if(v1==v2){
df2->v1=df1->v1=edgesplit[mf->v1*totvert+mf->v4];
df3->v1=df1->v2=edgesplit[mf->v2*totvert+mf->v3];
df3->v3=df2->v2=df1->v3=edgesplit[mf->v3*totvert+mf->v4];
df2->v1=df1->v1=edgesplit_get(edgehash, mf->v1, mf->v4);
df3->v1=df1->v2=edgesplit_get(edgehash, mf->v2, mf->v3);
df3->v3=df2->v2=df1->v3=edgesplit_get(edgehash, mf->v3, mf->v4);
df3->v2=mf->v3;
df2->v3=mf->v4;
df1->v4=df2->v4=df3->v4=0;
@ -6284,9 +6296,9 @@ static DerivedMesh * explodeModifier_splitEdges(ExplodeModifierData *emd, Derive
facepa[curdupface-2]=v4;
}
else if(v2==v3){
df3->v1=df2->v3=df1->v1=edgesplit[mf->v1*totvert+mf->v4];
df2->v2=df1->v2=edgesplit[mf->v1*totvert+mf->v2];
df3->v2=df1->v3=edgesplit[mf->v3*totvert+mf->v4];
df3->v1=df2->v3=df1->v1=edgesplit_get(edgehash, mf->v1, mf->v4);
df2->v2=df1->v2=edgesplit_get(edgehash, mf->v1, mf->v2);
df3->v2=df1->v3=edgesplit_get(edgehash, mf->v3, mf->v4);
df3->v3=mf->v4;
df2->v1=mf->v1;
@ -6300,9 +6312,9 @@ static DerivedMesh * explodeModifier_splitEdges(ExplodeModifierData *emd, Derive
facepa[curdupface-2]=v1;
}
else if(v3==v4){
df3->v2=df2->v1=df1->v1=edgesplit[mf->v1*totvert+mf->v2];
df2->v3=df1->v2=edgesplit[mf->v2*totvert+mf->v3];
df3->v3=df1->v3=edgesplit[mf->v1*totvert+mf->v4];
df3->v2=df2->v1=df1->v1=edgesplit_get(edgehash, mf->v1, mf->v2);
df2->v3=df1->v2=edgesplit_get(edgehash, mf->v2, mf->v3);
df3->v3=df1->v3=edgesplit_get(edgehash, mf->v1, mf->v4);
df3->v1=mf->v1;
df2->v2=mf->v2;
@ -6316,9 +6328,9 @@ static DerivedMesh * explodeModifier_splitEdges(ExplodeModifierData *emd, Derive
facepa[curdupface-2]=v2;
}
else{
df3->v1=df1->v1=edgesplit[mf->v1*totvert+mf->v2];
df3->v3=df2->v1=df1->v2=edgesplit[mf->v2*totvert+mf->v3];
df2->v3=df1->v3=edgesplit[mf->v3*totvert+mf->v4];
df3->v1=df1->v1=edgesplit_get(edgehash, mf->v1, mf->v2);
df3->v3=df2->v1=df1->v2=edgesplit_get(edgehash, mf->v2, mf->v3);
df2->v3=df1->v3=edgesplit_get(edgehash, mf->v3, mf->v4);
df3->v2=mf->v2;
df2->v2=mf->v3;
@ -6369,11 +6381,11 @@ static DerivedMesh * explodeModifier_splitEdges(ExplodeModifierData *emd, Derive
*df3=*mf;
curdupface++;
df1->v1=edgesplit[mf->v1*totvert+mf->v2];
df3->v2=df1->v3=edgesplit[mf->v2*totvert+mf->v3];
df1->v1=edgesplit_get(edgehash, mf->v1, mf->v2);
df3->v2=df1->v3=edgesplit_get(edgehash, mf->v2, mf->v3);
df2->v1=edgesplit[mf->v1*totvert+mf->v4];
df3->v4=df2->v3=edgesplit[mf->v3*totvert+mf->v4];
df2->v1=edgesplit_get(edgehash, mf->v1, mf->v4);
df3->v4=df2->v3=edgesplit_get(edgehash, mf->v3, mf->v4);
df3->v1=df2->v2=df1->v4=curdupin;
@ -6410,11 +6422,11 @@ static DerivedMesh * explodeModifier_splitEdges(ExplodeModifierData *emd, Derive
curdupface++;
if(v2==v3){
df1->v1=edgesplit[mf->v1*totvert+mf->v2];
df3->v1=df1->v2=df1->v3=edgesplit[mf->v2*totvert+mf->v3];
df2->v1=df1->v4=edgesplit[mf->v1*totvert+mf->v4];
df1->v1=edgesplit_get(edgehash, mf->v1, mf->v2);
df3->v1=df1->v2=df1->v3=edgesplit_get(edgehash, mf->v2, mf->v3);
df2->v1=df1->v4=edgesplit_get(edgehash, mf->v1, mf->v4);
df3->v3=df2->v3=edgesplit[mf->v3*totvert+mf->v4];
df3->v3=df2->v3=edgesplit_get(edgehash, mf->v3, mf->v4);
df3->v2=mf->v3;
df3->v4=0;
@ -6428,11 +6440,11 @@ static DerivedMesh * explodeModifier_splitEdges(ExplodeModifierData *emd, Derive
facepa[curdupface-1]=v3;
}
else{
df3->v1=df2->v1=df1->v2=edgesplit[mf->v1*totvert+mf->v2];
df2->v4=df1->v3=edgesplit[mf->v3*totvert+mf->v4];
df1->v4=edgesplit[mf->v1*totvert+mf->v4];
df3->v1=df2->v1=df1->v2=edgesplit_get(edgehash, mf->v1, mf->v2);
df2->v4=df1->v3=edgesplit_get(edgehash, mf->v3, mf->v4);
df1->v4=edgesplit_get(edgehash, mf->v1, mf->v4);
df3->v3=df2->v2=edgesplit[mf->v2*totvert+mf->v3];
df3->v3=df2->v2=edgesplit_get(edgehash, mf->v2, mf->v3);
df3->v4=0;
@ -6456,7 +6468,7 @@ static DerivedMesh * explodeModifier_splitEdges(ExplodeModifierData *emd, Derive
}
}
MEM_freeN(edgesplit);
BLI_edgehash_free(edgehash, NULL);
MEM_freeN(facesplit);
MEM_freeN(vertpa);
@ -6836,8 +6848,16 @@ static void meshdeformModifier_do(
Mat3CpyMat4(icagemat, iobmat);
/* bind weights if needed */
if(!mmd->bindcos)
harmonic_coordinates_bind(mmd, vertexCos, numVerts, cagemat);
if(!mmd->bindcos) {
static int recursive = 0;
/* progress bar redraw can make this recursive .. */
if(!recursive) {
recursive = 1;
harmonic_coordinates_bind(mmd, vertexCos, numVerts, cagemat);
recursive = 0;
}
}
/* verify we have compatible weights */
totvert= numVerts;

@ -1989,7 +1989,7 @@ void ntreeEndExecTree(bNodeTree *ntree)
if(ntree->threadstack) {
for(a=0; a<BLENDER_MAX_THREADS; a++) {
for(nts=ntree->threadstack[a].first; nts; nts=nts->next)
MEM_freeN(nts->stack);
if (nts->stack) MEM_freeN(nts->stack);
BLI_freelistN(&ntree->threadstack[a]);
}

@ -1056,6 +1056,7 @@ ParticleSystem *copy_particlesystem(ParticleSystem *psys)
psysn->effectors.first= psysn->effectors.last= 0;
psysn->pathcachebufs.first = psysn->pathcachebufs.last = NULL;
psysn->childcachebufs.first = psysn->childcachebufs.last = NULL;
psysn->reactevents.first = psysn->reactevents.last = NULL;
psysn->renderdata = NULL;

@ -2401,8 +2401,11 @@ void psys_cache_paths(Object *ob, ParticleSystem *psys, float cfra, int editupda
psys->pathcache= cache;
}
if(edit==NULL && psys->soft && psys->softflag & OB_SB_ENABLE)
if(edit==NULL && psys->soft && psys->softflag & OB_SB_ENABLE) {
soft = psys->soft;
if(!soft->bpoint)
soft= NULL;
}
psys->lattice = psys_get_lattice(ob, psys);
ma= give_current_material(ob, psys->part->omat);

@ -3770,10 +3770,12 @@ static void boid_brain(BoidVecFunc *bvf, ParticleData *pa, Object *ob, ParticleS
near=0;
for(n=1; n<neighbours; n++){
if(ptn[n].dist<2.0f*pa->size){
bvf->Subf(dvec,pa->state.co,pars[ptn[n].index].state.co);
bvf->Mulf(dvec,(2.0f*pa->size-ptn[n].dist)/ptn[n].dist);
bvf->Addf(avoid,avoid,dvec);
near++;
if(ptn[n].dist!=0.0f) {
bvf->Subf(dvec,pa->state.co,pars[ptn[n].index].state.co);
bvf->Mulf(dvec,(2.0f*pa->size-ptn[n].dist)/ptn[n].dist);
bvf->Addf(avoid,avoid,dvec);
near++;
}
}
/* ptn[] is distance ordered so no need to check others */
else break;

@ -67,6 +67,7 @@
#include "BKE_global.h"
#include "BKE_group.h"
#include "BKE_ipo.h"
#include "BKE_idprop.h"
#include "BKE_image.h"
#include "BKE_key.h"
#include "BKE_library.h"
@ -149,6 +150,11 @@ void free_scene(Scene *sce)
MEM_freeN(sce->r.qtcodecdata);
sce->r.qtcodecdata = NULL;
}
if (sce->r.ffcodecdata.properties) {
IDP_FreeProperty(sce->r.ffcodecdata.properties);
MEM_freeN(sce->r.ffcodecdata.properties);
sce->r.ffcodecdata.properties = NULL;
}
BLI_freelistN(&sce->markers);
BLI_freelistN(&sce->transform_spaces);

@ -3390,8 +3390,9 @@ static void softbody_update_positions(Object *ob, SoftBody *sb, float (*vertexCo
int a;
/* update the vertex locations */
if(sb->particles) {
if(sb->particles && sb->particles->totpart>0) {
psmd= psys_get_modifier(ob,sb->particles);
pa= sb->particles->particles;
key= pa->hair;
@ -3434,7 +3435,7 @@ static void softbody_reset(Object *ob, SoftBody *sb, float (*vertexCos)[3], int
float hairmat[4][4];
int a;
if(sb->particles) {
if(sb->particles && sb->particles->totpart>0) {
psmd= psys_get_modifier(ob, sb->particles);
pa= sb->particles->particles;
key= pa->hair;

@ -33,6 +33,7 @@
#include <ffmpeg/avcodec.h>
#include <ffmpeg/rational.h>
#include <ffmpeg/swscale.h>
#include <ffmpeg/opt.h>
#if LIBAVFORMAT_VERSION_INT < (49 << 16)
#define FFMPEG_OLD_FRAME_RATE 1
@ -58,6 +59,7 @@
#include "BKE_bad_level_calls.h"
#include "BKE_global.h"
#include "BKE_idprop.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
@ -224,6 +226,10 @@ static const char** get_file_extensions(int format)
static const char * rv[] = { ".flv", NULL };
return rv;
}
case FFMPEG_MKV: {
static const char * rv[] = { ".mkv", NULL };
return rv;
}
default:
return NULL;
}
@ -337,6 +343,75 @@ static AVFrame* generate_video_frame(uint8_t* pixels)
return current_frame;
}
static void set_ffmpeg_property_option(AVCodecContext* c, IDProperty * prop)
{
char name[128];
char * param;
const AVOption * rv = NULL;
fprintf(stderr, "FFMPEG expert option: %s: ", prop->name);
strncpy(name, prop->name, 128);
param = strchr(name, ':');
if (param) {
*param++ = 0;
}
switch(prop->type) {
case IDP_STRING:
fprintf(stderr, "%s.\n", IDP_String(prop));
rv = av_set_string(c, prop->name, IDP_String(prop));
break;
case IDP_FLOAT:
fprintf(stderr, "%g.\n", IDP_Float(prop));
rv = av_set_double(c, prop->name, IDP_Float(prop));
break;
case IDP_INT:
fprintf(stderr, "%d.\n", IDP_Int(prop));
if (param) {
if (IDP_Int(prop)) {
rv = av_set_string(c, name, param);
} else {
return;
}
} else {
rv = av_set_int(c, prop->name, IDP_Int(prop));
}
break;
}
if (!rv) {
fprintf(stderr, "ffmpeg-option not supported: %s! Skipping.\n",
prop->name);
}
}
static void set_ffmpeg_properties(AVCodecContext* c, const char * prop_name)
{
IDProperty * prop;
void * iter;
IDProperty * curr;
if (!G.scene->r.ffcodecdata.properties) {
return;
}
prop = IDP_GetPropertyFromGroup(
G.scene->r.ffcodecdata.properties, (char*) prop_name);
if (!prop) {
return;
}
iter = IDP_GetGroupIterator(prop);
while ((curr = IDP_GroupIterNext(iter)) != NULL) {
set_ffmpeg_property_option(c, curr);
}
}
/* prepare a video stream for the output file */
static AVStream* alloc_video_stream(int codec_id, AVFormatContext* of,
@ -423,13 +498,18 @@ static AVStream* alloc_video_stream(int codec_id, AVFormatContext* of,
}
/* Determine whether we are encoding interlaced material or not */
if (G.scene->r.mode & (1 << 6)) {
if (G.scene->r.mode & R_FIELDS) {
fprintf(stderr, "Encoding interlaced video\n");
c->flags |= CODEC_FLAG_INTERLACED_DCT;
c->flags |= CODEC_FLAG_INTERLACED_ME;
}
c->sample_aspect_ratio.num = G.scene->r.xasp;
c->sample_aspect_ratio.den = G.scene->r.yasp;
/* xasp & yasp got float lately... */
c->sample_aspect_ratio = av_d2q(
((double) G.scene->r.xasp / (double) G.scene->r.yasp), 255);
set_ffmpeg_properties(c, "video");
if (avcodec_open(c, codec) < 0) {
error("Couldn't initialize codec");
@ -474,6 +554,9 @@ static AVStream* alloc_audio_stream(int codec_id, AVFormatContext* of)
error("Couldn't find a valid audio codec");
return NULL;
}
set_ffmpeg_properties(c, "audio");
if (avcodec_open(c, codec) < 0) {
error("Couldn't initialize audio codec");
return NULL;

@ -86,6 +86,9 @@ void BLI_edgehashIterator_getKey (EdgeHashIterator *ehi, int *v0_r, int *v1
/* Retrieve the value from an iterator. */
void* BLI_edgehashIterator_getValue (EdgeHashIterator *ehi);
/* Set the value for an iterator. */
void BLI_edgehashIterator_setValue (EdgeHashIterator *ehi, void *val);
/* Steps the iterator to the next index. */
void BLI_edgehashIterator_step (EdgeHashIterator *ehi);

@ -130,7 +130,7 @@ static int vertex_sort(const void *p1, const void *p2)
* 'box->index' is not used at all, the only reason its there
* is that the box array is sorted by area and programs need to be able
* to have some way of writing the boxes back to the original data.
* len - the number of boxes in teh array.
* len - the number of boxes in the array.
* tot_width and tot_height are set so you can normalize the data.
* */
void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height)

@ -200,6 +200,11 @@ void *BLI_edgehashIterator_getValue(EdgeHashIterator *ehi) {
return ehi->curEntry?ehi->curEntry->val:NULL;
}
void BLI_edgehashIterator_setValue(EdgeHashIterator *ehi, void *val) {
if(ehi->curEntry)
ehi->curEntry->val= val;
}
void BLI_edgehashIterator_step(EdgeHashIterator *ehi) {
if (ehi->curEntry) {
ehi->curEntry= ehi->curEntry->next;

@ -3601,6 +3601,15 @@ static void direct_link_scene(FileData *fd, Scene *sce)
if (sce->r.qtcodecdata) {
sce->r.qtcodecdata->cdParms = newdataadr(fd, sce->r.qtcodecdata->cdParms);
}
if (sce->r.ffcodecdata.properties) {
sce->r.ffcodecdata.properties = newdataadr(
fd, sce->r.ffcodecdata.properties);
if (sce->r.ffcodecdata.properties) {
IDP_DirectLinkProperty(
sce->r.ffcodecdata.properties,
(fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
}
}
link_list(fd, &(sce->markers));
link_list(fd, &(sce->transform_spaces));
@ -7377,6 +7386,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* needed for proper libdata lookup */
oldnewmap_insert(fd->libmap, psys->part, psys->part, 0);
part->id.lib= ob->id.lib;
part->id.us--;
part->id.flag |= (ob->id.flag & LIB_NEEDLINK);

@ -1532,6 +1532,9 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
writestruct(wd, DATA, "QuicktimeCodecData", 1, sce->r.qtcodecdata);
if (sce->r.qtcodecdata->cdParms) writedata(wd, DATA, sce->r.qtcodecdata->cdSize, sce->r.qtcodecdata->cdParms);
}
if (sce->r.ffcodecdata.properties) {
IDP_WriteProperty(sce->r.ffcodecdata.properties, wd);
}
/* writing dynamic list of TimeMarkers to the blend file */
for(marker= sce->markers.first; marker; marker= marker->next)

@ -260,5 +260,6 @@ int EM_vertColorCheck(void); /* can we edit colors for this mesh?*/
void EM_set_actFace(struct EditFace *efa);
struct EditFace * EM_get_actFace(int sloppy);
int EM_get_actSelection(struct EditSelection *ese);
#endif

@ -59,7 +59,7 @@ void drawview3d_render(struct View3D *v3d, int winx, int winy, float winmat[][4]
void draw_depth(struct ScrArea *sa, void *spacedata);
void view3d_update_depths(struct View3D *v3d);
int update_time(void);
int update_time(int cfra);
void calc_viewborder(struct View3D *v3d, struct rctf *viewborder_r);
void view3d_set_1_to_1_viewborder(struct View3D *v3d);

@ -359,6 +359,8 @@ void curvemap_buttons(struct uiBlock *block, struct CurveMapping *cumap, char la
#define B_SET_ZBLUR 1644
#define B_ADD_RENDERLAYER 1645
#define B_SET_PASS 1646
#define B_ADD_FFMPEG_VIDEO_OPTION 1647
#define B_ADD_FFMPEG_AUDIO_OPTION 1648
#define B_SEQ_BUT_PLUGIN 1691
#define B_SEQ_BUT_RELOAD 1692

@ -59,6 +59,27 @@ typedef struct bDeformGroup {
char name[32];
} bDeformGroup;
/**
* The following illustrates the orientation of the
* bounding box in local space
*
*
* Z Y
* | /
* |/
* .-----X
*
*
* 2----------6
* /| /|
* / | / |
* 1----------5 |
* | | | |
* | 3-------|--7
* | / | /
* |/ |/
* 0----------4
*/
typedef struct BoundBox {
float vec[8][3];
int flag, pad;

@ -98,6 +98,7 @@ typedef struct FFMpegCodecData {
int rc_buffer_size;
int mux_packet_size;
int mux_rate;
IDProperty *properties;
} FFMpegCodecData;

@ -524,7 +524,8 @@ typedef struct SpaceImaSel {
#define SI_DRAW_STRETCH 1<<21
/* SpaceIpo->flag */
#define SIPO_LOCK_VIEW 1<<0
#define SIPO_LOCK_VIEW 1<<0
#define SIPO_NOTRANSKEYCULL 1<<1
/* SpaceText flags (moved from DNA_text_types.h) */
@ -616,6 +617,7 @@ typedef struct SpaceImaSel {
#define SNLA_ALLKEYED 1
#define SNLA_ACTIVELAYERS 2
#define SNLA_DRAWTIME 4
#define SNLA_NOTRANSKEYCULL 8
/* time->flag */
/* show timing in frames instead of in seconds */

@ -25,7 +25,6 @@ if sys.platform != 'cygwin':
makesdna_tool.Append (CCFLAGS = cflags)
makesdna_tool.Append (CPPDEFINES = defines)
makesdna_tool.Append (LIBPATH = '#'+root_build_dir+'/lib')
makesdna_tool.Append (LINKFLAGS = env['PLATFORM_LINKFLAGS'])
if env['BF_PROFILE']:
makesdna_tool.Append (LINKFLAGS = env['BF_PROFILE_FLAGS'])

@ -46,7 +46,8 @@ static void do_gamma(bNode *node, float *out, float *in, float *fac)
{
int i=0;
for(i=0; i<3; i++) {
out[i] = pow(in[i],fac[0]);
/* check for negative to avoid nan's */
out[i] = (in[0] > 0.0f)? pow(in[i],fac[0]): in[0];
}
out[3] = in[3];
}

@ -239,6 +239,27 @@ static void node_dynamic_reset(bNode *node, int unlink_text)
tinfo = node->typeinfo;
tinfo_default = node_dynamic_find_typeinfo(&node_all_shaders, NULL);
if ((tinfo == tinfo_default) && unlink_text) {
ID *textID = node->id;
/* already at default (empty) state, which happens if this node's
* script failed to parse at the first stage: definition. We're here
* because its text was removed from Blender. */
for (ma= G.main->mat.first; ma; ma= ma->id.next) {
if (ma->nodetree) {
bNode *nd;
for (nd= ma->nodetree->nodes.first; nd; nd = nd->next) {
if (nd->id == textID) {
nd->id = NULL;
nd->custom1 = 0;
nd->custom1 = BSET(nd->custom1, NODE_DYNAMIC_NEW);
BLI_strncpy(nd->name, "Dynamic", 8);
return;
}
}
}
}
}
node_dynamic_rem_all_links(tinfo);
node_dynamic_free_typeinfo_sockets(tinfo);

@ -2063,21 +2063,21 @@ static PyObject *Method_Image( PyObject * self, PyObject * args )
/*GLfloat scissorBox[4];*/
/* parse the arguments passed-in from Python */
if( !PyArg_ParseTuple( args, "Off|ffiiii", &pyObjImage,
if( !PyArg_ParseTuple( args, "O!ff|ffiiii", &Image_Type, &pyObjImage,
&originX, &originY, &zoomX, &zoomY,
&clipX, &clipY, &clipW, &clipH ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected a Blender.Image and 2 floats, and " \
"optionally 2 floats and 4 ints as arguments" );
/* check that the first PyObject is actually a Blender.Image */
if( !BPy_Image_Check( pyObjImage ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected a Blender.Image and 2 floats, and " \
"optionally 2 floats and 4 ints as arguments" );
/* check that the zoom factors are valid */
if( ( zoomX <= 0.0 ) || ( zoomY <= 0.0 ) )
if( ( zoomX < 0.0 ) || ( zoomY < 0.0 ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"invalid zoom factors - they must be >= 0.0" );
"invalid zoom factors - they must be > 0.0" );
if ((zoomX == 0.0 ) || ( zoomY == 0.0 )) {
/* sometimes python doubles can be converted from small values to a zero float, in this case just dont draw */
Py_RETURN_NONE;
}
/* fetch a C Image pointer from the passed-in Python object */
py_img = ( BPy_Image * ) pyObjImage;
@ -2101,9 +2101,9 @@ static PyObject *Method_Image( PyObject * self, PyObject * args )
* the image as they can. */
clipX = EXPP_ClampInt( clipX, 0, ibuf->x );
clipY = EXPP_ClampInt( clipY, 0, ibuf->y );
if( ( clipW < 0 ) || ( clipW > ( ibuf->x - clipW ) ) )
if( ( clipW < 0 ) || ( clipX+clipW > ibuf->x ) )
clipW = ibuf->x - clipX;
if( ( clipH < 0 ) || ( clipH > ( ibuf->y - clipH ) ) )
if( ( clipH < 0 ) || ( clipY+clipH > ibuf->y ) )
clipH = ibuf->y - clipY;
/* -- we are "Go" to Draw! -- */
@ -2165,8 +2165,7 @@ static PyObject *Method_Image( PyObject * self, PyObject * args )
glPixelStorei( GL_UNPACK_SKIP_PIXELS, 0 );
glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
Py_INCREF( Py_None );
return Py_None;
Py_RETURN_NONE;
}

@ -803,7 +803,7 @@ static int ActionStrip_setBlendMode( BPy_ActionStrip * self, PyObject * value )
#define ACTIONSTRIP_MASK (ACTSTRIP_SELECT | ACTSTRIP_USESTRIDE \
| ACTSTRIP_HOLDLASTFRAME | ACTSTRIP_ACTIVE | ACTSTRIP_LOCK_ACTION \
| ACTSTRIP_MUTE)
| ACTSTRIP_MUTE | ACTSTRIP_CYCLIC_USEX | ACTSTRIP_CYCLIC_USEY | ACTSTRIP_CYCLIC_USEZ | ACTSTRIP_AUTO_BLENDS)
static PyObject *ActionStrip_getFlag( BPy_ActionStrip * self )
{
@ -1169,18 +1169,16 @@ static PyObject *M_ActionStrip_FlagsDict( void )
if( S ) {
BPy_constant *d = ( BPy_constant * ) S;
PyConstant_Insert( d, "SELECT",
PyInt_FromLong( ACTSTRIP_SELECT ) );
PyConstant_Insert( d, "STRIDE_PATH",
PyInt_FromLong( ACTSTRIP_USESTRIDE ) );
PyConstant_Insert( d, "HOLD",
PyInt_FromLong( ACTSTRIP_HOLDLASTFRAME ) );
PyConstant_Insert( d, "ACTIVE",
PyInt_FromLong( ACTSTRIP_ACTIVE ) );
PyConstant_Insert( d, "LOCK_ACTION",
PyInt_FromLong( ACTSTRIP_LOCK_ACTION ) );
PyConstant_Insert( d, "MUTE",
PyInt_FromLong( ACTSTRIP_MUTE ) );
PyConstant_Insert( d, "SELECT", PyInt_FromLong( ACTSTRIP_SELECT ) );
PyConstant_Insert( d, "STRIDE_PATH", PyInt_FromLong( ACTSTRIP_USESTRIDE ) );
PyConstant_Insert( d, "HOLD", PyInt_FromLong( ACTSTRIP_HOLDLASTFRAME ) );
PyConstant_Insert( d, "ACTIVE", PyInt_FromLong( ACTSTRIP_ACTIVE ) );
PyConstant_Insert( d, "LOCK_ACTION", PyInt_FromLong( ACTSTRIP_LOCK_ACTION ) );
PyConstant_Insert( d, "MUTE", PyInt_FromLong( ACTSTRIP_MUTE ) );
PyConstant_Insert( d, "USEX", PyInt_FromLong( ACTSTRIP_CYCLIC_USEX ) );
PyConstant_Insert( d, "USEY", PyInt_FromLong( ACTSTRIP_CYCLIC_USEY ) );
PyConstant_Insert( d, "USEZ", PyInt_FromLong( ACTSTRIP_CYCLIC_USEZ ) );
PyConstant_Insert( d, "AUTO_BLEND", PyInt_FromLong( ACTSTRIP_AUTO_BLENDS ) );
}
return S;
}

@ -919,6 +919,8 @@ static int sockoutmap_set_attr(bNodeStack **stack, short type, short idx, PyObje
int i;
short len, wanted_len;
if (!stack || !stack[idx]) return 0; /* no MaterialNode */
if (type == SOCK_VALUE) {
val = PyNumber_Float(value);
if (!val)

@ -1240,6 +1240,7 @@ static PyObject *M_Window_QHandle( PyObject * self, PyObject * args )
static PyObject *M_Window_TestBreak( PyObject * self )
{
if (blender_test_break()) {
G.afbreek= 0;
Py_RETURN_TRUE;
} else {
Py_RETURN_FALSE;

@ -4,9 +4,7 @@
The Blender Python API Reference
================================
An asterisk (*) means the module has been updated.
for a full list of changes since 2.42 see U{http://mediawiki.blender.org/index.php/Release_Notes/Notes243/Python_API}
for a full list of changes since 2.45 see U{http://wiki.blender.org/index.php/Release_Notes/Notes246/Python_API}
Top Module:
-----------
@ -16,61 +14,53 @@ The Blender Python API Reference
Submodules:
-----------
- L{Armature} (*)
- L{Armature}
- L{NLA}
- L{Action<NLA.Action>}
- L{BezTriple} (*)
- L{BezTriple}
- L{BGL}
- L{Camera} (*)
- L{Curve} (*)
- L{Draw} (*)
- L{Camera}
- L{Curve}
- L{Draw}
- L{Effect}
- L{Geometry} (*)
- L{Group} (*)
- L{Image} (*)
- L{Ipo} (*)
- L{IpoCurve} (*)
- L{Key} (*)
- L{Geometry}
- L{Group}
- L{Image}
- L{Ipo}
- L{IpoCurve}
- L{Key}
- L{Lamp}
- L{Lattice} (*)
- L{Library} (*)
- L{Material} (*)
- L{Mathutils} (*)
- L{Mesh} (*)
- L{MeshPrimitives} (*)
- L{Metaball} (*)
- L{Lattice}
- L{Library}
- L{Material}
- L{Mathutils}
- L{Mesh}
- L{MeshPrimitives}
- L{Metaball}
- L{NMesh} (deprecated)
- L{Noise}
- L{Object} (*)
- L{Modifier} (*)
- L{Pose} (*)
- L{Constraint} (*)
- L{ActionStrips<NLA>} (*)
- L{Object}
- L{Modifier}
- L{Pose}
- L{Constraint}
- L{ActionStrips<NLA>}
- L{Particle}
- L{Registry}
- L{Scene} (*)
- L{Scene}
- L{Radio}
- L{Render} (*)
- L{Sound} (*)
- L{Render}
- L{Sound}
- L{Text}
- L{Text3d}
- L{Font}
- L{Texture} (*)
- L{Texture}
- L{TimeLine}
- L{Types}
- L{Window}
- L{Theme} (*)
- L{Theme}
- L{World}
- L{sys<Sys>}
Additional information:
-----------------------
- L{Special features<API_related>}:
- scripts: registering in menus, documenting, configuring (new);
- command line examples (new);
- script links (*), space handler script links, Group module (new).
Introduction:
=============
@ -226,9 +216,8 @@ A note to newbie script writers:
to get an idea of what can be done, you may be surprised.
@author: The Blender Python Team
@requires: Blender 2.43 or newer.
@version: 2.43
@see: U{www.blender3d.org<http://www.blender3d.org>}: main site
@requires: Blender 2.46 or newer.
@version: 2.46
@see: U{www.blender.org<http://www.blender.org>}: documentation and forum
@see: U{blenderartists.org<http://blenderartists.org>}: user forum
@see: U{projects.blender.org<http://projects.blender.org>}
@ -238,9 +227,9 @@ A note to newbie script writers:
@see: U{Blending into Python<en.wikibooks.org/wiki/Blender_3D:_Blending_Into_Python>}: User contributed documentation, featuring a blender/python cookbook with many examples.
@note: the official version of this reference guide is only updated for each
new Blender release. But you can build the current CVS
new Blender release. But you can build the current SVN
version yourself: install epydoc, grab all files in the
source/blender/python/api2_2x/doc/ folder of Blender's CVS and use the
source/blender/python/api2_2x/doc/ folder of Blender's SVN and use the
epy_docgen.sh script also found there to generate the html docs.
Naturally you will also need a recent Blender binary to try the new
features. If you prefer not to compile it yourself, there is a testing

@ -116,6 +116,14 @@ def Get (request):
@return: The requested data or None if not found.
"""
def GetPaths (absolute=0):
"""
Returns a list of files this blend file uses: (libraries, images, sounds, fonts, sequencer movies).
@type absolute: bool
@param absolute: When true, the absolute paths of every file will be returned.
@return: A list for paths (strings) that this blend file uses.
"""
def Redraw ():
"""
Redraw all 3D windows.

@ -48,7 +48,7 @@ def New (name, width, height, depth):
@type height: int
@param height: The height of the new Image object, between 1 and 5000.
@type depth: int
@param depth: The colour depth of the new Image object. (32:RGBA 8bit channels, 128:RGBA 32bit high dynamic range float channels).
@param depth: The color depth of the new Image object. (32:RGBA 8bit channels, 128:RGBA 32bit high dynamic range float channels).
@rtype: Blender Image
@return: A new Blender Image object.
"""

@ -667,6 +667,8 @@ class MFaceSeq:
True, the method will return a list representing the new index for each
face in the input list. If faces are removed as duplicates, None is
inserted in place of the index.
@type smooth: boolean
@param smooth: keyword parameter (default is False). If supplied new faces will have smooth enabled.
@warning: Faces using the first vertex at the 3rd or 4th location in the
face's vertex list will have their order rotated so that the zero index
on in the first or second location in the face. When creating face data

@ -19,6 +19,10 @@ It is a bitmask and settings are ORed together.
- ACTIVE: action strip is active in NLA window
- LOCK_ACTION: action start/end are automatically mapped to strip duration
- MUTE: action strip does not contribute to the NLA solution
- USEX: Turn off automatic single-axis cycling and use X as an offset axis. Note that you can use multiple axes at once.
- USEY: Turn off automatic single-axis cycling and use Y as an offset axis. Note that you can use multiple axes at once.
- USEZ: Turn off automatic single-axis cycling and use Z as an offset axis. Note that you can use multiple axes at once.
- AUTO_BLEND: Automatic calculation of blend in/out values
@type StrideAxes: readonly dictionary
@var StrideAxes: Constant dict used by the L{ActionStrip.strideAxis} attribute.

@ -399,6 +399,16 @@ class RenderData:
@type bakeDist: float
@ivar bakeBias: The distance in blender units to bias faces further away from the object.
@type bakeBias: float
@ivar halfFloat: When enabled use 16bit floats rather then 32bit for OpenEXR files.
@type halfFloat: bool
@ivar zbuf: When enabled, save the zbuffer with an OpenEXR file
@type zbuf: bool
@ivar preview: When enabled, save a preview jpeg with an OpenEXR file
@type preview: bool
@ivar touch: Create an empty file before rendering it.
@type touch: bool
@ivar noOverwrite: Skip rendering frames when the file exists.
@type noOverwrite: bool
"""
def currentFrame(frame = None):

@ -80,7 +80,7 @@ Example::
@type ExtendModes: readonly dictionary
@var ExtendModes: Extend, clip, repeat or checker modes for image textures
- EXTEND - Extends the colour of the edge
- EXTEND - Extends the color of the edge
- CLIP - Return alpha 0.0 outside image
- CLIPCUBE - Return alpha 0.0 around cube-shaped area around image
- REPEAT - Repeat image vertically and horizontally
@ -209,10 +209,10 @@ Example::
@type TexCo: readonly dictionary
@var MapTo: Flags for MTex.mapto.
- COL - Make the texture affect the basic colour of the material
- COL - Make the texture affect the basic color of the material
- NOR - Make the texture affect the rendered normal
- CSP - Make the texture affect the specularity colour
- CMIR - Make the texture affect the mirror colour
- CSP - Make the texture affect the specularity color
- CMIR - Make the texture affect the mirror color
- REF - Make the texture affect the diffuse reflectivity value
- SPEC - Make the texture affect the specularity value
- HARD - Make the texture affect the hardness value

@ -2007,19 +2007,19 @@ static int RenderData_setIValueAttrClamp( BPy_RenderData *self, PyObject *value,
case EXPP_RENDER_ATTR_CFRAME:
min = 1;
max = MAXFRAME;
size = 'h';
size = 'i';
param = &self->renderContext->cfra;
break;
case EXPP_RENDER_ATTR_EFRAME:
min = 1;
max = MAXFRAME;
size = 'h';
size = 'i';
param = &self->renderContext->efra;
break;
case EXPP_RENDER_ATTR_SFRAME:
min = 1;
max = MAXFRAME;
size = 'h';
size = 'i';
param = &self->renderContext->sfra;
break;
case EXPP_RENDER_ATTR_FPS:

@ -177,6 +177,9 @@ void RE_DataBase_ApplyWindow(struct Render *re);
/* override the scene setting for amount threads, commandline */
void RE_set_max_threads(int threads);
/* set the render threads based on the commandline and autothreads setting */
void RE_init_threadcount(Render *re);
/* the main processor, assumes all was set OK! */
void RE_TileProcessor(struct Render *re, int firsttile, int threaded);

@ -265,7 +265,7 @@ typedef struct ObjectRen {
char (*mtface)[32];
char (*mcol)[32];
int actmtface, actmcol;
int actmtface, actmcol, bakemtface;
float obmat[4][4]; /* only used in convertblender.c, for instancing */
} ObjectRen;

@ -5417,6 +5417,9 @@ void RE_Database_Baking(Render *re, Scene *scene, int type, Object *actob)
/* renderdata setup and exceptions */
re->r= scene->r;
RE_init_threadcount(re);
re->flag |= R_GLOB_NOPUNOFLIP;
re->excludeob= actob;
if(type == RE_BAKE_LIGHT)

@ -225,7 +225,7 @@ static void env_rotate_scene(Render *re, float mat[][4], int mode)
ObjectInstanceRen *obi;
LampRen *lar = NULL;
HaloRen *har = NULL;
float imat[3][3], pmat[4][4], smat[4][4], tmat[4][4], cmat[3][3];
float imat[3][3], pmat[4][4], smat[4][4], tmat[4][4], cmat[3][3], tmpmat[4][4];
int a;
if(mode==0) {
@ -239,8 +239,10 @@ static void env_rotate_scene(Render *re, float mat[][4], int mode)
for(obi=re->instancetable.first; obi; obi=obi->next) {
/* append or set matrix depending on dupli */
if(obi->flag & R_DUPLI_TRANSFORMED)
Mat4MulMat4(obi->mat, tmat, obi->mat);
if(obi->flag & R_DUPLI_TRANSFORMED) {
Mat4CpyMat4(tmpmat, obi->mat);
Mat4MulMat4(obi->mat, tmat, tmpmat);
}
else if(mode==1)
Mat4CpyMat4(obi->mat, tmat);
else

@ -459,7 +459,14 @@ void RE_SetCamera(Render *re, Object *camera)
if(cam->type==CAM_ORTHO) re->r.mode |= R_ORTHO;
/* updating these values from ipo's/drivers is handeled by the depgraph */
/* solve this too... all time depending stuff is in convertblender.c?
* Need to update the camera early because it's used for projection matrices
* and other stuff BEFORE the animation update loop is done
* */
if(cam->ipo) {
calc_ipo(cam->ipo, frame_to_float(re->r.cfra));
execute_ipo(&cam->id, cam->ipo);
}
lens= cam->lens;
shiftx=cam->shiftx;
shifty=cam->shifty;

@ -1121,11 +1121,7 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, int winx, int winy
/* we clip faces with a minimum of 2 pixel boundary outside of image border. see zbuf.c */
re->clipcrop= 1.0f + 2.0f/(float)(re->winx>re->winy?re->winy:re->winx);
if ((rd->mode & R_FIXED_THREADS)==0 || commandline_threads == 0) { /* Automatic threads */
re->r.threads = BLI_system_thread_count();
} else if(commandline_threads >= 1 && commandline_threads<=BLENDER_MAX_THREADS) {
re->r.threads= commandline_threads;
}
RE_init_threadcount(re);
}
}
@ -2688,3 +2684,12 @@ void RE_set_max_threads(int threads)
printf("Error, threads has to be in range 1-%d\n", BLENDER_MAX_THREADS);
}
}
void RE_init_threadcount(Render *re)
{
if ((re->r.mode & R_FIXED_THREADS)==0 || commandline_threads == 0) { /* Automatic threads */
re->r.threads = BLI_system_thread_count();
} else if(commandline_threads >= 1 && commandline_threads<=BLENDER_MAX_THREADS) {
re->r.threads= commandline_threads;
}
}

@ -384,7 +384,7 @@ static float shade_by_transmission(Isect *is, ShadeInput *shi, ShadeResult *shr)
static void ray_fadeout_endcolor(float *col, ShadeInput *origshi, ShadeInput *shi, ShadeResult *shr, Isect *isec, float *vec)
{
/* un-intersected rays get either rendered material colour or sky colour */
/* un-intersected rays get either rendered material color or sky color */
if (origshi->mat->fadeto_mir == MA_RAYMIR_FADETOMAT) {
VECCOPY(col, shr->combined);
} else if (origshi->mat->fadeto_mir == MA_RAYMIR_FADETOSKY) {
@ -397,7 +397,7 @@ static void ray_fadeout_endcolor(float *col, ShadeInput *origshi, ShadeInput *sh
static void ray_fadeout(Isect *is, ShadeInput *shi, float *col, float *blendcol, float dist_mir)
{
/* if fading out, linear blend against fade colour */
/* if fading out, linear blend against fade color */
float blendfac;
blendfac = 1.0 - VecLenf(shi->co, is->start)/dist_mir;
@ -544,8 +544,8 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo
if (dist_mir > 0.0) {
float blendcol[3];
/* max ray distance set, but found an intersection, so fade this colour
* out towards the sky/material colour for a smooth transition */
/* max ray distance set, but found an intersection, so fade this color
* out towards the sky/material color for a smooth transition */
ray_fadeout_endcolor(blendcol, origshi, &shi, origshr, &isec, vec);
ray_fadeout(&isec, &shi, col, blendcol, dist_mir);
}

@ -2293,7 +2293,7 @@ static int get_next_bake_face(BakeShade *bs)
vlr= RE_findOrAddVlak(obr, v);
if((bs->actob && bs->actob == obr->ob) || (!bs->actob && (obr->ob->flag & SELECT))) {
tface= RE_vlakren_get_tface(obr, vlr, obr->actmtface, NULL, 0);
tface= RE_vlakren_get_tface(obr, vlr, obr->bakemtface, NULL, 0);
if(tface && tface->tpage) {
Image *ima= tface->tpage;
@ -2347,7 +2347,7 @@ static void shade_tface(BakeShade *bs)
VlakRen *vlr= bs->vlr;
ObjectInstanceRen *obi= bs->obi;
ObjectRen *obr= obi->obr;
MTFace *tface= RE_vlakren_get_tface(obr, vlr, obr->actmtface, NULL, 0);
MTFace *tface= RE_vlakren_get_tface(obr, vlr, obr->bakemtface, NULL, 0);
Image *ima= tface->tpage;
float vec[4][2];
int a, i1, i2, i3;

@ -501,6 +501,7 @@ void RE_set_customdata_names(ObjectRen *obr, CustomData *data)
if (layer->type == CD_MTFACE) {
strcpy(obr->mtface[mtfn++], layer->name);
obr->actmtface= layer->active_rnd;
obr->bakemtface= layer->active;
}
else if (layer->type == CD_MCOL) {
strcpy(obr->mcol[mcn++], layer->name);

@ -434,6 +434,8 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
shi->totuv= 0;
shi->totcol= 0;
shi->actuv= obr->actmtface;
shi->actcol= obr->actmcol;
if(mode & (MA_VERTEXCOL|MA_VERTEXCOLP)) {
for (i=0; (mcol=RE_strandren_get_mcol(obr, strand, i, &name, 0)); i++) {
@ -449,9 +451,9 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
}
if(shi->totcol) {
shi->vcol[0]= shi->col[0].col[0];
shi->vcol[1]= shi->col[0].col[1];
shi->vcol[2]= shi->col[0].col[2];
shi->vcol[0]= shi->col[shi->actcol].col[0];
shi->vcol[1]= shi->col[shi->actcol].col[1];
shi->vcol[2]= shi->col[shi->actcol].col[2];
}
else {
shi->vcol[0]= 0.0f;
@ -484,7 +486,7 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
suv->dyuv[1]= 0.0f;
}
if((mode & MA_FACETEXTURE) && i==0) {
if((mode & MA_FACETEXTURE) && i==obr->actmtface) {
if((mode & (MA_VERTEXCOL|MA_VERTEXCOLP))==0) {
shi->vcol[0]= 1.0f;
shi->vcol[1]= 1.0f;
@ -995,9 +997,9 @@ void shade_input_set_shade_texco(ShadeInput *shi)
}
if(shi->totcol) {
shi->vcol[0]= shi->col[0].col[0];
shi->vcol[1]= shi->col[0].col[1];
shi->vcol[2]= shi->col[0].col[2];
shi->vcol[0]= shi->col[shi->actcol].col[0];
shi->vcol[1]= shi->col[shi->actcol].col[1];
shi->vcol[2]= shi->col[shi->actcol].col[2];
shi->vcol[3]= 1.0f;
}
else {

@ -1844,24 +1844,24 @@ void do_material_tex(ShadeInput *shi)
}
}
else {
float nor[3], dot;
if(shi->mat->mode & MA_TANGENT_V) {
shi->tang[0]+= Tnor*tex->norfac*texres.nor[0];
shi->tang[1]+= Tnor*tex->norfac*texres.nor[1];
shi->tang[2]+= Tnor*tex->norfac*texres.nor[2];
}
else {
float nor[3], dot;
/* prevent bump to become negative normal */
nor[0]= Tnor*tex->norfac*texres.nor[0];
nor[1]= Tnor*tex->norfac*texres.nor[1];
nor[2]= Tnor*tex->norfac*texres.nor[2];
dot= 0.5f + 0.5f*INPR(nor, shi->vn);
/* prevent bump to become negative normal */
nor[0]= Tnor*tex->norfac*texres.nor[0];
nor[1]= Tnor*tex->norfac*texres.nor[1];
nor[2]= Tnor*tex->norfac*texres.nor[2];
shi->vn[0]+= dot*nor[0];
shi->vn[1]+= dot*nor[1];
shi->vn[2]+= dot*nor[2];
}
dot= 0.5f + 0.5f*INPR(nor, shi->vn);
shi->vn[0]+= dot*nor[0];
shi->vn[1]+= dot*nor[1];
shi->vn[2]+= dot*nor[2];
}
Normalize(shi->vn);
@ -2525,6 +2525,8 @@ void render_realtime_texture(ShadeInput *shi, Image *ima)
ShadeInputUV *suv= &shi->uv[shi->actuv];
int a;
if(R.r.scemode & R_NO_TEX) return;
if(firsttime) {
BLI_lock_thread(LOCK_IMAGE);
if(firsttime) {

@ -3299,7 +3299,7 @@ static void editing_panel_curve_tools(Object *ob, Curve *cu)
if(ob==G.obedit) {
nu= lastnu;
if(nu==NULL) nu= editNurb.first;
if(nu==NULL) nu= lastnu= editNurb.first;
if(nu) {
if (ob->type==OB_CURVE) {
uiDefBut(block, LABEL, 0, "Tilt",
@ -5070,8 +5070,6 @@ static void editing_panel_mesh_tools1(Object *ob, Mesh *me)
uiBlockEndAlign(block);
uiDefButBitS(block, TOG, B_MESH_X_MIRROR, B_DIFF, "X-axis mirror",1125,0,150,19, &G.scene->toolsettings->editbutflag, 0, 0, 0, 0, "While using transforms, mirrors the transformation");
uiDefButC(block, MENU, REDRAWBUTSEDIT, "Edge Alt-Select Mode%t|Loop Select%x0|Tag Edges (Seam)%x1|Tag Edges (Sharp)%x2|Tag Edges (Sharp)%x3|Tag Edges (Bevel)%x4",1125,88,150,19, &G.scene->toolsettings->edge_mode, 0, 0, 0, 0, "Operation to use when Alt+RMB on edges, Use Alt+Shift+RMB to tag the shortest path from the active edge");
uiBlockBeginAlign(block);
@ -5322,7 +5320,7 @@ static void editing_panel_links(Object *ob)
uiDefBut(block, BUT, B_POSEGRP_ADD, "Add Group", xco,110,140,20, 0, 21, 0, 0, 0, "Add a new Bone Group for the Pose");
uiBlockEndAlign(block);
/* colour set for 'active' group */
/* color set for 'active' group */
if (pose->active_group && grp) {
uiBlockBeginAlign(block);
menustr= build_colorsets_menustr();
@ -5339,7 +5337,7 @@ static void editing_panel_links(Object *ob)
memcpy(&grp->cs, col_set, sizeof(ThemeWireColor));
}
else {
/* init custom colours with a generic multi-colour rgb set, if not initialised already */
/* init custom colors with a generic multi-color rgb set, if not initialised already */
if (grp->cs.solid[0] == 0) {
/* define for setting colors in theme below */
#define SETCOL(col, r, g, b, a) col[0]=r; col[1]=g; col[2]= b; col[3]= a;
@ -5521,7 +5519,7 @@ void sculptmode_draw_interface_tools(uiBlock *block, unsigned short cx, unsigned
uiDefButC(block,ROW,B_NOP,"Sub",cx+89,cy,89,19,&sculptmode_brush()->dir,15.0,2.0,0, 0,"Subtract depth from model [Shift]");
}
if(sd->brush_type!=GRAB_BRUSH)
uiDefButBitC(block, TOG, SCULPT_BRUSH_AIRBRUSH, 0, "Airbrush", cx+178,cy,89,19, &sculptmode_brush()->flag,0,0,0,0, "Brush makes changes without waiting for the mouse to move");
uiDefButBitC(block, TOG, SCULPT_BRUSH_AIRBRUSH, B_NOP, "Airbrush", cx+178,cy,89,19, &sculptmode_brush()->flag,0,0,0,0, "Brush makes changes without waiting for the mouse to move");
cy-= 20;
uiDefButS(block,NUMSLI,B_NOP,"Size: ",cx,cy,268,19,&sculptmode_brush()->size,1.0,200.0,0,0,"Set brush radius in pixels");
cy-= 20;
@ -5534,9 +5532,9 @@ void sculptmode_draw_interface_tools(uiBlock *block, unsigned short cx, unsigned
uiDefBut( block,LABEL,B_NOP,"Symmetry",cx,cy,90,19,NULL,0,0,0,0,"");
cy-= 20;
uiBlockBeginAlign(block);
uiDefButBitC(block, TOG, SYMM_X, 0, "X", cx,cy,40,19, &sd->symm, 0,0,0,0, "Mirror brush across X axis");
uiDefButBitC(block, TOG, SYMM_Y, 0, "Y", cx+40,cy,40,19, &sd->symm, 0,0,0,0, "Mirror brush across Y axis");
uiDefButBitC(block, TOG, SYMM_Z, 0, "Z", cx+80,cy,40,19, &sd->symm, 0,0,0,0, "Mirror brush across Z axis");
uiDefButBitC(block, TOG, SYMM_X, B_NOP, "X", cx,cy,40,19, &sd->symm, 0,0,0,0, "Mirror brush across X axis");
uiDefButBitC(block, TOG, SYMM_Y, B_NOP, "Y", cx+40,cy,40,19, &sd->symm, 0,0,0,0, "Mirror brush across Y axis");
uiDefButBitC(block, TOG, SYMM_Z, B_NOP, "Z", cx+80,cy,40,19, &sd->symm, 0,0,0,0, "Mirror brush across Z axis");
uiBlockEndAlign(block);
@ -5545,9 +5543,9 @@ void sculptmode_draw_interface_tools(uiBlock *block, unsigned short cx, unsigned
uiDefBut( block,LABEL,B_NOP,"LockAxis",cx+140,cy,90,19,NULL,0,0,0,0,"");
cy-= 20;
uiBlockBeginAlign(block);
uiDefButBitC(block, TOG, AXISLOCK_X, 0, "X", cx+140,cy,40,19, &sd->axislock, 0,0,0,0, "Constrain X axis");
uiDefButBitC(block, TOG, AXISLOCK_Y, 0, "Y", cx+180,cy,40,19, &sd->axislock, 0,0,0,0, "Constrain Y axis");
uiDefButBitC(block, TOG, AXISLOCK_Z, 0, "Z", cx+220,cy,40,19, &sd->axislock, 0,0,0,0, "Constrain Z axis");
uiDefButBitC(block, TOG, AXISLOCK_X, B_NOP, "X", cx+140,cy,40,19, &sd->axislock, 0,0,0,0, "Constrain X axis");
uiDefButBitC(block, TOG, AXISLOCK_Y, B_NOP, "Y", cx+180,cy,40,19, &sd->axislock, 0,0,0,0, "Constrain Y axis");
uiDefButBitC(block, TOG, AXISLOCK_Z, B_NOP, "Z", cx+220,cy,40,19, &sd->axislock, 0,0,0,0, "Constrain Z axis");
uiBlockEndAlign(block);
@ -5584,7 +5582,7 @@ void sculptmode_draw_interface_brush(uiBlock *block, unsigned short cx, unsigned
if(sd->brush_type == DRAW_BRUSH)
uiDefButC(block,NUM,B_NOP, "View", cx,cy,80,19, &sculptmode_brush()->view, 0,10,20,0,"Pulls brush direction towards view");
cy-= 20;
uiDefButBitC(block, TOG, SCULPT_BRUSH_ANCHORED, 0, "Anchored", cx,cy,80,19, &sculptmode_brush()->flag, 0,0,0,0, "Keep the brush center anchored to the initial location");
uiDefButBitC(block, TOG, SCULPT_BRUSH_ANCHORED, B_NOP, "Anchored", cx,cy,80,19, &sculptmode_brush()->flag, 0,0,0,0, "Keep the brush center anchored to the initial location");
uiBlockEndAlign(block);
/* Draw curve */

@ -978,7 +978,7 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
/* IK Target */
uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", *xco, *yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", *xco, *yco-24, 80, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
/* Draw target parameters */
uiBlockBeginAlign(block);
@ -3006,9 +3006,14 @@ void do_effects_panels(unsigned short event)
case B_PART_INIT_CHILD:
case B_PART_RECALC_CHILD:
if(psys) {
Base *base;
Object *bob;
ParticleSystem *bpsys;
int flush;
nr=0;
for(psys=ob->particlesystem.first; psys; psys=psys->next){
if(ELEM(psys->part->draw_as,PART_DRAW_OB,PART_DRAW_GR))
for(bpsys=ob->particlesystem.first; bpsys; bpsys=bpsys->next){
if(ELEM(bpsys->part->draw_as,PART_DRAW_OB,PART_DRAW_GR))
nr++;
}
if(nr)
@ -3016,6 +3021,21 @@ void do_effects_panels(unsigned short event)
else
ob->transflag &= ~OB_DUPLIPARTS;
if(psys->part->type==PART_REACTOR)
if(psys->target_ob)
DAG_object_flush_update(G.scene, psys->target_ob, OB_RECALC_DATA);
for(base = G.scene->base.first; base; base= base->next) {
bob= base->object;
flush= 0;
for(bpsys=bob->particlesystem.first; bpsys; bpsys=bpsys->next)
if(bpsys->part==psys->part)
flush= 1;
if(flush)
DAG_object_flush_update(G.scene, bob, OB_RECALC_DATA);
}
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSOBJECT, 0);
@ -4117,8 +4137,9 @@ static void object_panel_particle_children(Object *ob)
uiDefButF(block, NUM, B_PART_REDRAW, "Rand:", butx+butw/2,buty,butw/2,buth, &part->childrandsize, 0.0, 1.0, 10, 1, "Random variation to the size of the child particles");
}
if(part->childtype == PART_CHILD_FACES) {
uiDefButF(block, NUM, B_PART_REDRAW, "Spread:",butx,(buty-=buth),butw/2,buth, &part->childspread, -1.0, 1.0, 10, 1, "Spread children from the faces");
uiDefButBitI(block, TOG, PART_CHILD_SEAMS, B_PART_DISTR_CHILD, "Use Seams", butx+butw/2,buty,butw/2,buth, &part->flag, 0, 0, 0, 0, "Use seams to determine parents");
/* only works if children could be emitted from volume, but that option isn't available now */
/*uiDefButF(block, NUM, B_PART_REDRAW, "Spread:",butx,(buty-=buth),butw/2,buth, &part->childspread, -1.0, 1.0, 10, 1, "Spread children from the faces");*/
uiDefButBitI(block, TOG, PART_CHILD_SEAMS, B_PART_DISTR_CHILD, "Use Seams", butx,(buty-=buth),butw,buth, &part->flag, 0, 0, 0, 0, "Use seams to determine parents");
}
uiBlockEndAlign(block);

@ -50,6 +50,7 @@
#include "BKE_sound.h"
#include "BKE_packedFile.h"
#include "BKE_utildefines.h"
#include "BKE_idprop.h"
#include "BLI_blenlib.h"
@ -109,6 +110,7 @@
#include <ffmpeg/avcodec.h> /* for PIX_FMT_* and CODEC_ID_* */
#include <ffmpeg/avformat.h>
#include <ffmpeg/opt.h>
static int ffmpeg_preset_sel = 0;
@ -1284,6 +1286,10 @@ void do_sequencer_panels(unsigned short event)
Sequence *last_seq = get_last_seq();
ScrArea * sa;
if (!last_seq) {
return;
}
switch(event) {
case B_SEQ_BUT_PLUGIN:
case B_SEQ_BUT_EFFECT:
@ -1321,6 +1327,7 @@ void do_sequencer_panels(unsigned short event)
allqueue(REDRAWALL, 0);
} else {
allqueue(REDRAWSEQ, 0);
allqueue(REDRAWBUTSSCENE, 0);
}
}
@ -1402,6 +1409,8 @@ void playback_anim(void)
#ifdef WITH_FFMPEG
static void set_ffmpeg_preset(int preset);
static int ffmpeg_property_add_string(const char * type, const char * str);
static char ffmpeg_option_to_add[255] = "";
#endif
void do_render_panels(unsigned short event)
@ -1689,6 +1698,20 @@ void do_render_panels(unsigned short event)
}
allqueue(REDRAWBUTSSCENE, 0);
allqueue(REDRAWOOPS, 0);
#ifdef WITH_FFMPEG
case B_ADD_FFMPEG_AUDIO_OPTION:
if (ffmpeg_property_add_string("audio", ffmpeg_option_to_add)){
*ffmpeg_option_to_add = 0;
}
allqueue(REDRAWBUTSSCENE, 0);
break;
case B_ADD_FFMPEG_VIDEO_OPTION:
if (ffmpeg_property_add_string("video", ffmpeg_option_to_add)){
*ffmpeg_option_to_add = 0;
}
allqueue(REDRAWBUTSSCENE, 0);
break;
#endif
}
}
@ -1833,13 +1856,14 @@ static char* ffmpeg_preset_pup(void)
static char string[2048];
char formatstring[2048];
strcpy(formatstring, "FFMpeg preset: %%t|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d");
strcpy(formatstring, "FFMpeg preset: %%t|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d");
sprintf(string, formatstring,
"", FFMPEG_PRESET_NONE,
"DVD", FFMPEG_PRESET_DVD,
"SVCD", FFMPEG_PRESET_SVCD,
"VCD", FFMPEG_PRESET_VCD,
"DV", FFMPEG_PRESET_DV);
"DV", FFMPEG_PRESET_DV,
"H264", FFMPEG_PRESET_H264);
return string;
}
@ -2274,6 +2298,442 @@ static void render_panel_anim(void)
}
#ifdef WITH_FFMPEG
static void ffmpeg_property_del(void *type, void *prop_)
{
struct IDProperty *prop = (struct IDProperty *) prop_;
IDProperty * group;
if (!G.scene->r.ffcodecdata.properties) {
return;
}
group = IDP_GetPropertyFromGroup(
G.scene->r.ffcodecdata.properties, (char*) type);
if (group && prop) {
IDP_RemFromGroup(group, prop);
IDP_FreeProperty(prop);
MEM_freeN(prop);
}
allqueue(REDRAWBUTSSCENE, 0);
}
static IDProperty * ffmpeg_property_add(
char * type, int opt_index, int parent_index)
{
AVCodecContext c;
const AVOption * o;
const AVOption * parent;
IDProperty * group;
IDProperty * prop;
IDPropertyTemplate val;
int idp_type;
char name[256];
avcodec_get_context_defaults(&c);
o = c.av_class->option + opt_index;
parent = c.av_class->option + parent_index;
if (!G.scene->r.ffcodecdata.properties) {
IDPropertyTemplate val;
G.scene->r.ffcodecdata.properties
= IDP_New(IDP_GROUP, val, "ffmpeg");
}
group = IDP_GetPropertyFromGroup(
G.scene->r.ffcodecdata.properties, (char*) type);
if (!group) {
IDPropertyTemplate val;
group = IDP_New(IDP_GROUP, val, (char*) type);
IDP_AddToGroup(G.scene->r.ffcodecdata.properties, group);
}
if (parent_index) {
sprintf(name, "%s:%s", parent->name, o->name);
} else {
strcpy(name, o->name);
}
fprintf(stderr, "ffmpeg_property_add: %s %d %d %s\n",
type, parent_index, opt_index, name);
prop = IDP_GetPropertyFromGroup(group, name);
if (prop) {
return prop;
}
switch (o->type) {
case FF_OPT_TYPE_INT:
case FF_OPT_TYPE_INT64:
val.i = o->default_val;
idp_type = IDP_INT;
break;
case FF_OPT_TYPE_DOUBLE:
case FF_OPT_TYPE_FLOAT:
val.f = o->default_val;
idp_type = IDP_FLOAT;
break;
case FF_OPT_TYPE_STRING:
val.str = " ";
idp_type = IDP_STRING;
break;
case FF_OPT_TYPE_CONST:
val.i = 1;
idp_type = IDP_INT;
break;
default:
return NULL;
}
prop = IDP_New(idp_type, val, name);
IDP_AddToGroup(group, prop);
return prop;
}
/* not all versions of ffmpeg include that, so here we go ... */
static const AVOption *my_av_find_opt(void *v, const char *name,
const char *unit, int mask, int flags){
AVClass *c= *(AVClass**)v;
const AVOption *o= c->option;
for(;o && o->name; o++){
if(!strcmp(o->name, name) &&
(!unit || (o->unit && !strcmp(o->unit, unit))) &&
(o->flags & mask) == flags )
return o;
}
return NULL;
}
static int ffmpeg_property_add_string(const char * type, const char * str)
{
AVCodecContext c;
const AVOption * o = 0;
const AVOption * p = 0;
char name_[128];
char * name;
char * param;
IDProperty * prop;
avcodec_get_context_defaults(&c);
strncpy(name_, str, 128);
name = name_;
while (*name == ' ') name++;
param = strchr(name, ':');
if (!param) {
param = strchr(name, ' ');
}
if (param) {
*param++ = 0;
while (*param == ' ') param++;
}
o = my_av_find_opt(&c, name, NULL, 0, 0);
if (!o) {
return FALSE;
}
if (param && o->type == FF_OPT_TYPE_CONST) {
return FALSE;
}
if (param && o->type != FF_OPT_TYPE_CONST && o->unit) {
p = my_av_find_opt(&c, param, o->unit, 0, 0);
prop = ffmpeg_property_add(
(char*) type, p - c.av_class->option,
o - c.av_class->option);
} else {
prop = ffmpeg_property_add(
(char*) type, o - c.av_class->option, 0);
}
if (!prop) {
return FALSE;
}
if (param && !p) {
switch (prop->type) {
case IDP_INT:
IDP_Int(prop) = atoi(param);
break;
case IDP_FLOAT:
IDP_Float(prop) = atof(param);
break;
case IDP_STRING:
strncpy(IDP_String(prop), param, prop->len);
break;
}
}
return TRUE;
}
static void ffmpeg_property_add_using_menu(void * type, int opt_indices)
{
int opt_index = opt_indices & 65535;
int parent_index = opt_indices >> 16;
ffmpeg_property_add((char*) type, opt_index, parent_index);
allqueue(REDRAWBUTSSCENE, 0);
}
static uiBlock *ffmpeg_property_add_submenu(AVOption * parent, char * type)
{
AVCodecContext c;
const AVOption * o;
uiBlock *block;
int yco = 0;
int flags = 0;
int parent_index = 0;
if (strcmp(type, "audio") == 0) {
flags = AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM;
} else if (strcmp(type, "video") == 0) {
flags = AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM;
} else {
return NULL;
}
block= uiNewBlock(&curarea->uiblocks, "ffmpeg_property_add_submenu",
UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
uiBlockSetButmFunc(block, ffmpeg_property_add_using_menu, type);
avcodec_get_context_defaults(&c);
if (parent) {
parent_index = (parent - c.av_class->option);
}
for(o = c.av_class->option; o && o->name; o++){
if (o->help &&
(strstr(o->help, "experimental")
|| strstr(o->help, "obsolete")
|| strstr(o->help, "useless")
|| strstr(o->help, "deprecated"))) {
continue;
}
if((o->flags & flags) == flags) {
if((!parent && !o->unit)
|| (o->unit && parent
&& strcmp(o->unit, parent->unit) == 0
&& o->type == FF_OPT_TYPE_CONST)) {
uiDefBut(block, BUTM, B_REDR,
(char*) (o->help && o->help[0] ?
o->help : o->name),
0, yco, 160, 15,
NULL, 0, 0, 1,
(o - c.av_class->option) |
(parent_index << 16),
"");
yco -= 16;
}
}
}
uiTextBoundsBlock(block, 50);
uiBlockSetDirection(block, UI_RIGHT);
return block;
}
static uiBlock *ffmpeg_property_add_submenu_audio(void* opt)
{
return ffmpeg_property_add_submenu((AVOption*) opt, "audio");
}
static uiBlock *ffmpeg_property_add_submenu_video(void* opt)
{
return ffmpeg_property_add_submenu((AVOption*) opt, "video");
}
static uiBlock *ffmpeg_property_add_menu(void* type_)
{
char * type = (char*) type_;
AVCodecContext c;
const AVOption * o;
uiBlock *block;
int yco = 0;
int flags = 0;
uiBlockFuncFP add_submenu = NULL;
if (strcmp(type, "audio") == 0) {
flags = AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM;
add_submenu = ffmpeg_property_add_submenu_audio;
} else if (strcmp(type, "video") == 0) {
flags = AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM;
add_submenu = ffmpeg_property_add_submenu_video;
} else {
return NULL;
}
block= uiNewBlock(&curarea->uiblocks, "ffmpeg_property_add_menu",
UI_EMBOSSP, UI_HELV, curarea->win);
avcodec_get_context_defaults(&c);
for(o = c.av_class->option; o && o->name; o++){
if((o->flags & flags) == flags) {
if (o->type == FF_OPT_TYPE_CONST) {
continue;
}
if (o->help &&
(strstr(o->help, "experimental")
|| strstr(o->help, "obsolete")
|| strstr(o->help, "useless")
|| strstr(o->help, "deprecated"))) {
continue;
}
if (o->unit) {
uiDefIconTextBlockBut(
block,
add_submenu,
(void*) o,
ICON_RIGHTARROW_THIN,
(char*) (o->help ?
o->help : o->name),
0, yco, 160, 15, "");
yco -= 16;
}
}
}
uiDefIconTextBlockBut(
block,
add_submenu,
NULL,
ICON_RIGHTARROW_THIN,
"Value / string options",
0, yco, 160, 15, "");
uiTextBoundsBlock(block, 50);
uiBlockSetDirection(block, UI_DOWN);
return block;
}
static int render_panel_ffmpeg_property_option(
uiBlock *block, int xofs, int yofs, IDProperty * curr,
const char * type)
{
AVCodecContext c;
const AVOption * o;
uiBut *but;
char name[128];
char * param;
strcpy(name, curr->name);
param = strchr(name, ':');
if (param) {
*param++ = 0;
}
avcodec_get_context_defaults(&c);
o = my_av_find_opt(&c, param ? param : name, NULL, 0, 0);
if (!o) {
return yofs;
}
switch (curr->type) {
case IDP_STRING:
uiDefBut(block, TEX,
B_REDR, curr->name,
xofs,yofs, 200,19,
IDP_String(curr),
0.0, curr->len - 1, 100, 0,
(char*) o->help);
break;
case IDP_FLOAT:
uiDefButF(block, NUM, B_REDR, curr->name,
xofs, yofs, 200, 19,
&IDP_Float(curr),
o->min, o->max, 0, 0, (char*) o->help);
break;
case IDP_INT:
if (o->type == FF_OPT_TYPE_CONST) {
uiDefButBitI(block, TOG, 1, B_REDR,
curr->name,
xofs, yofs, 200, 19,
&IDP_Int(curr),
0, 1, 0,0, (char*) o->help);
} else {
uiDefButI(block, NUM, B_REDR, curr->name,
xofs, yofs, 200, 19,
&IDP_Int(curr),
o->min, o->max, 0, 0, (char*) o->help);
}
break;
}
but = uiDefIconBut(block, BUT, B_REDR, VICON_X,
xofs + 220, yofs, 16, 16, NULL,
0.0, 0.0, 0.0, 0.0, "Delete property");
uiButSetFunc(but, ffmpeg_property_del, (void*) type, curr);
yofs -= 25;
return yofs;
}
static int render_panel_ffmpeg_properties(uiBlock *block, const char * type,
int xofs, int yofs)
{
short event = B_NOP;
yofs -= 5;
if (strcmp(type, "audio") == 0) {
event = B_ADD_FFMPEG_AUDIO_OPTION;
} else if (strcmp(type, "video") == 0) {
event = B_ADD_FFMPEG_VIDEO_OPTION;
}
uiDefBut(block, TEX, event, "", xofs, yofs,
170, 19, ffmpeg_option_to_add, 0.0, 255.0, 100, 0,
"FFMPEG option to add");
uiDefBut(block, BUT, event, "Add", xofs+170,yofs,
30, 19, 0, 0, 0, 0, 0,
"Add FFMPEG option");
uiDefBlockBut(block, ffmpeg_property_add_menu, (void*) type,
"Menu", xofs + 200, yofs, 40, 20,
"Add FFMPEG option using menu");
yofs -= 20;
if (G.scene->r.ffcodecdata.properties) {
IDProperty * prop;
void * iter;
IDProperty * curr;
prop = IDP_GetPropertyFromGroup(
G.scene->r.ffcodecdata.properties, (char*) type);
if (prop) {
iter = IDP_GetGroupIterator(prop);
while ((curr = IDP_GroupIterNext(iter)) != NULL) {
yofs = render_panel_ffmpeg_property_option(
block, xofs, yofs, curr, type);
}
}
}
uiNewPanelHeight(block, 204-yofs);
return yofs;
}
static void set_ffmpeg_preset(int preset)
{
int isntsc = (G.scene->r.frs_sec != 25);
@ -2320,6 +2780,32 @@ static void set_ffmpeg_preset(int preset)
G.scene->r.ffcodecdata.type = FFMPEG_DV;
G.scene->r.xsch = 720;
G.scene->r.ysch = isntsc ? 480 : 576;
break;
case FFMPEG_PRESET_H264:
G.scene->r.ffcodecdata.type = FFMPEG_AVI;
G.scene->r.ffcodecdata.codec = CODEC_ID_H264;
G.scene->r.ffcodecdata.video_bitrate = 6000;
G.scene->r.ffcodecdata.gop_size = isntsc ? 18 : 15;
G.scene->r.ffcodecdata.rc_max_rate = 9000;
G.scene->r.ffcodecdata.rc_min_rate = 0;
G.scene->r.ffcodecdata.rc_buffer_size = 224*8;
G.scene->r.ffcodecdata.mux_packet_size = 2048;
G.scene->r.ffcodecdata.mux_rate = 10080000;
ffmpeg_property_add_string("video", "coder:vlc");
ffmpeg_property_add_string("video", "flags:loop");
ffmpeg_property_add_string("video", "cmp:chroma");
ffmpeg_property_add_string("video", "partitions:parti4x4");
ffmpeg_property_add_string("video", "partitions:partp8x8");
ffmpeg_property_add_string("video", "partitions:partb8x8");
ffmpeg_property_add_string("video", "me:hex");
ffmpeg_property_add_string("video", "subq:5");
ffmpeg_property_add_string("video", "me_range:16");
ffmpeg_property_add_string("video", "keyint_min:25");
ffmpeg_property_add_string("video", "sc_threshold:40");
ffmpeg_property_add_string("video", "i_qfactor:0.71");
ffmpeg_property_add_string("video", "b_strategy:1");
break;
}
}
@ -2360,8 +2846,10 @@ static void render_panel_ffmpeg_video(void)
&G.scene->r.ffcodecdata.video_bitrate,
1, 14000, 0, 0, "Video bitrate(kb/s)");
uiDefButI(block, NUM, B_DIFF, "Min Rate",
xcol1, yofs+22, 110, 20, &G.scene->r.ffcodecdata.rc_min_rate,
0, 14000, 0, 0, "Rate control: min rate(kb/s)");
xcol1, yofs+22, 110, 20,
&G.scene->r.ffcodecdata.rc_min_rate,
0, G.scene->r.ffcodecdata.rc_max_rate,
0, 0, "Rate control: min rate(kb/s)");
uiDefButI(block, NUM, B_DIFF, "Max Rate",
xcol1, yofs, 110, 20, &G.scene->r.ffcodecdata.rc_max_rate,
1, 14000, 0, 0, "Rate control: max rate(kb/s)");
@ -2394,7 +2882,8 @@ static void render_panel_ffmpeg_video(void)
0, 1, 0,0, "Autosplit output at 2GB boundary.");
if (ELEM(G.scene->r.ffcodecdata.type, FFMPEG_AVI, FFMPEG_MOV)) {
if (ELEM3(G.scene->r.ffcodecdata.type, FFMPEG_AVI,
FFMPEG_MOV, FFMPEG_MKV)) {
uiDefBut(block, LABEL, 0, "Codec",
xcol1, yofs-44, 110, 20, 0, 0, 0, 0, 0, "");
uiDefButI(block, MENU,B_REDR, ffmpeg_codec_pup(),
@ -2402,6 +2891,8 @@ static void render_panel_ffmpeg_video(void)
&G.scene->r.ffcodecdata.codec,
0,0,0,0, "FFMpeg codec to use");
}
render_panel_ffmpeg_properties(block, "video", xcol1, yofs-86);
}
static void render_panel_ffmpeg_audio(void)
@ -2431,6 +2922,8 @@ static void render_panel_ffmpeg_audio(void)
xcol, yofs-66, 110, 20,
&G.scene->r.ffcodecdata.audio_bitrate,
32, 384, 0, 0, "Audio bitrate(kb/s)");
render_panel_ffmpeg_properties(block, "audio", xcol, yofs-86);
}
#endif

@ -2681,7 +2681,8 @@ static void lamp_panel_spot(Object *ob, Lamp *la)
uiDefButF(block, NUM,B_LAMPREDRAW,"Soft Size", 100,80,200,19, &la->area_size, 0.01, 100.0, 10, 0, "Area light size, doesn't affect energy amount");
uiDefButS(block, NUM,0,"Samples:", 100,60,200,19, &la->ray_samp, 1.0, 16.0, 100, 0, "Sets the amount of samples taken extra (samp x samp)");
uiDefButF(block, NUM,0,"Threshold:", 100,40,200,19, &la->adapt_thresh, 0.0, 1.0, 100, 0, "Threshold for adaptive sampling, to control what level is considered already in shadow");
if (la->ray_samp_method == LA_SAMP_HALTON)
uiDefButF(block, NUM,0,"Threshold:", 100,40,200,19, &la->adapt_thresh, 0.0, 1.0, 100, 0, "Threshold for adaptive sampling, to control what level is considered already in shadow");
}
else if (la->type == LA_AREA) {
uiDefButS(block, MENU, B_REDR, "Adaptive QMC %x1|Constant QMC %x2|Constant Jittered %x0",
@ -2887,8 +2888,8 @@ static void lamp_panel_lamp(Object *ob, Lamp *la)
uiBlockBeginAlign(block);
if (ELEM(la->type, LA_LOCAL, LA_SPOT) && (la->falloff_type == LA_FALLOFF_SLIDERS)) {
uiDefButF(block, NUMSLI,B_LAMPPRV,"Linear ", 120,30,180,19,&la->att1, 0.0, 1.0, 0, 0, "Set the linear distance attenuatation for a quad lamp");
uiDefButF(block, NUMSLI,B_LAMPPRV,"Quad ", 120,10,180,19,&la->att2, 0.0, 1.0, 0, 0, "Set the quadratic distance attenuatation for a quad lamp");
uiDefButF(block, NUMSLI,B_LAMPPRV,"Linear ", 120,30,180,19,&la->att1, 0.0, 1.0, 0, 0, "Set the linear distance attenuation for a Lin/Quad Weighted lamp");
uiDefButF(block, NUMSLI,B_LAMPPRV,"Quad ", 120,10,180,19,&la->att2, 0.0, 1.0, 0, 0, "Set the quadratic distance attenuation for a Lin/Quad Weighted lamp");
}
else if(la->type==LA_AREA) {
if(la->k==0.0) la->k= 1.0;
@ -3288,7 +3289,7 @@ static void material_panel_map_to(Object *ob, Material *ma, int from_nodes)
//uiButSetFunc(but, particle_recalc_material, ma, NULL);
but=uiDefButBitS(block, TOG3, MAP_PA_KINK, B_MAT_PARTICLE, "Kink", 70,160,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the kink of child particles");
//uiButSetFunc(but, particle_recalc_material, ma, NULL);
but=uiDefButBitS(block, TOG3, MAP_PA_LENGTH, B_MAT_PARTICLE, "Length",130,160,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the length of particles");
but=uiDefButBitS(block, TOG3, MAP_PA_LENGTH, B_MAT_PARTICLE, "Length",130,160,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the length of child particles");
//uiButSetFunc(but, particle_recalc_material, ma, NULL);
but=uiDefButBitS(block, TOG3, MAP_PA_CLUMP, B_MAT_PARTICLE, "Clump", 190,160,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the clump of child particles");
//uiButSetFunc(but, particle_recalc_material, ma, NULL);
@ -3298,10 +3299,10 @@ static void material_panel_map_to(Object *ob, Material *ma, int from_nodes)
uiBlockSetCol(block, TH_AUTO);
}
else {
uiDefButBitS(block, TOG, MAP_COL, B_MATPRV, "Col", 10,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect basic colour of the material");
uiDefButBitS(block, TOG, MAP_COL, B_MATPRV, "Col", 10,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect basic color of the material");
uiDefButBitS(block, TOG3, MAP_NORM, B_MATPRV, "Nor", 50,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the rendered normal");
uiDefButBitS(block, TOG, MAP_COLSPEC, B_MATPRV, "Csp", 90,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the specularity colour");
uiDefButBitS(block, TOG, MAP_COLMIR, B_MATPRV, "Cmir", 130,180,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the mirror colour");
uiDefButBitS(block, TOG, MAP_COLSPEC, B_MATPRV, "Csp", 90,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the specularity color");
uiDefButBitS(block, TOG, MAP_COLMIR, B_MATPRV, "Cmir", 130,180,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the mirror color");
uiDefButBitS(block, TOG3, MAP_REF, B_MATPRV, "Ref", 180,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the value of the materials reflectivity");
uiDefButBitS(block, TOG3, MAP_SPEC, B_MATPRV, "Spec", 220,180,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the value of specularity");
uiDefButBitS(block, TOG3, MAP_AMB, B_MATPRV, "Amb", 270,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the value of ambient");

@ -634,7 +634,7 @@ static void draw_channel_names(void)
}
else {
/* for normal channels
* - use 3 shades of color group/standard colour for 3 indention level
* - use 3 shades of color group/standard color for 3 indention level
* - only use group colors if allowed to, and if actually feasible
*/
if ( !(G.saction->flag & SACTION_NODRAWGCOLORS) &&
@ -1254,7 +1254,7 @@ static void draw_key_but(int x, int y, short w, short h, int sel)
int xmax= x+w-1, ymax= y+h-1;
int xc= (xmin+xmax)/2, yc= (ymin+ymax)/2;
/* interior - hardcoded colours (for selected and unselected only) */
/* interior - hardcoded colors (for selected and unselected only) */
if (sel) glColor3ub(0xF1, 0xCA, 0x13);
else glColor3ub(0xE9, 0xE9, 0xE9);

@ -96,7 +96,7 @@ static ThemeWireColor *bcolor= NULL;
/* values of colCode for set_pchan_glcolor */
enum {
PCHAN_COLOR_NORMAL = 0, /* normal drawing */
PCHAN_COLOR_SOLID, /* specific case where "solid" colour is needed */
PCHAN_COLOR_SOLID, /* specific case where "solid" color is needed */
PCHAN_COLOR_CONSTS, /* "constraint" colors (which may/may-not be suppressed) */
PCHAN_COLOR_SPHEREBONE_BASE, /* for the 'stick' of sphere (envelope) bones */
@ -1186,7 +1186,7 @@ static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsign
/* wire */
if (armflag & ARM_POSEMODE) {
if (constflag) {
/* set constraint colours */
/* set constraint colors */
if (set_pchan_glColor(PCHAN_COLOR_CONSTS, armflag, boneflag, constflag)) {
glEnable(GL_BLEND);
@ -1618,7 +1618,7 @@ static void draw_pose_channels(Base *base, int dt)
}
/* very very confusing... but in object mode, solid draw, we cannot do glLoadName yet,
* stick bones and/or wire custom-shpaes are drawn in next loop
* stick bones and/or wire custom-shapes are drawn in next loop
*/
if ((arm->drawtype != ARM_LINE) && (draw_wire == 0)) {
/* object tag, for bordersel optim */
@ -1645,7 +1645,7 @@ static void draw_pose_channels(Base *base, int dt)
glPushMatrix();
glMultMatrixf(pchan->pose_mat);
/* prepare colours */
/* prepare colors */
if (arm->flag & ARM_POSEMODE)
set_pchan_colorset(ob, pchan);
else {
@ -2090,7 +2090,7 @@ static void draw_pose_paths(Object *ob)
for (a=0, fp=fp_start; a<len; a++, fp+=3) {
float intensity; /* how faint */
/* set colour
/* set color
* - more intense for active/selected bones, less intense for unselected bones
* - black for before current frame, green for current frame, blue for after current frame
* - intensity decreases as distance from current frame increases
@ -2131,7 +2131,7 @@ static void draw_pose_paths(Object *ob)
BIF_ThemeColorBlendShade(TH_CFRAME, TH_BACK, intensity, 10);
}
/* draw a vertex with this colour */
/* draw a vertex with this color */
glVertex3fv(fp);
}

@ -367,7 +367,10 @@ static void drawcursor_sima(float xuser_asp, float yuser_asp)
int wi, hi;
float w, h;
if (!G.obedit || !CustomData_has_layer(&G.editMesh->fdata, CD_MTFACE)) return;
if ( !G.obedit || /* only draw cursor in editmode */
!CustomData_has_layer(&G.editMesh->fdata, CD_MTFACE) || /* must have UV's */
(G.sima->image && G.sima->flag & SI_DRAWTOOL) /* cant be painting */
) return;
transform_width_height_tface_uv(&wi, &hi);
w = (((float)wi)/256.0f)*G.sima->zoom * xuser_asp;
@ -1486,6 +1489,10 @@ static void image_panel_paint(short cntrl) // IMAGE_HANDLER_PAINT
ID *id;
int yco, xco, butw;
if ((G.sima->image && (G.sima->flag & SI_DRAWTOOL))==0) {
return;
}
block= uiNewBlock(&curarea->uiblocks, "image_panel_paint", UI_EMBOSS, UI_HELV, curarea->win);
uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
uiSetPanelHandler(IMAGE_HANDLER_PAINT); // for close and esc

@ -4228,6 +4228,7 @@ static void draw_forcefield(Object *ob)
drawcircball(GL_LINE_LOOP, vec, size, tmat);
vec[2]= 1.5*force_val;
drawcircball(GL_LINE_LOOP, vec, size, tmat);
vec[2] = 0; /* reset vec for max dist circle */
}
else if (pd->forcefield == PFIELD_FORCE) {

@ -3398,12 +3398,12 @@ static float redrawtimes_fps[REDRAW_FRAME_AVERAGE];
static short redrawtime_index;
int update_time(void)
int update_time(int cfra)
{
static double ltime;
double time;
if ((audiostream_pos() != CFRA)
if ((audiostream_pos() != cfra)
&& (G.scene->audio.flag & AUDIO_SYNC)) {
return 0;
}
@ -3641,7 +3641,7 @@ void inner_play_anim_loop(int init, int mode)
/* make sure that swaptime passed by */
tottime -= swaptime;
while (update_time()) {
while (update_time(CFRA)) {
PIL_sleep_ms(1);
}
@ -3700,7 +3700,7 @@ int play_anim(int mode)
inner_play_prefetch_startup(mode);
update_time();
update_time(CFRA);
inner_play_anim_loop(1, mode); /* 1==init */

@ -1530,35 +1530,11 @@ void snap_curs_to_active()
if (G.obedit->type == OB_MESH)
{
/* check active */
if (G.editMesh->selected.last) {
EditSelection *ese = G.editMesh->selected.last;
if ( ese->type == EDITVERT ) {
EditVert *eve = (EditVert *)ese->data;
VECCOPY(curs, eve->co);
}
else if ( ese->type == EDITEDGE ) {
EditEdge *eed = (EditEdge *)ese->data;
VecAddf(curs, eed->v1->co, eed->v2->co);
VecMulf(curs, 0.5f);
}
else if ( ese->type == EDITFACE ) {
EditFace *efa = (EditFace *)ese->data;
if (efa->v4)
{
VecAddf(curs, efa->v1->co, efa->v2->co);
VecAddf(curs, curs, efa->v3->co);
VecAddf(curs, curs, efa->v4->co);
VecMulf(curs, 0.25f);
}
else
{
VecAddf(curs, efa->v1->co, efa->v2->co);
VecAddf(curs, curs, efa->v3->co);
VecMulf(curs, 1/3.0f);
}
}
EditSelection ese;
if (EM_get_actSelection(&ese)) {
EM_editselection_center(curs, &ese);
}
Mat4MulVecfl(G.obedit->obmat, curs);
}
}

@ -1161,7 +1161,7 @@ void verify_pchan2achan_grouping (bAction *act, bPose *pose, char name[])
memcpy(&grp->cs, col_set, sizeof(ThemeWireColor));
}
else {
/* init custom colours with a generic multi-colour rgb set, if not initialised already */
/* init custom colors with a generic multi-color rgb set, if not initialised already */
if (agrp->cs.solid[0] == 0) {
/* define for setting colors in theme below */
#define SETCOL(col, r, g, b, a) col[0]=r; col[1]=g; col[2]= b; col[3]= a;
@ -1221,7 +1221,7 @@ void sync_pchan2achan_grouping ()
achan->grp = NULL;
BLI_freelistN(&act->groups);
/* loop through all achans, reassigning them to groups (colours are resyncronised) */
/* loop through all achans, reassigning them to groups (colors are resyncronised) */
last= act->chanbase.last;
for (achan= act->chanbase.first; achan && achan!=last; achan= next) {
next= achan->next;
@ -2564,7 +2564,7 @@ static void select_poseelement_by_name (char *name, int select)
if ((ob==NULL) || (ob->type!=OB_ARMATURE))
return;
if (select == 2) {
if (abs(select) == 2) {
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next)
pchan->bone->flag &= ~(BONE_ACTIVE);
}
@ -3263,6 +3263,8 @@ void borderselect_actionchannels (void)
}
break;
case ACTTYPE_ACHAN: /* action channel */
case ACTTYPE_FILLIPO: /* expand ipo curves = action channel */
case ACTTYPE_FILLCON: /* expand constraint channels = action channel */
{
bActionChannel *achan= (bActionChannel *)ale->data;
@ -3270,6 +3272,9 @@ void borderselect_actionchannels (void)
achan->flag |= ACHAN_SELECTED;
else
achan->flag &= ~ACHAN_SELECTED;
/* messy... set active bone */
select_poseelement_by_name(achan->name, selectmode);
}
break;
case ACTTYPE_CONCHAN: /* constraint channel */
@ -3293,6 +3298,14 @@ void borderselect_actionchannels (void)
}
break;
}
/* select action-channel 'owner' */
if ((ale->owner) && (ale->ownertype == ACTTYPE_ACHAN)) {
bActionChannel *achano= (bActionChannel *)ale->owner;
/* messy... set active bone */
select_poseelement_by_name(achano->name, selectmode);
}
}
ymax=ymin;
@ -3305,6 +3318,7 @@ void borderselect_actionchannels (void)
allqueue(REDRAWIPO, 0);
allqueue(REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
allqueue(REDRAWVIEW3D, 0);
}
}

@ -55,6 +55,8 @@
#include "DNA_userdef_types.h"
#include "DNA_view3d_types.h"
#include "DNA_modifier_types.h"
#include "DNA_ipo_types.h"
#include "DNA_curve_types.h"
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
@ -661,9 +663,10 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
Object *ob;
bPoseChannel *pchan, *pcha, *pchb;
bConstraint *con;
ListBase *npchans;
ListBase *opchans, *npchans;
/* get reference to list of bones in new armature */
/* get reference to list of bones in original and new armatures */
opchans= &origArm->pose->chanbase;
npchans= &newArm->pose->chanbase;
/* let's go through all objects in database */
@ -682,8 +685,8 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
for (ct= targets.first; ct; ct= ct->next) {
/* any targets which point to original armature are redirected to the new one only if:
* - the target isn't the original armature itself
* - the target is one that can be found in newArm
* - the target isn't origArm/newArm itself
* - the target is one that can be found in newArm/origArm
*/
if ((ct->tar == origArm) && (ct->subtarget[0] != 0)) {
for (pcha=npchans->first, pchb=npchans->last; pcha && pchb; pcha=pcha->next, pchb=pchb->prev) {
@ -695,6 +698,20 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
break;
}
/* check if both ends have met (to stop checking) */
if (pcha == pchb) break;
}
}
else if ((ct->tar == newArm) && (ct->subtarget[0] != 0)) {
for (pcha=opchans->first, pchb=opchans->last; pcha && pchb; pcha=pcha->next, pchb=pchb->prev) {
/* check if either one matches */
if ( (strcmp(pcha->name, ct->subtarget)==0) ||
(strcmp(pchb->name, ct->subtarget)==0) )
{
ct->tar= origArm;
break;
}
/* check if both ends have met (to stop checking) */
if (pcha == pchb) break;
}
@ -721,8 +738,8 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
for (ct= targets.first; ct; ct= ct->next) {
/* any targets which point to original armature are redirected to the new one only if:
* - the target isn't the original armature itself
* - the target is one of the bones which were moved into newArm
* - the target isn't origArm/newArm itself
* - the target is one that can be found in newArm/origArm
*/
if ((ct->tar == origArm) && (ct->subtarget[0] != 0)) {
for (pcha=npchans->first, pchb=npchans->last; pcha && pchb; pcha=pcha->next, pchb=pchb->prev) {
@ -734,6 +751,20 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
break;
}
/* check if both ends have met (to stop checking) */
if (pcha == pchb) break;
}
}
else if ((ct->tar == newArm) && (ct->subtarget[0] != 0)) {
for (pcha=opchans->first, pchb=opchans->last; pcha && pchb; pcha=pcha->next, pchb=pchb->prev) {
/* check if either one matches */
if ( (strcmp(pcha->name, ct->subtarget)==0) ||
(strcmp(pchb->name, ct->subtarget)==0) )
{
ct->tar= origArm;
break;
}
/* check if both ends have met (to stop checking) */
if (pcha == pchb) break;
}
@ -829,12 +860,6 @@ void separate_armature (void)
Base *base, *oldbase, *newbase;
bArmature *arm;
// 31 Mar 08 \ 11 May 08 - Aligorith:
// currently, this is still too unstable to be enabled for general consumption.
// remove the following two lines to test this tool... you have been warned!
// okee("Not implemented (WIP)");
// return;
if ( G.vd==0 || (G.vd->lay & G.obedit->lay)==0 ) return;
if ( okee("Separate")==0 ) return;
@ -2948,6 +2973,8 @@ void extrude_armature(int forked)
newbone->parent = ebone;
newbone->flag = ebone->flag & BONE_TIPSEL; // copies it, in case mirrored bone
if (newbone->parent) newbone->flag |= BONE_CONNECTED;
}
else {
VECCOPY(newbone->head, ebone->head);
@ -2955,6 +2982,10 @@ void extrude_armature(int forked)
newbone->parent= ebone->parent;
newbone->flag= BONE_TIPSEL;
if (newbone->parent && ebone->flag & BONE_CONNECTED) {
newbone->flag |= BONE_CONNECTED;
}
}
newbone->weight= ebone->weight;
@ -2968,8 +2999,6 @@ void extrude_armature(int forked)
newbone->segments= 1;
newbone->layer= ebone->layer;
if (newbone->parent) newbone->flag |= BONE_CONNECTED;
BLI_strncpy (newbone->name, ebone->name, 32);
if (flipbone && forked) { // only set if mirror edit
@ -3827,7 +3856,7 @@ void unique_bone_name (bArmature *arm, char *name)
}
#define MAXBONENAME 32
/* helper call for below */
/* helper call for armature_bone_rename */
static void constraint_bone_name_fix(Object *ob, ListBase *conlist, char *oldname, char *newname)
{
bConstraint *curcon;
@ -3859,6 +3888,7 @@ static void constraint_bone_name_fix(Object *ob, ListBase *conlist, char *oldnam
void armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
{
Object *ob;
Ipo *ipo;
char newname[MAXBONENAME];
char oldname[MAXBONENAME];
@ -3882,7 +3912,7 @@ void armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
else return;
}
else {
Bone *bone= get_named_bone (arm, oldname);
Bone *bone= get_named_bone(arm, oldname);
if (bone) {
unique_bone_name (arm, newname);
@ -3891,7 +3921,7 @@ void armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
else return;
}
/* do entire dbase */
/* do entire dbase - objects */
for (ob= G.main->object.first; ob; ob= ob->id.next) {
/* we have the object using the armature */
if (arm==ob->data) {
@ -3913,7 +3943,7 @@ void armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
if (ob->pose) {
bPoseChannel *pchan = get_pose_channel(ob->pose, oldname);
if (pchan)
BLI_strncpy (pchan->name, newname, MAXBONENAME);
BLI_strncpy(pchan->name, newname, MAXBONENAME);
}
/* check all nla-strips too */
@ -3959,6 +3989,28 @@ void armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
}
}
}
/* do entire db - ipo's for the drivers */
for (ipo= G.main->ipo.first; ipo; ipo= ipo->id.next) {
IpoCurve *icu;
/* check each curve's driver */
for (icu= ipo->curve.first; icu; icu= icu->next) {
IpoDriver *icd= icu->driver;
if ((icd) && (icd->ob)) {
ob= icd->ob;
if (icu->driver->type == IPO_DRIVER_TYPE_NORMAL) {
if (!strcmp(oldname, icd->name))
BLI_strncpy(icd->name, newname, MAXBONENAME);
}
else {
/* TODO: pydrivers need to be treated differently */
}
}
}
}
}
}

@ -681,7 +681,7 @@ static void test_constraints (Object *owner, const char substring[])
Bone *bone;
bPoseChannel *chan;
bone = get_named_bone( ((bArmature *)owner->data ), substring );
bone = get_named_bone( ((bArmature *)owner->data), substring );
chan = get_pose_channel(owner->pose, substring);
if (bone && chan) {
conlist = &chan->constraints;
@ -831,9 +831,9 @@ static void test_bonelist_constraints (Object *owner, ListBase *list)
{
Bone *bone;
for (bone = list->first; bone; bone=bone->next) {
for (bone = list->first; bone; bone = bone->next) {
test_constraints(owner, bone->name);
test_bonelist_constraints (owner, &bone->childbase);
test_bonelist_constraints(owner, &bone->childbase);
}
}
@ -845,7 +845,7 @@ void object_test_constraints (Object *owner)
bArmature *arm= get_armature(owner);
if (arm)
test_bonelist_constraints (owner, &arm->bonebase);
test_bonelist_constraints(owner, &arm->bonebase);
}
}

@ -3658,6 +3658,11 @@ void delNurb()
}
}
}
/* Never allow the order to exceed the number of points */
if ((nu->type & 7)==CU_NURBS && (nu->pntsu < nu->orderu)) {
nu->orderu = nu->pntsu;
}
nu= next;
}
/* 2nd loop, delete small pieces: just for curves */
@ -3669,7 +3674,7 @@ void delNurb()
bezt= nu->bezt;
for(a=0;a<nu->pntsu;a++) {
if( BEZSELECTED_HIDDENHANDLES(bezt) ) {
memcpy(bezt, bezt+1, (nu->pntsu-a-1)*sizeof(BezTriple));
memmove(bezt, bezt+1, (nu->pntsu-a-1)*sizeof(BezTriple));
nu->pntsu--;
a--;
event= 1;
@ -3690,7 +3695,7 @@ void delNurb()
for(a=0;a<nu->pntsu;a++) {
if( bp->f1 & SELECT ) {
memcpy(bp, bp+1, (nu->pntsu-a-1)*sizeof(BPoint));
memmove(bp, bp+1, (nu->pntsu-a-1)*sizeof(BPoint));
nu->pntsu--;
a--;
event= 1;
@ -3704,6 +3709,11 @@ void delNurb()
memcpy(bp1, nu->bp, (nu->pntsu)*sizeof(BPoint) );
MEM_freeN(nu->bp);
nu->bp= bp1;
/* Never allow the order to exceed the number of points */
if ((nu->type & 7)==CU_NURBS && (nu->pntsu < nu->orderu)) {
nu->orderu = nu->pntsu;
}
}
makeknots(nu, 1, nu->flagu>>1);
}

@ -151,33 +151,6 @@ int facesel_face_pick(Mesh *me, short *mval, unsigned int *index, short rect)
return 1;
}
#if 0 // not used
/* returns 0 if not found, otherwise 1 */
static int facesel_edge_pick(Mesh *me, short *mval, unsigned int *index)
{
int dist;
unsigned int min = me->totface + 1;
unsigned int max = me->totface + me->totedge + 1;
if (me->totedge == 0)
return 0;
if (G.vd->flag & V3D_NEEDBACKBUFDRAW) {
check_backbuf();
persp(PERSP_VIEW);
}
*index = sample_backbuf_rect(mval, 50, min, max, &dist,0,NULL);
if (*index == 0)
return 0;
(*index)--;
return 1;
}
#endif
/* only operates on the edit object - this is all thats needed at the moment */
static void uv_calc_center_vector(float *result, Object *ob, EditMesh *em)
{

@ -116,6 +116,7 @@
#include "BSE_headerbuttons.h"
#include "BSE_node.h"
#include "BSE_sequence.h"
#include "BSE_seqaudio.h"
#include "BSE_time.h"
#include "blendef.h"
@ -5671,6 +5672,7 @@ void ipo_record(void)
}
sa= sa->next;
}
if(sa) areawinset(sa->win);
/* can we? */
@ -5689,6 +5691,10 @@ void ipo_record(void)
cfra=efra= SFRA;
sfra= EFRA;
if (G.scene->audio.flag & AUDIO_SYNC) {
audiostream_start(cfra);
}
while(afbreek==0) {
getmouseco_areawin(mval);
@ -5729,7 +5735,7 @@ void ipo_record(void)
/* minimal wait swaptime */
tottime -= swaptime;
while (update_time()) PIL_sleep_ms(1);
while (update_time(cfra)) PIL_sleep_ms(1);
screen_swapbuffers();
@ -5739,8 +5745,18 @@ void ipo_record(void)
mvalo[1]= mval[1];
if(anim || (G.qual & LR_CTRLKEY)) {
cfra++;
if(cfra>EFRA) cfra= SFRA;
if (G.scene->audio.flag & AUDIO_SYNC) {
cfra = audiostream_pos();
} else {
cfra++;
}
if(cfra>EFRA) {
cfra= SFRA;
if (G.scene->audio.flag & AUDIO_SYNC) {
audiostream_stop();
audiostream_start( cfra );
}
}
}
}
@ -5793,6 +5809,9 @@ void ipo_record(void)
editipo_changed(G.sipo, 0);
do_ipo(G.sipo->ipo);
waitcursor(0);
if (G.scene->audio.flag & AUDIO_SYNC) {
audiostream_stop();
}
allqueue(REDRAWVIEW3D, 0);
if(sa) scrarea_queue_headredraw(sa); /* headerprint */

@ -103,6 +103,35 @@ EditFace * EM_get_actFace(int sloppy)
return NULL;
}
int EM_get_actSelection(EditSelection *ese)
{
EditSelection *ese_last = G.editMesh->selected.last;
EditFace *efa = EM_get_actFace(0);
ese->next = ese->prev = NULL;
if (ese_last) {
if (ese_last->type == EDITFACE) { /* if there is an active face, use it over the last selected face */
if (efa) {
ese->data = (void *)efa;
} else {
ese->data = ese_last->data;
}
ese->type = EDITFACE;
} else {
ese->data = ese_last->data;
ese->type = ese_last->type;
}
} else if (efa) { /* no */
ese->data = (void *)efa;
ese->type = EDITFACE;
} else {
ese->data = NULL;
return 0;
}
return 1;
}
/* ********* Selection History ************ */
static int EM_check_selection(void *data)
{

@ -1458,7 +1458,7 @@ void mesh_copy_menu(void)
eed_act = (EditEdge*)ese->data;
ret= pupmenu("Copy Active Edge to Selected%t|Crease%x1|Length%x2");
ret= pupmenu("Copy Active Edge to Selected%t|Crease%x1|Bevel Weight%x2|Length%x3");
if (ret<1) return;
eed_len_act = VecLenf(eed_act->v1->co, eed_act->v2->co);
@ -1472,8 +1472,16 @@ void mesh_copy_menu(void)
}
}
break;
case 2: /* copy bevel weight */
for(eed=em->edges.first; eed; eed=eed->next) {
if (eed->f & SELECT && eed != eed_act && eed->bweight != eed_act->bweight) {
eed->bweight = eed_act->bweight;
change = 1;
}
}
break;
case 2: /* copy length */
case 3: /* copy length */
for(eed=em->edges.first; eed; eed=eed->next) {
if (eed->f & SELECT && eed != eed_act) {
@ -3187,12 +3195,14 @@ void select_non_manifold(void)
}
/* select isolated verts */
eve= em->verts.first;
while(eve) {
if (eve->f1 == 0) {
if (!eve->h) eve->f |= SELECT;
if(G.scene->selectmode & SCE_SELECT_VERTEX) {
eve= em->verts.first;
while(eve) {
if (eve->f1 == 0) {
if (!eve->h) eve->f |= SELECT;
}
eve= eve->next;
}
eve= eve->next;
}
countall();

@ -6758,7 +6758,7 @@ void mesh_mirror_uvs(void)
{
EditMesh *em = G.editMesh;
EditFace *efa;
short change = 0;
short change = 0, altaxis;
MTFace *tf;
float u1, v1;
@ -6767,32 +6767,64 @@ void mesh_mirror_uvs(void)
return;
}
altaxis = (G.qual == LR_SHIFTKEY);
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
u1= tf->uv[0][0];
v1= tf->uv[0][1];
if(efa->v4) {
tf->uv[0][0]= tf->uv[3][0];
tf->uv[0][1]= tf->uv[3][1];
tf->uv[3][0]= u1;
tf->uv[3][1]= v1;
if (altaxis) {
u1= tf->uv[1][0];
v1= tf->uv[1][1];
if(efa->v4) {
tf->uv[1][0]= tf->uv[2][0];
tf->uv[1][1]= tf->uv[2][1];
tf->uv[1][0]= tf->uv[2][0];
tf->uv[1][1]= tf->uv[2][1];
tf->uv[2][0]= u1;
tf->uv[2][1]= v1;
}
else {
tf->uv[0][0]= tf->uv[2][0];
tf->uv[0][1]= tf->uv[2][1];
tf->uv[2][0]= u1;
tf->uv[2][1]= v1;
tf->uv[2][0]= u1;
tf->uv[2][1]= v1;
u1= tf->uv[3][0];
v1= tf->uv[3][1];
tf->uv[3][0]= tf->uv[0][0];
tf->uv[3][1]= tf->uv[0][1];
tf->uv[0][0]= u1;
tf->uv[0][1]= v1;
}
else {
tf->uv[1][0]= tf->uv[2][0];
tf->uv[1][1]= tf->uv[2][1];
tf->uv[2][0]= u1;
tf->uv[2][1]= v1;
}
} else {
u1= tf->uv[0][0];
v1= tf->uv[0][1];
if(efa->v4) {
tf->uv[0][0]= tf->uv[1][0];
tf->uv[0][1]= tf->uv[1][1];
tf->uv[1][0]= u1;
tf->uv[1][1]= v1;
u1= tf->uv[3][0];
v1= tf->uv[3][1];
tf->uv[3][0]= tf->uv[2][0];
tf->uv[3][1]= tf->uv[2][1];
tf->uv[2][0]= u1;
tf->uv[2][1]= v1;
}
else {
tf->uv[0][0]= tf->uv[1][0];
tf->uv[0][1]= tf->uv[1][1];
tf->uv[1][0]= u1;
tf->uv[1][1]= v1;
}
}
change = 1;
}
@ -6858,27 +6890,38 @@ void mesh_mirror_colors(void)
{
EditMesh *em = G.editMesh;
EditFace *efa;
short change = 0;
short change = 0, altaxis;
MCol tmpcol, *mcol;
if (!EM_vertColorCheck()) {
error("mesh has no color layers");
return;
}
altaxis = (G.qual == LR_SHIFTKEY);
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT) {
mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
tmpcol= mcol[0];
mcol[0]= mcol[1];
mcol[1]= mcol[2];
if(efa->v4) {
mcol[2]= mcol[3];
mcol[3]= tmpcol;
}
else {
if (altaxis) {
tmpcol= mcol[1];
mcol[1]= mcol[2];
mcol[2]= tmpcol;
if(efa->v4) {
tmpcol= mcol[0];
mcol[0]= mcol[3];
mcol[3]= tmpcol;
}
} else {
tmpcol= mcol[0];
mcol[0]= mcol[1];
mcol[1]= tmpcol;
if(efa->v4) {
tmpcol= mcol[2];
mcol[2]= mcol[3];
mcol[3]= tmpcol;
}
}
change = 1;
}

@ -198,7 +198,7 @@ static int image_detect_file_sequence(int *start_p, int *frames_p, char *str)
unsigned short numlen;
sfile= scrarea_find_space_of_type(curarea, SPACE_FILE);
if(sfile==0)
if(sfile==NULL || sfile->filelist==NULL)
return 0;
/* find first frame */

@ -2891,7 +2891,7 @@ void enter_meta(void)
ed= G.scene->ed;
if(ed==0) return;
if(last_seq==0 || last_seq->type!=SEQ_META || last_seq->flag==0) {
if(last_seq==0 || last_seq->type!=SEQ_META || (last_seq->flag & SELECT)==0) {
exit_meta();
return;
}

@ -1217,7 +1217,7 @@ void snap_menu_sima(void)
short event;
if( is_uv_tface_editing_allowed()==0 || !G.v2d) return; /* !G.v2d should never happen */
event = pupmenu("Snap %t|Selection -> Pixels%x1|Selection -> Cursor%x2|Selection -> Adjacent Unselected%x3|Cursor -> Pixel%x4|Cursor -> Selection%x5");
event = pupmenu("Snap %t|Selection -> Pixels%x1|Selection -> Cursor%x2|Selection -> Adjacent Unselected%x3|Cursor -> Selection%x4|Cursor -> Pixel%x5");
switch (event) {
case 1:
if (snap_uv_sel_to_pixels()) {
@ -1238,13 +1238,13 @@ void snap_menu_sima(void)
}
break;
case 4:
snap_uv_curs_to_pixels();
scrarea_queue_winredraw(curarea);
break;
case 5:
if (snap_uv_curs_to_sel())
allqueue(REDRAWIMAGE, 0);
break;
case 5:
snap_uv_curs_to_pixels();
scrarea_queue_winredraw(curarea);
break;
}
}

@ -2764,7 +2764,7 @@ void fly(void)
do_screenhandlers(G.curscreen); /* advance the next frame */
/* we are in camera view so apply the view ofs and quat to the view matrix and set the camera to teh view */
/* we are in camera view so apply the view ofs and quat to the view matrix and set the camera to the view */
if (G.vd->persp==V3D_CAMOB) {
G.vd->persp= V3D_PERSP; /*set this so setviewmatrixview3d uses the ofs and quat instead of the camera */
setviewmatrixview3d();

@ -1578,8 +1578,7 @@ static void do_filesel_buttons(short event, SpaceFile *sfile)
BLI_strncpy(sfile->dir, butname, sizeof(sfile->dir));
/* strip the trailing slash if its a real dir */
if (strlen(butname)!=1)
butname[strlen(butname)-1]=0;
BLI_del_slash(butname);
if(sfile->type & FILE_UNIX) {
if (!BLI_exists(butname)) {
@ -1623,6 +1622,11 @@ static void do_filesel_buttons(short event, SpaceFile *sfile)
BLI_strncpy(sfile->dir, lib->filename, sizeof(sfile->dir));
BLI_make_exist(sfile->dir);
BLI_cleanup_dir(G.sce, sfile->dir);
/* forced re-reading the blend file */
if(sfile->libfiledata) BLO_blendhandle_close(sfile->libfiledata);
sfile->libfiledata= 0;
freefilelist(sfile);
sfile->ofs= 0;
scrarea_queue_winredraw(curarea);

@ -245,9 +245,24 @@ void do_image_buttons(unsigned short event)
break;
}
case B_SIMACLONEBROWSE:
if (settings->imapaint.brush)
if (brush_clone_image_set_nr(settings->imapaint.brush, G.sima->menunr))
if(settings->imapaint.brush) {
Brush *brush= settings->imapaint.brush;
if(G.sima->menunr== -2) {
if(G.qual & LR_CTRLKEY) {
activate_databrowse_imasel((ID *)brush->clone.image, ID_IM, 0, B_SIMACLONEBROWSE,
&G.sima->menunr, do_image_buttons);
} else {
activate_databrowse((ID *)brush->clone.image, ID_IM, 0, B_SIMACLONEBROWSE,
&G.sima->menunr, do_image_buttons);
}
break;
}
if(G.sima->menunr < 0) break;
if(brush_clone_image_set_nr(brush, G.sima->menunr))
allqueue(REDRAWIMAGE, 0);
}
break;
case B_SIMACLONEDELETE:
@ -476,7 +491,9 @@ static uiBlock *image_viewmenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "View Properties...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Image Properties...|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Real-time Properties...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 13, "");
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Paint Tool...|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
if (G.sima->image && (G.sima->flag & SI_DRAWTOOL)) {
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Paint Tool...|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
}
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Curves Tool...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, "");
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Composite Preview...|Shift P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 12, "");

@ -751,6 +751,9 @@ static void do_ipo_viewmenu(void *arg, int event)
case 14: /* Clear Preview Range */
anim_previewrange_clear();
break;
case 15: /* AutoMerge Keyframes */
G.sipo->flag ^= SIPO_NOTRANSKEYCULL;
break;
}
}
@ -772,6 +775,9 @@ static uiBlock *ipo_viewmenu(void *arg_unused)
else
uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Show Keys|K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
uiDefIconTextBut(block, BUTM, 1, (G.sipo->flag & SIPO_NOTRANSKEYCULL)?ICON_CHECKBOX_DEHLT:ICON_CHECKBOX_HLT,
"AutoMerge Keyframes|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom Out|NumPad -", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");

@ -128,6 +128,9 @@ static void do_nla_viewmenu(void *arg, int event)
case 9: /* Clear Preview Range */
anim_previewrange_clear();
break;
case 10: /* AutoMerge Keyframes */
G.snla->flag ^= SNLA_NOTRANSKEYCULL;
break;
}
}
@ -149,6 +152,9 @@ static uiBlock *nla_viewmenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Seconds|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
}
uiDefIconTextBut(block, BUTM, 1, (G.snla->flag & SNLA_NOTRANSKEYCULL)?ICON_CHECKBOX_DEHLT:ICON_CHECKBOX_HLT,
"AutoMerge Keyframes|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
if(BTST(G.snla->lock, 0)) {

@ -1835,7 +1835,7 @@ static uiBlock *view3d_transformmenu(void *arg_unused)
if (!G.obedit) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center New", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center Cursor", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align to Transform Orientation", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 21, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align to Transform Orientation|Ctrl Alt A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 21, "");
}
if (BIF_snappingSupported())
@ -5639,6 +5639,10 @@ void view3d_buttons(void)
xco+= XIC;
}
if (G.vd->twmode > (BIF_countTransformOrientation() - 1) + V3D_MANIP_CUSTOM) {
G.vd->twmode = 0;
}
str_menu = BIF_menustringTransformOrientation("Orientation");
uiDefButS(block, MENU, B_MAN_MODE, str_menu,xco,0,70,YIC, &G.vd->twmode, 0, 0, 0, 0, "Transform Orientation (ALT+Space)");
MEM_freeN(str_menu);
@ -5723,11 +5727,11 @@ void view3d_buttons(void)
}
else if(G.f & G_PARTICLEEDIT) {
uiBlockBeginAlign(block);
uiDefIconButBitS(block, TOG, SCE_SELECT_PATH, B_SEL_PATH, ICON_EDGESEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Path edit mode (Ctrl Tab 1)");
uiDefIconButBitS(block, TOG, SCE_SELECT_PATH, B_SEL_PATH, ICON_EDGESEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Path edit mode");
xco+= XIC;
uiDefIconButBitS(block, TOG, SCE_SELECT_POINT, B_SEL_POINT, ICON_VERTEXSEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Point select mode (Ctrl Tab 2)");
uiDefIconButBitS(block, TOG, SCE_SELECT_POINT, B_SEL_POINT, ICON_VERTEXSEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Point select mode");
xco+= XIC;
uiDefIconButBitS(block, TOG, SCE_SELECT_END, B_SEL_END, ICON_FACESEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Tip select mode (Ctrl Tab 3)");
uiDefIconButBitS(block, TOG, SCE_SELECT_END, B_SEL_END, ICON_FACESEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Tip select mode");
xco+= XIC;
uiBlockEndAlign(block);
if(G.vd->drawtype > OB_WIRE) {

@ -2114,7 +2114,7 @@ static int ui_act_as_text_but(uiBut *but)
static int ui_do_but_NUM(uiBut *but)
{
double value;
double value, butrange;
float deler, fstart, f, tempf, pressure;
int lvalue, temp, orig_x; /* , firsttime=1; */
short retval=0, qual, sx, mval[2], pos=0;
@ -2128,7 +2128,8 @@ static int ui_do_but_NUM(uiBut *but)
sx= mval[0];
orig_x = sx; /* Store so we can scale the rate of change by the dist the mouse is from its original xlocation */
fstart= (value - but->min)/(but->max-but->min);
butrange= (but->max - but->min);
fstart= (butrange == 0.0)? 0.0f: (value - but->min)/butrange;
f= fstart;
temp= (int)value;

@ -938,8 +938,8 @@ static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw,
{
ui_rasterpos_safe(x, y, aspect);
if(w<1 || h<1) {
printf("what the heck!\n");
if((w<1 || h<1) && G.f & G_DEBUG) {
printf("what the heck! - icons are %i x %i pixels?\n", w, h);
}
/* rect contains image in 'rendersize', we only scale if needed */
else if(rw!=w && rh!=h) {

@ -1110,7 +1110,7 @@ static void poselib_preview_init_data (tPoseLib_PreviewData *pld, Object *ob, sh
return;
}
if (pld->marker == NULL) {
if ((apply_active==0) || (pld->act->markers.first)) {
if ((apply_active==0) && (pld->act->markers.first)) {
/* just use first one then... */
pld->marker= pld->act->markers.first;
printf("PoseLib had no active pose\n");

@ -311,6 +311,8 @@ static void renderwin_draw_render_info(RenderWin *rw)
static void renderwin_draw(RenderWin *rw, int just_clear)
{
Image *ima;
ImBuf *ibuf;
float fullrect[2][2];
int set_back_mainwindow;
rcti rect;
@ -340,50 +342,45 @@ static void renderwin_draw(RenderWin *rw, int just_clear)
glColor3ub(0, 0, 0);
glRectfv(fullrect[0], fullrect[1]);
} else {
RenderResult rres;
RenderSpare *rspare= render_spare;
if(rspare && rspare->showspare) {
if(rspare->ibuf) {
rres.rectx= rspare->ibuf->x;
rres.recty= rspare->ibuf->y;
rres.rect32= (int *)rspare->ibuf->rect;
rres.rectf= rspare->ibuf->rect_float;
rres.rectz= rspare->ibuf->zbuf_float;
}
else
memset(&rres, 0, sizeof(rres));
ibuf= rspare->ibuf;
}
else {
ima= BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
ibuf= BKE_image_get_ibuf(ima, NULL);
}
else
RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres);
if(rres.rectf || rres.rect32) {
if(ibuf) {
if(!ibuf->rect)
IMB_rect_from_float(ibuf);
glPixelZoom(rw->zoom, rw->zoom);
if(rw->flags & RW_FLAGS_ALPHA) {
if(rres.rect32) {
if(ibuf->rect) {
/* swap bytes, so alpha is most significant one, then just draw it as luminance int */
if(G.order==B_ENDIAN)
glPixelStorei(GL_UNPACK_SWAP_BYTES, 1);
glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], rres.rectx, rres.recty, rres.rectx, GL_LUMINANCE, GL_UNSIGNED_INT, rres.rect32);
glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_UNSIGNED_INT, ibuf->rect);
glPixelStorei(GL_UNPACK_SWAP_BYTES, 0);
}
else {
float *trectf= MEM_mallocN(rres.rectx*rres.recty*4, "temp");
float *trectf= MEM_mallocN(ibuf->x*ibuf->y*4, "temp");
int a, b;
for(a= rres.rectx*rres.recty -1, b= 4*a+3; a>=0; a--, b-=4)
trectf[a]= rres.rectf[b];
for(a= ibuf->x*ibuf->y -1, b= 4*a+3; a>=0; a--, b-=4)
trectf[a]= ibuf->rect_float[b];
glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], rres.rectx, rres.recty, rres.rectx, GL_LUMINANCE, GL_FLOAT, trectf);
glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_FLOAT, trectf);
MEM_freeN(trectf);
}
}
else {
if(rres.rect32)
glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], rres.rectx, rres.recty, rres.rectx, GL_RGBA, GL_UNSIGNED_BYTE, rres.rect32);
else if(rres.rectf)
glaDrawPixelsSafe_to32(fullrect[0][0], fullrect[0][1], rres.rectx, rres.recty, rres.rectx, rres.rectf);
if(ibuf->rect)
glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
else if(ibuf->rect_float)
glaDrawPixelsSafe_to32(fullrect[0][0], fullrect[0][1], ibuf->x, ibuf->y, ibuf->x, ibuf->rect_float);
}
glPixelZoom(1.0, 1.0);
}
@ -431,22 +428,20 @@ static void renderwin_zoom(RenderWin *rw, int ZoomIn) {
static void renderwin_mouse_moved(RenderWin *rw)
{
RenderResult rres;
Image *ima;
ImBuf *ibuf;
RenderSpare *rspare= render_spare;
if(rspare && rspare->showspare) {
if(rspare->ibuf) {
rres.rectx= rspare->ibuf->x;
rres.recty= rspare->ibuf->y;
rres.rect32= (int *)rspare->ibuf->rect;
rres.rectf= rspare->ibuf->rect_float;
rres.rectz= rspare->ibuf->zbuf_float;
}
else
memset(&rres, 0, sizeof(rres));
ibuf= rspare->ibuf;
}
else
RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres);
else {
ima= BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
ibuf= BKE_image_get_ibuf(ima, NULL);
}
if(!ibuf)
return;
if (rw->flags & RW_FLAGS_PIXEL_EXAMINING) {
int imgco[2], ofs=0;
@ -455,19 +450,19 @@ static void renderwin_mouse_moved(RenderWin *rw)
if (renderwin_win_to_image_co(rw, rw->lmouse, imgco)) {
ofs= sprintf(buf, "X: %d Y: %d ", imgco[0], imgco[1]);
if (rres.rect32) {
pxl= (char*) &rres.rect32[rres.rectx*imgco[1] + imgco[0]];
if (ibuf->rect) {
pxl= (char*) &ibuf->rect[ibuf->x*imgco[1] + imgco[0]];
ofs+= sprintf(buf+ofs, " | R: %d G: %d B: %d A: %d", pxl[0], pxl[1], pxl[2], pxl[3]);
}
if (rres.rectf) {
float *pxlf= rres.rectf + 4*(rres.rectx*imgco[1] + imgco[0]);
if(!rres.rect32){
if (ibuf->rect_float) {
float *pxlf= ibuf->rect_float + 4*(ibuf->x*imgco[1] + imgco[0]);
if(!ibuf->rect) {
ofs+= sprintf(buf+ofs, " | R: %d G: %d B: %d A: %d", FTOCHAR(pxlf[0]), FTOCHAR(pxlf[1]), FTOCHAR(pxlf[2]), FTOCHAR(pxlf[3]));
}
ofs+= sprintf(buf+ofs, " | R: %.3f G: %.3f B: %.3f A: %.3f ", pxlf[0], pxlf[1], pxlf[2], pxlf[3]);
}
if (rres.rectz) {
float *pxlz= &rres.rectz[rres.rectx*imgco[1] + imgco[0]];
if (ibuf->zbuf_float) {
float *pxlz= &ibuf->zbuf_float[ibuf->x*imgco[1] + imgco[0]];
sprintf(buf+ofs, "| Z: %.3f", *pxlz );
}
@ -484,8 +479,8 @@ static void renderwin_mouse_moved(RenderWin *rw)
rw->zoomofs[0]= rw->pan_ofs_start[0] - delta_x/rw->zoom;
rw->zoomofs[1]= rw->pan_ofs_start[1] - delta_y/rw->zoom;
rw->zoomofs[0]= CLAMPIS(rw->zoomofs[0], -rres.rectx/2, rres.rectx/2);
rw->zoomofs[1]= CLAMPIS(rw->zoomofs[1], -rres.recty/2, rres.recty/2);
rw->zoomofs[0]= CLAMPIS(rw->zoomofs[0], -ibuf->x/2, ibuf->x/2);
rw->zoomofs[1]= CLAMPIS(rw->zoomofs[1], -ibuf->y/2, ibuf->y/2);
renderwin_queue_redraw(rw);
}
@ -497,8 +492,8 @@ static void renderwin_mouse_moved(RenderWin *rw)
h-= RW_HEADERY;
renderwin_win_to_ndc(rw, rw->lmouse, ndc);
rw->zoomofs[0]= -0.5*ndc[0]*(w-rres.rectx*rw->zoom)/rw->zoom;
rw->zoomofs[1]= -0.5*ndc[1]*(h-rres.recty*rw->zoom)/rw->zoom;
rw->zoomofs[0]= -0.5*ndc[0]*(w-ibuf->x*rw->zoom)/rw->zoom;
rw->zoomofs[1]= -0.5*ndc[1]*(h-ibuf->y*rw->zoom)/rw->zoom;
renderwin_queue_redraw(rw);
}
@ -1188,6 +1183,7 @@ static int render_store_spare(void)
RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres);
rspare->ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, 0, 0);
rspare->ibuf->dither= G.scene->r.dither_intensity;
if(rres.rect32) {
rspare->ibuf->rect= MEM_dupallocN(rres.rect32);
@ -1293,6 +1289,8 @@ void BIF_do_render(int anim)
allqueue(REDRAWNODE, 1);
allqueue(REDRAWIMAGE, 1);
}
if(G.scene->r.dither_intensity != 0.0f)
BIF_redraw_render_rect();
if (slink_flag) G.f |= G_DOSCRIPTLINKS;
if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_POSTRENDER);
}

@ -438,15 +438,15 @@ void sculpt_axislock(float *co)
}
}
static void add_norm_if(const BrushAction *a, float out[3], float out_flip[3], const short no[3])
static void add_norm_if(float view_vec[3], float out[3], float out_flip[3], const short no[3])
{
float fno[3] = {no[0], no[1], no[2]};
Normalize(fno);
if((Inpf(((BrushAction*)a)->symm.out, fno)) < 0) {
if((Inpf(view_vec, fno)) > 0) {
VecAddf(out, out, fno);
} else if (out[0]==0.0 && out[1]==0.0 && out[2]==0.0) {
} else {
VecAddf(out_flip, out_flip, fno); /* out_flip is used when out is {0,0,0} */
}
}
@ -465,11 +465,11 @@ void calc_area_normal(float out[3], const BrushAction *a, const float *outdir, c
if(sculptmode_brush()->flag & SCULPT_BRUSH_ANCHORED) {
for(; node; node = node->next)
add_norm_if(a, out, out_flip, a->orig_norms[node->Index]);
add_norm_if(((BrushAction*)a)->symm.out, out, out_flip, a->orig_norms[node->Index]);
}
else {
for(; node; node = node->next)
add_norm_if(a, out, out_flip, me->mvert[node->Index].no);
add_norm_if(((BrushAction*)a)->symm.out, out, out_flip, me->mvert[node->Index].no);
}
if (out[0]==0.0 && out[1]==0.0 && out[2]==0.0) {

@ -1454,6 +1454,7 @@ static void input_preprocess(Sequence * seq, TStripElem* se, int cfra)
if(seq->flag & SEQ_USE_CROP || seq->flag & SEQ_USE_TRANSFORM) {
StripCrop c;
StripTransform t;
int sx,sy,dx,dy;
memset(&c, 0, sizeof(StripCrop));
memset(&t, 0, sizeof(StripTransform));
@ -1465,22 +1466,22 @@ static void input_preprocess(Sequence * seq, TStripElem* se, int cfra)
t = *seq->strip->transform;
}
sx = se->ibuf->x - c.left - c.right;
sy = se->ibuf->y - c.top - c.bottom;
dx = sx;
dy = sy;
if (seq->flag & SEQ_USE_TRANSFORM) {
dx = seqrectx;
dy = seqrecty;
}
if (c.top + c.bottom >= se->ibuf->y ||
c.left + c.right >= se->ibuf->x ||
t.xofs >= se->ibuf->x ||
t.yofs >= se->ibuf->y) {
t.xofs >= dx || t.yofs >= dy) {
make_black_ibuf(se->ibuf);
} else {
ImBuf * i;
int sx = se->ibuf->x - c.left - c.right;
int sy = se->ibuf->y - c.top - c.bottom;
int dx = sx;
int dy = sy;
if (seq->flag & SEQ_USE_TRANSFORM) {
dx = seqrectx;
dy = seqrecty;
}
if (se->ibuf->rect_float) {
i = IMB_allocImBuf(dx, dy,32, IB_rectfloat, 0);
@ -1633,6 +1634,36 @@ static void copy_to_ibuf_still(Sequence * seq, TStripElem * se)
}
}
static void free_metastrip_imbufs(ListBase *seqbasep, int cfra, int chanshown)
{
Sequence* seq_arr[MAXSEQ+1];
int i;
TStripElem* se = 0;
evaluate_seq_frame_gen(seq_arr, seqbasep, cfra);
for (i = 0; i < MAXSEQ; i++) {
if (!video_seq_is_rendered(seq_arr[i])) {
continue;
}
se = give_tstripelem(seq_arr[i], cfra);
if (se) {
if (se->ibuf) {
IMB_freeImBuf(se->ibuf);
se->ibuf= 0;
se->ok= STRIPELEM_OK;
}
if (se->ibuf_comp) {
IMB_freeImBuf(se->ibuf_comp);
se->ibuf_comp = 0;
}
}
}
}
static TStripElem* do_build_seq_array_recursively(
ListBase *seqbasep, int cfra, int chanshown);
@ -1683,6 +1714,10 @@ static void do_build_seq_ibuf(Sequence * seq, TStripElem *se, int cfra,
use_limiter = TRUE;
}
}
if (meta_se) {
free_metastrip_imbufs(
&seq->seqbase, seq->start + se->nr, 0);
}
if (use_limiter) {
input_preprocess(seq, se, cfra);
@ -1760,6 +1795,7 @@ static void do_build_seq_ibuf(Sequence * seq, TStripElem *se, int cfra,
}
} else if(seq->type == SEQ_SCENE) { // scene can be NULL after deletions
int oldcfra = CFRA;
Sequence * oldseq = get_last_seq();
Scene *sce= seq->scene, *oldsce= G.scene;
Render *re;
RenderResult rres;
@ -1838,6 +1874,7 @@ static void do_build_seq_ibuf(Sequence * seq, TStripElem *se, int cfra,
if((G.f & G_PLAYANIM)==0) /* bad, is set on do_render_seq */
waitcursor(0);
CFRA = oldcfra;
set_last_seq(oldseq);
copy_to_ibuf_still(seq, se);
@ -1962,6 +1999,10 @@ static TStripElem* do_handle_speed_effect(Sequence * seq, int cfra)
se = give_tstripelem(seq, cfra);
if (!se) {
return se;
}
if (cfra_left == cfra_right ||
(s->flags & SEQ_SPEED_BLEND) == 0) {
test_and_auto_discard_ibuf(se);

@ -214,7 +214,10 @@ void add_blockhandler(ScrArea *sa, short eventcode, short val)
break;
}
}
if(a==SPACE_MAXHANDLER) printf("error; max (4) blockhandlers reached!\n");
if(a==SPACE_MAXHANDLER) {
error("Only %i floating panels allowed", SPACE_MAXHANDLER-1);
}
}
void rem_blockhandler(ScrArea *sa, short eventcode)
@ -1077,7 +1080,10 @@ void BIF_undo_menu(void)
if(menu) {
short event= pupmenu_col(menu, 20);
MEM_freeN(menu);
if(event>0) BKE_undo_number(event);
if(event>0) {
BKE_undo_number(event);
sound_initialize_sounds();
}
}
}
}

@ -314,7 +314,7 @@ short sbutton(char *var, short min, short max, char *str)
x1=mval[0]-250;
y1=mval[1]-20;
editvar = MEM_callocN(max, "sbutton");
editvar = MEM_callocN(max+1, "sbutton");
BLI_strncpy(editvar, var, max);
uiDefButC(block, TEX, 32766, str, x1+5,y1+10,225,20, editvar,(float)min,(float)max, 0, 0, "");
@ -2298,16 +2298,21 @@ void toolbox_generic( TBitem *generic_menu )
/* Add the menu */
for (menu = generic_menu; menu->icon != -1; menu++) {
if (menu->poin) {
but=uiDefIconTextBlockBut(block, tb_makemenu, menu->poin, ICON_RIGHTARROW_THIN, menu->name, mval[0]+tb_mainx,mval[1]+tb_mainy+ypos+5, dx, 19, "");
uiButSetFlag(but, UI_MAKE_RIGHT);
uiButSetFunc(but, store_main, (void *)+32, (void *)ypos);
if(strcmp(menu->name, "SEPR")==0) {
uiDefBut(block, SEPR, 0, "", mval[0]+tb_mainx,mval[1]+tb_mainy+ypos+5, dx, 6, NULL, 0.0, 0.0, 0, 0, "");
ypos-=6;
} else {
/* TODO - add icon support */
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, menu->name, mval[0]+tb_mainx,mval[1]+tb_mainy+ypos+5, dx, 19, NULL, 0.0, 0.0, 0, menu->retval, "");
if (menu->poin) {
but=uiDefIconTextBlockBut(block, tb_makemenu, menu->poin, ICON_RIGHTARROW_THIN, menu->name, mval[0]+tb_mainx,mval[1]+tb_mainy+ypos+5, dx, 19, "");
uiButSetFlag(but, UI_MAKE_RIGHT);
uiButSetFunc(but, store_main, (void *)+32, (void *)ypos);
} else {
/* TODO - add icon support */
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, menu->name, mval[0]+tb_mainx,mval[1]+tb_mainy+ypos+5, dx, 19, NULL, 0.0, 0.0, 0, menu->retval, "");
}
ypos-=20;
}
ypos-=20;
}
uiBlockSetButmFunc(block, menu->poin, NULL);

@ -243,6 +243,63 @@ float InputVerticalAbsolute(TransInfo *t, short mval[2]) {
return Inpf(t->viewinv[1], vec) * 2.0f;
}
float InputDeltaAngle(TransInfo *t, short mval[2])
{
double dx2 = mval[0] - t->center2d[0];
double dy2 = mval[1] - t->center2d[1];
double B = sqrt(dx2*dx2+dy2*dy2);
double dx1 = t->imval[0] - t->center2d[0];
double dy1 = t->imval[1] - t->center2d[1];
double A = sqrt(dx1*dx1+dy1*dy1);
double dx3 = mval[0] - t->imval[0];
double dy3 = mval[1] - t->imval[1];
/* use doubles here, to make sure a "1.0" (no rotation) doesnt become 9.999999e-01, which gives 0.02 for acos */
double deler = ((dx1*dx1+dy1*dy1)+(dx2*dx2+dy2*dy2)-(dx3*dx3+dy3*dy3))
/ (2.0 * (A*B?A*B:1.0));
/* (A*B?A*B:1.0f) this takes care of potential divide by zero errors */
float dphi;
dphi = saacos((float)deler);
if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
/* If the angle is zero, because of lack of precision close to the 1.0 value in acos
* approximate the angle with the oposite side of the normalized triangle
* This is a good approximation here since the smallest acos value seems to be around
* 0.02 degree and lower values don't even have a 0.01% error compared to the approximation
* */
if (dphi == 0)
{
double dx, dy;
dx2 /= A;
dy2 /= A;
dx1 /= B;
dy1 /= B;
dx = dx1 - dx2;
dy = dy1 - dy2;
dphi = sqrt(dx*dx + dy*dy);
if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
}
if(t->flag & T_SHIFT_MOD) dphi = dphi/30.0f;
/* if no delta angle, don't update initial position */
if (dphi != 0)
{
t->imval[0] = mval[0];
t->imval[1] = mval[1];
}
return dphi;
}
/* ************************** SPACE DEPENDANT CODE **************************** */
void setTransformViewMatrices(TransInfo *t)
@ -2584,23 +2641,6 @@ int Rotation(TransInfo *t, short mval[2])
float final;
double dx2 = t->center2d[0] - mval[0];
double dy2 = t->center2d[1] - mval[1];
double B = sqrt(dx2*dx2+dy2*dy2);
double dx1 = t->center2d[0] - t->imval[0];
double dy1 = t->center2d[1] - t->imval[1];
double A = sqrt(dx1*dx1+dy1*dy1);
double dx3 = mval[0] - t->imval[0];
double dy3 = mval[1] - t->imval[1];
/* use doubles here, to make sure a "1.0" (no rotation) doesnt become 9.999999e-01, which gives 0.02 for acos */
double deler= ((double)((dx1*dx1+dy1*dy1)+(dx2*dx2+dy2*dy2)-(dx3*dx3+dy3*dy3) ))
/ (2.0 * (A*B?A*B:1.0));
/* (A*B?A*B:1.0f) this takes care of potential divide by zero errors */
float dphi;
float axis[3];
float mat[3][3];
@ -2608,19 +2648,7 @@ int Rotation(TransInfo *t, short mval[2])
VecMulf(axis, -1.0f);
Normalize(axis);
dphi = saacos((float)deler);
if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
if(t->flag & T_SHIFT_MOD) t->fac += dphi/30.0f;
else t->fac += dphi;
/*
clamping angle between -2 PI and 2 PI (not sure if useful so commented out - theeth)
if (t->fac >= 2 * M_PI)
t->fac -= 2 * M_PI;
else if (t->fac <= -2 * M_PI)
t->fac -= -2 * M_PI;
*/
t->fac += InputDeltaAngle(t, mval);
final = t->fac;
@ -2628,9 +2656,6 @@ int Rotation(TransInfo *t, short mval[2])
snapGrid(t, &final);
t->imval[0] = mval[0];
t->imval[1] = mval[1];
if (t->con.applyRot) {
t->con.applyRot(t, NULL, axis);
}
@ -3097,27 +3122,7 @@ int Tilt(TransInfo *t, short mval[2])
float final;
double dx2 = t->center2d[0] - mval[0];
double dy2 = t->center2d[1] - mval[1];
double B = (float)sqrt(dx2*dx2+dy2*dy2);
double dx1 = t->center2d[0] - t->imval[0];
double dy1 = t->center2d[1] - t->imval[1];
double A = (float)sqrt(dx1*dx1+dy1*dy1);
double dx3 = mval[0] - t->imval[0];
double dy3 = mval[1] - t->imval[1];
double deler= ((dx1*dx1+dy1*dy1)+(dx2*dx2+dy2*dy2)-(dx3*dx3+dy3*dy3))
/ (2 * A * B);
float dphi;
dphi = saacos((float)deler);
if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
if(G.qual & LR_SHIFTKEY) t->fac += dphi/30.0f;
else t->fac += dphi;
t->fac += InputDeltaAngle(t, mval);
final = t->fac;
@ -3125,9 +3130,6 @@ int Tilt(TransInfo *t, short mval[2])
snapGrid(t, &final);
t->imval[0] = mval[0];
t->imval[1] = mval[1];
if (hasNumInput(&t->num)) {
char c[20];
@ -3346,8 +3348,17 @@ void initBevel(TransInfo *t)
{
t->mode = TFM_BEVEL;
t->flag |= T_NO_CONSTRAINT;
t->num.flag |= NUM_NO_NEGATIVE;
t->transform = Bevel;
t->handleEvent = handleEventBevel;
t->idx_max = 0;
t->num.idx_max = 0;
t->snap[0] = 0.0f;
t->snap[1] = 0.1f;
t->snap[2] = t->snap[1] * 0.1f;
/* DON'T KNOW WHY THIS IS NEEDED */
if (G.editBMesh->imval[0] == 0 && G.editBMesh->imval[1] == 0) {
/* save the initial mouse co */
G.editBMesh->imval[0] = t->imval[0];
@ -3404,6 +3415,10 @@ int Bevel(TransInfo *t, short mval[2])
mode = (G.editBMesh->options & BME_BEVEL_VERT) ? "verts only" : "normal";
distance = InputHorizontalAbsolute(t, mval)/4; /* 4 just seemed a nice value to me, nothing special */
distance = fabs(distance);
snapGrid(t, &distance);
applyNumInput(&t->num, &distance);
/* header print for NumInput */
@ -3412,7 +3427,7 @@ int Bevel(TransInfo *t, short mval[2])
outputNumInput(&(t->num), c);
sprintf(str, "Bevel: %s", c);
sprintf(str, "Bevel - Dist: %s, Mode: %s (MMB to toggle))", c, mode);
}
else {
/* default header print */
@ -3899,36 +3914,12 @@ int BoneRoll(TransInfo *t, short mval[2])
float final;
double dx2 = t->center2d[0] - mval[0];
double dy2 = t->center2d[1] - mval[1];
double B = sqrt(dx2*dx2+dy2*dy2);
double dx1 = t->center2d[0] - t->imval[0];
double dy1 = t->center2d[1] - t->imval[1];
double A = sqrt(dx1*dx1+dy1*dy1);
double dx3 = mval[0] - t->imval[0];
double dy3 = mval[1] - t->imval[1];
/* use doubles here, to make sure a "1.0" (no rotation) doesnt become 9.999999e-01, which gives 0.02 for acos */
double deler= ((double)((dx1*dx1+dy1*dy1)+(dx2*dx2+dy2*dy2)-(dx3*dx3+dy3*dy3) ))
/ (2.0 * (A*B?A*B:1.0));
/* (A*B?A*B:1.0f) this takes care of potential divide by zero errors */
float dphi;
dphi = saacos((float)deler);
if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
if(G.qual & LR_SHIFTKEY) t->fac += dphi/30.0f;
else t->fac += dphi;
t->fac += InputDeltaAngle(t, mval);
final = t->fac;
snapGrid(t, &final);
t->imval[0] = mval[0];
t->imval[1] = mval[1];
if (hasNumInput(&t->num)) {
char c[20];

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