missing commits from peter 20942, 21165, 21170, 21174, 21597
these files still need manual merging

source/blender/makesdna/DNA_sequence_types.h
source/blender/src/sequence.c
source/blender/src/seqeffects.c
source/blender/src/editseq.c
source/blender/include/BSE_sequence.h
This commit is contained in:
Campbell Barton 2009-07-25 20:59:09 +00:00
commit 1b14243405
33 changed files with 1086 additions and 463 deletions

@ -69,7 +69,6 @@ IF(UNIX)
bf_blenkernel
verse
bf_blenkernel
bf_decimation
bf_blenloader
bf_blenpluginapi
bf_blroutines

@ -4,6 +4,7 @@ LIBDIR = "${LCGDIR}"
BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_VERSION = '3.1'
#BF_PYTHON_VERSION = '2.6'
#BF_PYTHON_VERSION = '2.6'
WITH_BF_STATICPYTHON = False
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
BF_PYTHON_BINARY = 'python'

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 192 KiB

@ -277,12 +277,17 @@ def read_bvh(file_path, GLOBAL_SCALE=1.0):
for bvh_node in bvh_nodes.itervalues():
if not bvh_node.rest_tail_world:
if len(bvh_node.children)==1:
if len(bvh_node.children)==0:
# could just fail here, but rare BVH files have childless nodes
bvh_node.rest_tail_world = Vector(bvh_node.rest_head_world)
bvh_node.rest_tail_local = Vector(bvh_node.rest_head_local)
elif len(bvh_node.children)==1:
bvh_node.rest_tail_world= Vector(bvh_node.children[0].rest_head_world)
bvh_node.rest_tail_local= Vector(bvh_node.children[0].rest_head_local)
else:
if not bvh_node.children:
raise 'error, bvh node has no end and no children. bad file'
# allow this, see above
#if not bvh_node.children:
# raise 'error, bvh node has no end and no children. bad file'
# Removed temp for now
rest_tail_world= Vector(0,0,0)

File diff suppressed because it is too large Load Diff

@ -1464,7 +1464,7 @@ def write(filename, batch_objects = None, \
# Write Edge Smoothing
file.write('''
LayerElementSmoothing: 0 {
LayerElementSmoothing: 1 {
Version: 101
Name: ""
MappingInformationType: "ByEdge"

@ -2,14 +2,14 @@
"""
Name: 'Quake 3 (.map)'
Blender: 243
Blender: 249
Group: 'Export'
Tooltip: 'Export to Quake map format'
"""
__author__ = 'Campbell Barton'
__version__ = '0.1'
__email__ = "cbarton@metavr.com"
__version__ = '0.1a'
__email__ = "ideasman42@gmail.com"
__bpydoc__ = """\
This script Exports a Quake 3 map format.
@ -234,7 +234,7 @@ def write_node_map(file, ob):
as a MAP node as long as it has the property name - classname
returns True/False based on weather a node was written
'''
props= [(p.name, p.data) for p in ob.properties]
props= [(p.name, p.data) for p in ob.game_properties]
IS_MAP_NODE= False
for name, value in props:
@ -287,7 +287,7 @@ def export_map(filepath):
TOTBRUSH= TOTLAMP= TOTNODE= 0
for ob in Object.GetSelected():
type= ob.getType()
type= ob.type
if type == 'Mesh': obs_mesh.append(ob)
elif type == 'Surf': obs_surf.append(ob)
elif type == 'Lamp': obs_lamp.append(ob)
@ -406,9 +406,10 @@ NULL
else:
print "NOT EXPORTING PATCH", surf_name, u,v, 'Unsupported'
file.write('}\n') # end worldspan
if obs_mesh or obs_surf:
file.write('}\n') # end worldspan
print '\twriting lamps'

@ -2,14 +2,14 @@
"""
Name: 'Wavefront (.obj)...'
Blender: 248
Blender: 249
Group: 'Export'
Tooltip: 'Save a Wavefront OBJ File'
"""
__author__ = "Campbell Barton, Jiri Hnidek, Paolo Ciccone"
__url__ = ['http://wiki.blender.org/index.php/Scripts/Manual/Export/wavefront_obj', 'www.blender.org', 'blenderartists.org']
__version__ = "1.21"
__version__ = "1.22"
__bpydoc__ = """\
This script is an exporter to OBJ file format.
@ -23,11 +23,11 @@ will be exported as mesh data.
"""
# --------------------------------------------------------------------------
# OBJ Export v1.1 by Campbell Barton (AKA Ideasman)
# --------------------------------------------------------------------------
# ***** BEGIN GPL LICENSE BLOCK *****
#
# Script copyright (C) Campbell J Barton 2007-2009
# - V1.22- bspline import/export added (funded by PolyDimensions GmbH)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2

@ -7,7 +7,7 @@ Group: 'Import'
Tooltip: 'Import for DWG/DXF geometry data.'
"""
__author__ = 'Kitsu(Ed Blake) & migius(Remigiusz Fiedler)'
__version__ = '1.12 - 2009.05.27 by migius'
__version__ = '1.12 - 2009.06.16 by migius'
__url__ = ["http://blenderartists.org/forum/showthread.php?t=84319",
"http://wiki.blender.org/index.php/Scripts/Manual/Import/DXF-3D"]
__email__ = ["migius(at)4d-vectors.de","Kitsune_e(at)yahoo.com"]
@ -100,7 +100,7 @@ History:
-- better support for long dxf-layer-names
-- add configuration file.ini handles multiple material setups
-- added f_layerFilter
-- to-check: obj/mat/group/_mapping-idea from ideasman42:
-- to-check: obj/mat/group/_mapping-idea from ideasman42
-- curves: added "fill/non-fill" option for closed curves: CIRCLEs,ELLIPSEs,POLYLINEs
-- "normalize Z" option to correct non-planar figures
-- LINEs need "width" in 3d-space incl vGroups
@ -108,11 +108,13 @@ History:
-- add better support for color_index BYLAYER=256, BYBLOCK=0
-- bug: "oneMesh" produces irregularly errors
-- bug: Registry recall from hd_cache ?? only win32 bug??
-- support DXF-definitions of scene, lights and cameras
-- support DXF-definitions of autoshade: scene, lights and cameras
-- support ortho mode for VIEWs and VPORTs as cameras
v1.12 - 2009.06.16 by migius
d7 fix for ignored BLOCKs (e.g. *X) which are members of other BLOCKs
v1.12 - 2009.05.27 by migius
d6 todo: bugfix negative scaled INSERTs - isLeftHand(Matrix) check
d6 bugfix negative scaled INSERTs - isLeftHand(Matrix) check
v1.12 - 2009.05.26 by migius
d5 changed to the new 2.49 method Vector.cross()
d5 bugfix WORLDY(1,1,0) to (0,1,0)
@ -161,7 +163,7 @@ History:
a4 added to analyzeTool: report about VIEWs, VPORTs, unused/xref BLOCKs
a4 bugfix: individual support for 2D/3DPOLYLINE/POLYMESH
a4 added to UI: (*wip)BLOCK-(F): name filtering for BLOCKs
a4 added to UI: BLOCK-(n): filter anoname/hatch BLOCKs *X...
a4 added to UI: BLOCK-(n): filter noname/hatch BLOCKs *X...
a2 g_scale_as is no more GUI_A-variable
a2 bugfix "material": negative sign color_index
a2 added support for BLOCKs defined with origin !=(0,0,0)
@ -4520,7 +4522,7 @@ def getBlocksmap(drawing, layersmap, layFrozen_on=False): #--------------------
item2str = [item2.name, item2.layer]
childList.append(item2str)
try: usedblocks[item.name] = [used, childList]
except KeyError: print 'Cannot map "%s" - "%s" as Block!' %(item.name, item)
except KeyError: print 'Cannot find "%s" Block!' %(item.name)
#print 'deb:getBlocksmap: usedblocks=' , usedblocks #-------------
#print 'deb:getBlocksmap: layersmap=' , layersmap #-------------
@ -4528,7 +4530,7 @@ def getBlocksmap(drawing, layersmap, layFrozen_on=False): #--------------------
if type(item) != list and item.type == 'insert':
if not layersmap or (not layersmap[item.layer].frozen or layFrozen_on): #if insert_layer is not frozen
try: usedblocks[item.name][0] = True
except: pass
except KeyError: print 'Cannot find "%s" Block!' %(item.name)
key_list = usedblocks.keys()
key_list.reverse()
@ -4536,7 +4538,8 @@ def getBlocksmap(drawing, layersmap, layFrozen_on=False): #--------------------
if usedblocks[key][0]: #if parent used, then set used also all child blocks
for child in usedblocks[key][1]:
if not layersmap or (layersmap and not layersmap[child[1]].frozen): #if insert_layer is not frozen
usedblocks[child[0]][0] = True # marked as used BLOCK
try: usedblocks[child[0]][0] = True # marked as used BLOCK
except KeyError: print 'Cannot find "%s" Block!' %(child[0])
usedblocks = [i for i in usedblocks.keys() if usedblocks[i][0]]
#print 'deb:getBlocksmap: usedblocks=' , usedblocks #-------------

@ -9,7 +9,7 @@ Tooltip: 'Load a Wavefront OBJ File, Shift: batch import all dir.'
__author__= "Campbell Barton", "Jiri Hnidek", "Paolo Ciccone"
__url__= ['http://wiki.blender.org/index.php/Scripts/Manual/Import/wavefront_obj', 'blender.org', 'blenderartists.org']
__version__= "2.11"
__version__= "2.13"
__bpydoc__= """\
This script imports a Wavefront OBJ files to Blender.
@ -21,7 +21,8 @@ Note, This loads mesh objects and materials only, nurbs and curves are not suppo
# ***** BEGIN GPL LICENSE BLOCK *****
#
# Script copyright (C) Campbell J Barton 2007
# Script copyright (C) Campbell J Barton 2007-2009
# - V2.12- bspline import/export added (funded by PolyDimensions GmbH)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -124,6 +125,16 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
image= obj_image_load(imagepath, DIR, IMAGE_SEARCH)
has_data = image.has_data
texture.image = image
if not has_data:
try:
# first time using this image. We need to load it first
image.glLoad()
except:
# probably the image is crashed
pass
else:
has_data = image.has_data
# Adds textures for materials (rendering)
if type == 'Kd':
@ -207,6 +218,7 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
context_material.setIOR( max(1, min(float(line_split[1]), 3))) # Between 1 and 3
elif line_lower.startswith('d') or line_lower.startswith('tr'):
context_material.setAlpha(float(line_split[1]))
context_material.mode |= Material.Modes.ZTRANSP
elif line_lower.startswith('map_ka'):
img_filepath= line_value(line.split())
if img_filepath:

@ -38,13 +38,13 @@ def my_object_util(sce):
Draw.PupMenu('Error%t|No active object selected')
return
mats = [ob.matrixWorld for ob in sce.objects.context if ob != ob_act]
mats = [(ob, ob.matrixWorld) for ob in sce.objects.context if ob != ob_act]
for m in mats:
for ob, m in mats:
ob_copy = ob_act.copy()
sce.objects.link(ob_copy)
ob_copy.setMatrix(m)
ob_copy.Layers = ob.Layers
ob_copy.Layers = ob.Layers & (1<<20)-1
def main():

@ -43,7 +43,7 @@ import bpy
import BPyMesh
def vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_RADIUS, PREF_MIN_EDLEN, PREF_CLAMP_CONCAVE, PREF_CLAMP_CONVEX, PREF_SHADOW_ONLY, PREF_SEL_ONLY):
def vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_STRENGTH, PREF_CLAMP_CONCAVE, PREF_CLAMP_CONVEX, PREF_SHADOW_ONLY, PREF_SEL_ONLY):
Window.WaitCursor(1)
Ang= Mathutils.AngleBetweenVecs
@ -83,32 +83,34 @@ def vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_RADIUS, PREF_MIN_EDLEN, PRE
if vert_tone_count[i]:
vert_tone[i] = vert_tone[i] / vert_tone_count[i]
# Below we use edges to blur along so the edges need counting, not the faces
vert_tone_count= [0] * len(me.verts)
for ed in me.edges:
vert_tone_count[ed.v1.index] += 1
vert_tone_count[ed.v2.index] += 1
# BLUR TONE
edge_lengths= [ ed.length for ed in me.edges]
# Blur tone
blur = PREF_BLUR_STRENGTH
blur_inv = 1.0 - PREF_BLUR_STRENGTH
for i in xrange(PREF_BLUR_ITERATIONS):
# backup the original tones
orig_vert_tone= list(vert_tone)
for ii, ed in enumerate(me.edges):
for ed in me.edges:
i1= ed.v1.index
i2= ed.v2.index
l= edge_lengths[ii]
val1= (orig_vert_tone[i2]*blur) + (orig_vert_tone[i1]*blur_inv)
val2= (orig_vert_tone[i1]*blur) + (orig_vert_tone[i2]*blur_inv)
f=1.0
if l > PREF_MIN_EDLEN and l < PREF_BLUR_RADIUS:
f= l/PREF_BLUR_RADIUS
len_vert_tone_list_i1 = vert_tone_count[i1]
len_vert_tone_list_i2 = vert_tone_count[i2]
if not len_vert_tone_list_i1: len_vert_tone_list_i1=1
if not len_vert_tone_list_i2: len_vert_tone_list_i2=1
val1= (orig_vert_tone[i2]/len_vert_tone_list_i1)/ f
val2= (orig_vert_tone[i1]/len_vert_tone_list_i2)/ f
vert_tone[i1]+= val1
vert_tone[i2]+= val2
# Apply the ton divided by the number of faces connected
vert_tone[i1]+= val1 / max(vert_tone_count[i1], 1)
vert_tone[i2]+= val2 / max(vert_tone_count[i2], 1)
min_tone= min(vert_tone)
@ -144,21 +146,19 @@ def main():
me= ob.getData(mesh=1)
PREF_BLUR_ITERATIONS= Draw.Create(1)
PREF_BLUR_RADIUS= Draw.Create(0.05)
PREF_MIN_EDLEN= Draw.Create(0.01)
PREF_BLUR_ITERATIONS= Draw.Create(1)
PREF_BLUR_STRENGTH= Draw.Create(0.5)
PREF_CLAMP_CONCAVE= Draw.Create(90)
PREF_CLAMP_CONVEX= Draw.Create(20)
PREF_SHADOW_ONLY= Draw.Create(0)
PREF_SEL_ONLY= Draw.Create(0)
pup_block= [\
'Post AO Blur',\
(' Iterations:', PREF_BLUR_ITERATIONS, 0, 40, 'Number times to blur the colors. (higher blurs more)'),\
(' Blur Radius:', PREF_BLUR_RADIUS, 0.01, 40.0, 'How much distance effects blur transfur (higher blurs more).'),\
(' Min EdgeLen:', PREF_MIN_EDLEN, 0.00001, 1.0, 'Minimim edge length to blur (very low values can cause errors).'),\
('Strength:', PREF_BLUR_STRENGTH, 0, 1, 'Blur strength per iteration'),\
('Iterations:', PREF_BLUR_ITERATIONS, 0, 40, 'Number times to blur the colors. (higher blurs more)'),\
'Angle Clipping',\
(' Highlight Angle:', PREF_CLAMP_CONVEX, 0, 180, 'Less then 180 limits the angle used in the tonal range.'),\
(' Shadow Angle:', PREF_CLAMP_CONCAVE, 0, 180, 'Less then 180 limits the angle used in the tonal range.'),\
('Highlight Angle:', PREF_CLAMP_CONVEX, 0, 180, 'Less then 180 limits the angle used in the tonal range.'),\
('Shadow Angle:', PREF_CLAMP_CONCAVE, 0, 180, 'Less then 180 limits the angle used in the tonal range.'),\
('Shadow Only', PREF_SHADOW_ONLY, 'Dont calculate highlights for convex areas.'),\
('Sel Faces Only', PREF_SEL_ONLY, 'Only apply to UV/Face selected faces (mix vpain/uvface select).'),\
]
@ -166,19 +166,16 @@ def main():
if not Draw.PupBlock('SelfShadow...', pup_block):
return
PREF_BLUR_ITERATIONS= PREF_BLUR_ITERATIONS.val
PREF_BLUR_RADIUS= PREF_BLUR_RADIUS.val
PREF_MIN_EDLEN= PREF_MIN_EDLEN.val
PREF_CLAMP_CONCAVE= PREF_CLAMP_CONCAVE.val
PREF_CLAMP_CONVEX= PREF_CLAMP_CONVEX.val
PREF_SHADOW_ONLY= PREF_SHADOW_ONLY.val
PREF_SEL_ONLY= PREF_SEL_ONLY.val
if not me.vertexColors:
me.vertexColors= 1
t= sys.time()
vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_RADIUS, PREF_MIN_EDLEN, PREF_CLAMP_CONCAVE, PREF_CLAMP_CONVEX, PREF_SHADOW_ONLY, PREF_SEL_ONLY)
vertexFakeAO(me, PREF_BLUR_ITERATIONS.val, \
PREF_BLUR_STRENGTH.val, \
PREF_CLAMP_CONCAVE.val, \
PREF_CLAMP_CONVEX.val, \
PREF_SHADOW_ONLY.val, \
PREF_SEL_ONLY.val)
if ob.modifiers:
me.update()

@ -214,6 +214,7 @@ int AVI_is_avi (char *name) {
AviMovie movie;
AviMainHeader header;
AviBitmapInfoHeader bheader;
int movie_tracks = 0;
DEBUG("opening movie\n");
@ -303,6 +304,7 @@ int AVI_is_avi (char *name) {
fclose(movie.fp);
return 0;
}
movie_tracks++;
}
movie.streams[temp].sh.Flags = GET_FCC (movie.fp);
@ -394,7 +396,10 @@ int AVI_is_avi (char *name) {
MEM_freeN(movie.streams);
fclose(movie.fp);
return 1;
/* at least one video track is needed */
return (movie_tracks != 0);
}
AviError AVI_open_movie (char *name, AviMovie *movie) {

@ -44,7 +44,9 @@ typedef struct BodyPoint {
float choke,choke2,frozen;
float colball;
short flag;
char octantflag;
//char octantflag;
float mass;
float springweight;
} BodyPoint;
/* allocates and initializes general main data */

@ -795,6 +795,8 @@ void nurbs_to_mesh(Object *ob)
dl= cu->disp.first;
while(dl) {
int smooth= dl->rt & CU_SMOOTH ? 1 : 0;
if(dl->type==DL_SEGM) {
startvert= vertcount;
a= dl->parts*dl->nr;
@ -811,6 +813,7 @@ void nurbs_to_mesh(Object *ob)
for(b=1; b<dl->nr; b++) {
mface->v1= startvert+ofs+b-1;
mface->v2= startvert+ofs+b;
if(smooth) mface->flag |= ME_SMOOTH;
mface++;
}
}
@ -835,6 +838,7 @@ void nurbs_to_mesh(Object *ob)
mface->v1= startvert+ofs+b;
if(b==dl->nr-1) mface->v2= startvert+ofs;
else mface->v2= startvert+ofs+b+1;
if(smooth) mface->flag |= ME_SMOOTH;
mface++;
}
}
@ -860,6 +864,7 @@ void nurbs_to_mesh(Object *ob)
mface->v4= 0;
test_index_face(mface, NULL, 0, 3);
if(smooth) mface->flag |= ME_SMOOTH;
mface++;
index+= 3;
}
@ -907,6 +912,8 @@ void nurbs_to_mesh(Object *ob)
mface->v4= p2;
mface->mat_nr= (unsigned char)dl->col;
test_index_face(mface, NULL, 0, 4);
if(smooth) mface->flag |= ME_SMOOTH;
mface++;
p4= p3;

@ -82,7 +82,7 @@ variables on the UI for now
#include "BKE_DerivedMesh.h"
#include "BKE_pointcache.h"
#include "BKE_modifier.h"
#include "BKE_deform.h"
//XXX #include "BIF_editdeform.h"
//XXX #include "BIF_graphics.h"
#include "PIL_time.h"
@ -2051,7 +2051,7 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float fo
BodyPoint *bp1,*bp2;
float dir[3],dvel[3];
float distance,forcefactor,kd,absvel,projvel;
float distance,forcefactor,kd,absvel,projvel,kw;
int ia,ic;
/* prepare depending on which side of the spring we are on */
if (bpi == bs->v1){
@ -2085,7 +2085,10 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float fo
forcefactor = iks/bs->len;
else
forcefactor = iks;
forcefactor *= bs->strength;
kw = (bp1->springweight+bp2->springweight)/2.0f;
kw = kw * kw;
kw = kw * kw;
forcefactor *= bs->strength * kw;
Vec3PlusStVec(bp1->force,(bs->len - distance)*forcefactor,dir);
/* do bp1 <--> bp2 viscous */
@ -2185,14 +2188,14 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
VecMidf(velcenter, bp->vec, obp->vec);
VecSubf(dvel,velcenter,bp->vec);
VecMulf(dvel,sb->nodemass);
VecMulf(dvel,bp->mass);
Vec3PlusStVec(bp->force,f*(1.0f-sb->balldamp),def);
Vec3PlusStVec(bp->force,sb->balldamp,dvel);
/* exploit force(a,b) == -force(b,a) part2/2 */
VecSubf(dvel,velcenter,obp->vec);
VecMulf(dvel,sb->nodemass);
VecMulf(dvel,bp->mass);
Vec3PlusStVec(obp->force,sb->balldamp,dvel);
Vec3PlusStVec(obp->force,-f*(1.0f-sb->balldamp),def);
@ -2237,7 +2240,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
/* gravitation */
if (sb){
float gravity = sb->grav * sb_grav_force_scale(ob);
bp->force[2]-= gravity*sb->nodemass; /* individual mass of node here */
bp->force[2]-= gravity*bp->mass; /* individual mass of node here */
}
/* particle field & vortex */
@ -2549,7 +2552,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
VecMidf(velcenter, bp->vec, obp->vec);
VecSubf(dvel,velcenter,bp->vec);
VecMulf(dvel,sb->nodemass);
VecMulf(dvel,bp->mass);
Vec3PlusStVec(bp->force,f*(1.0f-sb->balldamp),def);
Vec3PlusStVec(bp->force,sb->balldamp,dvel);
@ -2580,7 +2583,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
/* exploit force(a,b) == -force(b,a) part2/2 */
VecSubf(dvel,velcenter,obp->vec);
VecMulf(dvel,sb->nodemass);
VecMulf(dvel,(bp->mass+obp->mass)/2.0f);
Vec3PlusStVec(obp->force,sb->balldamp,dvel);
Vec3PlusStVec(obp->force,-f*(1.0f-sb->balldamp),def);
@ -2640,8 +2643,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
/* gravitation */
bp->force[2]-= gravity*sb->nodemass; /* individual mass of node here */
//bp->force[1]-= gravity*sb->nodemass; /* individual mass of node here */
bp->force[2]-= gravity*bp->mass; /* individual mass of node here */
/* particle field & vortex */
@ -2850,11 +2852,20 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
aabbmin[0]=aabbmin[1]=aabbmin[2] = 1e20f;
aabbmax[0]=aabbmax[1]=aabbmax[2] = -1e20f;
/* old one with homogenous masses */
/* claim a minimum mass for vertex */
/*
if (sb->nodemass > 0.009999f) timeovermass = forcetime/sb->nodemass;
else timeovermass = forcetime/0.009999f;
*/
for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
/* now we have individual masses */
/* claim a minimum mass for vertex */
if (bp->mass > 0.009999f) timeovermass = forcetime/bp->mass;
else timeovermass = forcetime/0.009999f;
if(bp->goal < SOFTGOALSNAP){
/* this makes t~ = t */
if(mid_flags & MID_PRESERVE) VECCOPY(dx,bp->vec);
@ -3228,10 +3239,36 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
/* to proove the concept
this would enable per vertex *mass painting*
strcpy(name,"SOFTMASS");
error = get_scalar_from_named_vertexgroup(ob,name, a,&temp);
if (!error) bp->mass = temp * ob->rangeofmass;
*/
/* first set the default */
bp->mass = sb->nodemass;
if (sb->namedVG_Mass[0])
{
int grp= get_named_vertexgroup_num (ob,sb->namedVG_Mass);
/* printf("VGN %s %d \n",sb->namedVG_Mass,grp); */
if(grp > -1){
get_scalar_from_vertexgroup(ob, a,(short) (grp), &bp->mass);
bp->mass = bp->mass * sb->nodemass;
/* printf("bp->mass %f \n",bp->mass); */
}
}
/* first set the default */
bp->springweight = 1.0f;
if (sb->namedVG_Spring_K[0])
{
int grp= get_named_vertexgroup_num (ob,sb->namedVG_Spring_K);
//printf("VGN %s %d \n",sb->namedVG_Spring_K,grp);
if(grp > -1){
get_scalar_from_vertexgroup(ob, a,(short) (grp), &bp->springweight);
//printf("bp->springweight %f \n",bp->springweight);
}
}
}
/* but we only optionally add body edge springs */

@ -4126,6 +4126,9 @@ static void direct_link_scene(FileData *fd, Scene *sce)
} else {
seq->strip->color_balance = 0;
}
if (seq->strip->color_balance) {
// seq->strip->color_balance->gui = 0; // XXX - peter, is this relevant in 2.5?
}
}
}
SEQ_END

@ -104,7 +104,9 @@ static int writetab(FILE *outf, unsigned int *tab, int len);
static void readtab(FILE *inf, unsigned int *tab, int len);
static void expandrow(unsigned char *optr, unsigned char *iptr, int z);
static void expandrow2(float *optr, unsigned char *iptr, int z);
static void interleaverow(unsigned char *lptr, unsigned char *cptr, int z, int n);
static void interleaverow2(float *lptr, unsigned char *cptr, int z, int n);
static int compressrow(unsigned char *lbuf, unsigned char *rlebuf, int z, int cnt);
static void lumrow(unsigned char *rgbptr, unsigned char *lumptr, int n);
@ -233,6 +235,7 @@ static void test_endian_zbuf(struct ImBuf *ibuf)
struct ImBuf *imb_loadiris(unsigned char *mem, int flags)
{
unsigned int *base, *lptr = NULL;
float *fbase, *fptr = NULL;
unsigned int *zbase, *zptr;
unsigned char *rledat;
unsigned int *starttab, *lengthtab;
@ -242,7 +245,6 @@ struct ImBuf *imb_loadiris(unsigned char *mem, int flags)
int xsize, ysize, zsize;
int bpp, rle, cur, badorder;
ImBuf * ibuf;
uchar * rect;
/*printf("new iris\n");*/
@ -257,8 +259,8 @@ struct ImBuf *imb_loadiris(unsigned char *mem, int flags)
rle = ISRLE(image.type);
bpp = BPP(image.type);
if(bpp != 1 ) {
fprintf(stderr,"longimagedata: image must have 1 byte per pix chan\n");
if(bpp != 1 && bpp != 2) {
fprintf(stderr,"longimagedata: image must have 1 or 2 byte per pix chan\n");
return(0);
}
@ -273,6 +275,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, int flags)
}
if (rle) {
tablen = ysize*zsize*sizeof(int);
starttab = (unsigned int *)malloc(tablen);
lengthtab = (unsigned int *)malloc(tablen);
@ -280,7 +283,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, int flags)
readtab(inf,starttab,tablen);
readtab(inf,lengthtab,tablen);
/* check data order */
cur = 0;
badorder = 0;
@ -295,99 +298,201 @@ struct ImBuf *imb_loadiris(unsigned char *mem, int flags)
if(badorder)
break;
}
ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect, 0);
if (ibuf->depth > 32) ibuf->depth = 32;
base = ibuf->rect;
zbase = (unsigned int *)ibuf->zbuf;
if (badorder) {
for(z=0; z<zsize; z++) {
if (bpp == 1) {
ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect, 0);
if (ibuf->depth > 32) ibuf->depth = 32;
base = ibuf->rect;
zbase = (unsigned int *)ibuf->zbuf;
if (badorder) {
for(z=0; z<zsize; z++) {
lptr = base;
for(y=0; y<ysize; y++) {
file_offset = starttab[y+z*ysize];
rledat = file_data + file_offset;
file_offset += lengthtab[y+z*ysize];
expandrow((uchar *)lptr, rledat, 3-z);
lptr += xsize;
}
}
} else {
lptr = base;
zptr = zbase;
for(y=0; y<ysize; y++) {
file_offset = starttab[y+z*ysize];
rledat = file_data + file_offset;
file_offset += lengthtab[y+z*ysize];
expandrow((uchar *)lptr, rledat, 3-z);
for(z=0; z<zsize; z++) {
file_offset = starttab[y+z*ysize];
rledat = file_data + file_offset;
file_offset += lengthtab[y+z*ysize];
if(z<4) expandrow((uchar *)lptr, rledat, 3-z);
else if(z<8) expandrow((uchar *)zptr, rledat, 7-z);
}
lptr += xsize;
zptr += xsize;
}
}
}
else {
lptr = base;
zptr = zbase;
for(y=0; y<ysize; y++) {
for(z=0; z<zsize; z++) {
file_offset = starttab[y+z*ysize];
rledat = file_data + file_offset;
file_offset += lengthtab[y+z*ysize];
if(z<4) expandrow((uchar *)lptr, rledat, 3-z);
else if(z<8) expandrow((uchar *)zptr, rledat, 7-z);
} else { /* bpp == 2 */
ibuf = IMB_allocImBuf(xsize, ysize, 32, (flags & IB_rect)|IB_rectfloat, 0);
fbase = ibuf->rect_float;
if (badorder) {
for(z=0; z<zsize; z++) {
fptr = fbase;
for(y=0; y<ysize; y++) {
file_offset = starttab[y+z*ysize];
rledat = file_data + file_offset;
file_offset += lengthtab[y+z*ysize];
expandrow2(fptr, rledat, 3-z);
fptr += xsize * 4;
}
}
} else {
fptr = fbase;
for(y=0; y<ysize; y++) {
for(z=0; z<zsize; z++) {
file_offset = starttab[y+z*ysize];
rledat = file_data + file_offset;
file_offset += lengthtab[y+z*ysize];
expandrow2(fptr, rledat, 3-z);
}
fptr += xsize * 4;
}
lptr += xsize;
zptr += xsize;
}
}
free(starttab);
free(lengthtab);
}
else {
ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect, 0);
if (ibuf->depth > 32) ibuf->depth = 32;
free(lengthtab);
base = ibuf->rect;
zbase = (unsigned int *)ibuf->zbuf;
file_offset = 512;
rledat = file_data + file_offset;
for(z = 0; z < zsize; z++) {
} else {
if (bpp == 1) {
if(z<4) lptr = base;
else if(z<8) lptr= zbase;
for(y = 0; y < ysize; y++) {
ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect, 0);
if (ibuf->depth > 32) ibuf->depth = 32;
interleaverow((uchar *)lptr, rledat, 3-z, xsize);
rledat += xsize;
base = ibuf->rect;
zbase = (unsigned int *)ibuf->zbuf;
file_offset = 512;
rledat = file_data + file_offset;
for(z = 0; z < zsize; z++) {
lptr += xsize;
if(z<4) lptr = base;
else if(z<8) lptr= zbase;
for(y = 0; y < ysize; y++) {
interleaverow((uchar *)lptr, rledat, 3-z, xsize);
rledat += xsize;
lptr += xsize;
}
}
} else { /* bpp == 2 */
ibuf = IMB_allocImBuf(xsize, ysize, 32, (flags & IB_rect)|IB_rectfloat, 0);
fbase = ibuf->rect_float;
file_offset = 512;
rledat = file_data + file_offset;
for(z = 0; z < zsize; z++) {
fptr = fbase;
for(y = 0; y < ysize; y++) {
interleaverow2(fptr, rledat, 3-z, xsize);
rledat += xsize * 2;
fptr += xsize * 4;
}
}
}
}
if (bpp == 1) {
uchar * rect;
if (image.zsize == 1){
rect = (uchar *) ibuf->rect;
for (x = ibuf->x * ibuf->y; x > 0; x--) {
rect[0] = 255;
rect[1] = rect[2] = rect[3];
rect += 4;
}
} else if (image.zsize == 2){
/* grayscale with alpha */
rect = (uchar *) ibuf->rect;
for (x = ibuf->x * ibuf->y; x > 0; x--) {
rect[0] = rect[2];
rect[1] = rect[2] = rect[3];
rect += 4;
}
} else if (image.zsize == 3){
/* add alpha */
rect = (uchar *) ibuf->rect;
for (x = ibuf->x * ibuf->y; x > 0; x--) {
rect[0] = 255;
rect += 4;
}
}
} else { /* bpp == 2 */
if (image.zsize == 1){
fbase = ibuf->rect_float;
for (x = ibuf->x * ibuf->y; x > 0; x--) {
fbase[0] = 1;
fbase[1] = fbase[2] = fbase[3];
fbase += 4;
}
} else if (image.zsize == 2){
/* grayscale with alpha */
fbase = ibuf->rect_float;
for (x = ibuf->x * ibuf->y; x > 0; x--) {
fbase[0] = fbase[2];
fbase[1] = fbase[2] = fbase[3];
fbase += 4;
}
} else if (image.zsize == 3){
/* add alpha */
fbase = ibuf->rect_float;
for (x = ibuf->x * ibuf->y; x > 0; x--) {
fbase[0] = 1;
fbase += 4;
}
}
if (flags & IB_rect) {
IMB_rect_from_float(ibuf);
}
}
if (image.zsize == 1){
rect = (uchar *) ibuf->rect;
for (x = ibuf->x * ibuf->y; x > 0; x--) {
rect[0] = 255;
rect[1] = rect[2] = rect[3];
rect += 4;
}
} else if (image.zsize == 2){
/* grayscale with alpha */
rect = (uchar *) ibuf->rect;
for (x = ibuf->x * ibuf->y; x > 0; x--) {
rect[0] = rect[2];
rect[1] = rect[2] = rect[3];
rect += 4;
}
} else if (image.zsize == 3){
/* add alpha */
rect = (uchar *) ibuf->rect;
for (x = ibuf->x * ibuf->y; x > 0; x--) {
rect[0] = 255;
rect += 4;
}
}
ibuf->ftype = IMAGIC;
if (flags & IB_ttob) IMB_flipy(ibuf);
@ -412,6 +517,71 @@ static void interleaverow(unsigned char *lptr, unsigned char *cptr, int z, int n
}
}
static void interleaverow2(float *lptr, unsigned char *cptr, int z, int n)
{
lptr += z;
while(n--) {
*lptr = ((cptr[0]<<8) | (cptr[1]<<0)) / (float)0xFFFF;
cptr += 2;
lptr += 4;
}
}
static void expandrow2(float *optr, unsigned char *iptr, int z)
{
unsigned short pixel, count;
float pixel_f;
optr += z;
while(1) {
pixel = (iptr[0]<<8) | (iptr[1]<<0);
iptr += 2;
if ( !(count = (pixel & 0x7f)) )
return;
if(pixel & 0x80) {
while(count>=8) {
optr[0*4] = ((iptr[0]<<8) | (iptr[1]<<0))/(float)0xFFFF;
optr[1*4] = ((iptr[2]<<8) | (iptr[3]<<0))/(float)0xFFFF;
optr[2*4] = ((iptr[4]<<8) | (iptr[5]<<0))/(float)0xFFFF;
optr[3*4] = ((iptr[6]<<8) | (iptr[7]<<0))/(float)0xFFFF;
optr[4*4] = ((iptr[8]<<8) | (iptr[9]<<0))/(float)0xFFFF;
optr[5*4] = ((iptr[10]<<8) | (iptr[11]<<0))/(float)0xFFFF;
optr[6*4] = ((iptr[12]<<8) | (iptr[13]<<0))/(float)0xFFFF;
optr[7*4] = ((iptr[14]<<8) | (iptr[15]<<0))/(float)0xFFFF;
optr += 8*4;
iptr += 8*2;
count -= 8;
}
while(count--) {
*optr = ((iptr[0]<<8) | (iptr[1]<<0))/(float)0xFFFF;
iptr+=2;
optr+=4;
}
} else {
pixel_f = ((iptr[0]<<8) | (iptr[1]<<0))/(float)0xFFFF;
iptr += 2;
while(count>=8) {
optr[0*4] = pixel_f;
optr[1*4] = pixel_f;
optr[2*4] = pixel_f;
optr[3*4] = pixel_f;
optr[4*4] = pixel_f;
optr[5*4] = pixel_f;
optr[6*4] = pixel_f;
optr[7*4] = pixel_f;
optr += 8*4;
count -= 8;
}
while(count--) {
*optr = pixel_f;
optr+=4;
}
}
}
}
static void expandrow(unsigned char *optr, unsigned char *iptr, int z)
{
unsigned char pixel, count;

@ -401,8 +401,6 @@ int imb_get_anim_type(char * name) {
if (ib_stat(name,&st) == -1) return(0);
if (((st.st_mode) & S_IFMT) != S_IFREG) return(0);
if (isavi(name)) return (ANIM_AVI);
if (ismovie(name)) return (ANIM_MOVIE);
# ifdef WITH_QUICKTIME
if (isqtime(name)) return (ANIM_QTIME);
@ -410,6 +408,7 @@ int imb_get_anim_type(char * name) {
# ifdef WITH_FFMPEG
if (isffmpeg(name)) return (ANIM_FFMPEG);
# endif
if (isavi(name)) return (ANIM_AVI);
#endif
#ifdef WITH_REDCODE
if (isredcode(name)) return (ANIM_REDCODE);

@ -165,12 +165,17 @@ typedef struct SoftBody {
int totpoint, totspring;
struct BodyPoint *bpoint; /* not saved in file */
struct BodySpring *bspring; /* not saved in file */
float pad;
char pad;
char msg_lock;
short msg_value;
/* part of UI: */
/* general options */
float nodemass; /* softbody mass of *vertex* */
char namedVG_Mass[32]; /* along with it introduce mass painting
starting to fix old bug .. nastyness that VG are indexes
rather find them by name tag to find it -> jow20090613 */
float grav; /* softbody amount of gravitaion to apply */
float mediafrict; /* friction to env */
float rklimit; /* error limit for ODE solver */
@ -183,13 +188,18 @@ typedef struct SoftBody {
float maxgoal;
float defgoal; /* default goal for vertices without vgroup */
short vertgroup; /* index starting at 1 */
char namedVG_Softgoal[32]; /* starting to fix old bug .. nastyness that VG are indexes
rather find them by name tag to find it -> jow20090613 */
short fuzzyness; /* */
/* springs */
float inspring; /* softbody inner springs */
float infrict; /* softbody inner springs friction */
char namedVG_Spring_K[32]; /* along with it introduce Spring_K painting
starting to fix old bug .. nastyness that VG are indexes
rather find them by name tag to find it -> jow20090613 */
/* baking */
int sfra, efra;
int interval;
@ -291,7 +301,7 @@ typedef struct SoftBody {
#define OB_SB_FACECOLL 1024
#define OB_SB_EDGECOLL 2048
#define OB_SB_COLLFINAL 4096
//#define OB_SB_PROTECT_CACHE 8192
#define OB_SB_BIG_UI 8192
#define OB_SB_AERO_ANGLE 16384
/* sb->solverflags */

@ -65,18 +65,48 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr
for(x=0; x<sx; x++, out+=4, uv+=3, uvnext+=3, uvprev+=3) {
if(x>0 && x<sx-1 && y>0 && y<sy-1) {
if(uv[2]!=0.0f) {
float uv_l, uv_r;
/* adaptive sampling, red (U) channel */
dx= 0.5f*(fabs(uv[0]-uv[-3]) + fabs(uv[0]-uv[3]));
dx+= 0.25f*(fabs(uv[0]-uvprev[-3]) + fabs(uv[0]-uvnext[-3]));
dx+= 0.25f*(fabs(uv[0]-uvprev[+3]) + fabs(uv[0]-uvnext[+3]));
/* prevent alpha zero UVs to be used */
uv_l= uv[-1]!=0.0f? fabs(uv[0]-uv[-3]) : 0.0f;
uv_r= uv[ 5]!=0.0f? fabs(uv[0]-uv[ 3]) : 0.0f;
//dx= 0.5f*(fabs(uv[0]-uv[-3]) + fabs(uv[0]-uv[3]));
dx= 0.5f*(uv_l + uv_r);
uv_l= uvprev[-1]!=0.0f? fabs(uv[0]-uvprev[-3]) : 0.0f;
uv_r= uvnext[-1]!=0.0f? fabs(uv[0]-uvnext[-3]) : 0.0f;
//dx+= 0.25f*(fabs(uv[0]-uvprev[-3]) + fabs(uv[0]-uvnext[-3]));
dx+= 0.25f*(uv_l + uv_r);
uv_l= uvprev[ 5]!=0.0f? fabs(uv[0]-uvprev[+3]) : 0.0f;
uv_r= uvnext[ 5]!=0.0f? fabs(uv[0]-uvnext[+3]) : 0.0f;
//dx+= 0.25f*(fabs(uv[0]-uvprev[+3]) + fabs(uv[0]-uvnext[+3]));
dx+= 0.25f*(uv_l + uv_r);
/* adaptive sampling, green (V) channel */
dy= 0.5f*(fabs(uv[1]-uv[-row+1]) + fabs(uv[1]-uv[row+1]));
dy+= 0.25f*(fabs(uv[1]-uvprev[+1-3]) + fabs(uv[1]-uvnext[+1-3]));
dy+= 0.25f*(fabs(uv[1]-uvprev[+1+3]) + fabs(uv[1]-uvnext[+1+3]));
uv_l= uv[-row+2]!=0.0f? fabs(uv[1]-uv[-row+1]) : 0.0f;
uv_r= uv[ row+2]!=0.0f? fabs(uv[1]-uv[ row+1]) : 0.0f;
//dy= 0.5f*(fabs(uv[1]-uv[-row+1]) + fabs(uv[1]-uv[row+1]));
dy= 0.5f*(uv_l + uv_r);
uv_l= uvprev[-1]!=0.0f? fabs(uv[1]-uvprev[+1-3]) : 0.0f;
uv_r= uvnext[-1]!=0.0f? fabs(uv[1]-uvnext[+1-3]) : 0.0f;
//dy+= 0.25f*(fabs(uv[1]-uvprev[+1-3]) + fabs(uv[1]-uvnext[+1-3]));
dy+= 0.25f*(uv_l + uv_r);
uv_l= uvprev[ 5]!=0.0f? fabs(uv[1]-uvprev[+1+3]) : 0.0f;
uv_r= uvnext[ 5]!=0.0f? fabs(uv[1]-uvnext[+1+3]) : 0.0f;
//dy+= 0.25f*(fabs(uv[1]-uvprev[+1+3]) + fabs(uv[1]-uvnext[+1+3]));
dy+= 0.25f*(uv_l + uv_r);
/* UV to alpha threshold */
alpha= 1.0f - threshold*(dx+dy);

@ -61,12 +61,14 @@ extern struct Render R;
static ListBase *get_lights(ShadeInput *shi)
{
if(R.r.scemode & R_PREVIEWBUTS)
return &R.lights;
if(shi->light_override)
return &shi->light_override->gobject;
else if(shi->mat && shi->mat->group)
if(shi->mat && shi->mat->group)
return &shi->mat->group->gobject;
else
return &R.lights;
return &R.lights;
}
#if 0

@ -2571,7 +2571,7 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int ef
TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
float *co = NULL, *dx = NULL, *dy = NULL, fact, stencilTin=1.0;
float texvec[3], dxt[3], dyt[3], tempvec[3];
int tex_nr, rgb= 0;
int i, tex_nr, rgb= 0;
if (R.r.scemode & R_NO_TEX) return;
tex_nr= 0;
@ -2647,21 +2647,33 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int ef
else texvec[2]= mtex->size[2]*(mtex->ofs[2]);
if(shi->osatex) {
if(mtex->projx) {
dxt[0]= mtex->size[0]*dx[mtex->projx-1];
dyt[0]= mtex->size[0]*dy[mtex->projx-1];
if (!dx) {
for(i=0;i<2;i++) {
dxt[i] = dyt[i] = 0.0;
}
} else {
if(mtex->projx) {
dxt[0]= mtex->size[0]*dx[mtex->projx-1];
dyt[0]= mtex->size[0]*dy[mtex->projx-1];
} else {
dxt[0]= 0.0;
dyt[0]= 0.0;
}
if(mtex->projy) {
dxt[1]= mtex->size[1]*dx[mtex->projy-1];
dyt[1]= mtex->size[1]*dy[mtex->projy-1];
} else {
dxt[1]= 0.0;
dyt[1]= 0.0;
}
if(mtex->projz) {
dxt[2]= mtex->size[2]*dx[mtex->projz-1];
dyt[2]= mtex->size[2]*dy[mtex->projz-1];
} else {
dxt[2]= 0.0;
dyt[2]= 0.0;
}
}
else dxt[0]= 0.0;
if(mtex->projy) {
dxt[1]= mtex->size[1]*dx[mtex->projy-1];
dyt[1]= mtex->size[1]*dy[mtex->projy-1];
}
else dxt[1]= 0.0;
if(mtex->projx) {
dxt[2]= mtex->size[2]*dx[mtex->projz-1];
dyt[2]= mtex->size[2]*dy[mtex->projz-1];
}
else dxt[2]= 0.0;
}
/* texture */

@ -261,6 +261,12 @@ void KX_BlenderRenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmat
// couldn't find something to cast the shadow on...
glMultMatrixd(oglmatrix);
}
else
{ // we found the "ground", but the cast matrix doesn't take
// scaling in consideration, so we must apply the object scale
MT_Vector3 size = gameobj->GetSGNode()->GetLocalScale();
glScalef(size[0], size[1], size[2]);
}
} else
{
@ -384,5 +390,4 @@ void KX_BlenderRenderTools::Update2DFilter(vector<STR_String>& propNames, void*
void KX_BlenderRenderTools::Render2DFilters(RAS_ICanvas* canvas)
{
m_filtermanager.RenderFilters(canvas);
}
}

@ -805,6 +805,10 @@ PyObject* BL_ActionActuator::PyGetChannel(PyObject* value) {
bPoseChannel *pchan;
if(m_userpose==NULL && m_pose==NULL) {
BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent();
obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
}
// get_pose_channel accounts for NULL pose, run on both incase one exists but
// the channel doesnt
@ -950,14 +954,18 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
if (!m_userpose) {
obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
if(!m_pose)
obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
game_copy_pose(&m_userpose, m_pose);
}
pchan= verify_pose_channel(m_userpose, string); // adds the channel if its not there.
// pchan= verify_pose_channel(m_userpose, string); // adds the channel if its not there.
pchan= get_pose_channel(m_userpose, string); // adds the channel if its not there.
VECCOPY (pchan->loc, matrix[3]);
Mat4ToSize(matrix, pchan->size);
Mat4ToQuat(matrix, pchan->quat);
if(pchan) {
VECCOPY (pchan->loc, matrix[3]);
Mat4ToSize(matrix, pchan->size);
Mat4ToQuat(matrix, pchan->quat);
}
}
else {
MT_Vector3 loc;
@ -969,15 +977,24 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
// same as above
if (!m_userpose) {
obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
if(!m_pose)
obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
game_copy_pose(&m_userpose, m_pose);
}
pchan= verify_pose_channel(m_userpose, string);
// pchan= verify_pose_channel(m_userpose, string);
pchan= get_pose_channel(m_userpose, string); // adds the channel if its not there.
// for some reason loc.setValue(pchan->loc) fails
pchan->loc[0]= loc[0]; pchan->loc[1]= loc[1]; pchan->loc[2]= loc[2];
pchan->size[0]= size[0]; pchan->size[1]= size[1]; pchan->size[2]= size[2];
pchan->quat[0]= quat[3]; pchan->quat[1]= quat[0]; pchan->quat[2]= quat[1]; pchan->quat[3]= quat[2]; /* notice xyzw -> wxyz is intentional */
if(pchan) {
pchan->loc[0]= loc[0]; pchan->loc[1]= loc[1]; pchan->loc[2]= loc[2];
pchan->size[0]= size[0]; pchan->size[1]= size[1]; pchan->size[2]= size[2];
pchan->quat[0]= quat[3]; pchan->quat[1]= quat[0]; pchan->quat[2]= quat[1]; pchan->quat[3]= quat[2]; /* notice xyzw -> wxyz is intentional */
}
}
if(pchan==NULL) {
PyErr_SetString(PyExc_ValueError, "Channel could not be found, use the 'channelNames' attribute to get a list of valid channels");
return NULL;
}
pchan->flag |= POSE_ROT|POSE_LOC|POSE_SIZE;
@ -1051,6 +1068,7 @@ PyAttributeDef BL_ActionActuator::Attributes[] = {
KX_PYATTRIBUTE_FLOAT_RW("frameEnd", 0, MAXFRAMEF, BL_ActionActuator, m_endframe),
KX_PYATTRIBUTE_FLOAT_RW("blendIn", 0, MAXFRAMEF, BL_ActionActuator, m_blendin),
KX_PYATTRIBUTE_RW_FUNCTION("action", BL_ActionActuator, pyattr_get_action, pyattr_set_action),
KX_PYATTRIBUTE_RO_FUNCTION("channelNames", BL_ActionActuator, pyattr_get_channel_names),
KX_PYATTRIBUTE_SHORT_RW("priority", 0, 100, false, BL_ActionActuator, m_priority),
KX_PYATTRIBUTE_FLOAT_RW_CHECK("frame", 0, MAXFRAMEF, BL_ActionActuator, m_localtime, CheckFrame),
KX_PYATTRIBUTE_STRING_RW("propName", 0, 31, false, BL_ActionActuator, m_propname),
@ -1094,3 +1112,23 @@ int BL_ActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF
return PY_SET_ATTR_SUCCESS;
}
PyObject* BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
PyObject *ret= PyList_New(0);
PyObject *item;
bPose *pose= ((BL_ArmatureObject*)self->GetParent())->GetOrigPose();
if(pose) {
bPoseChannel *pchan;
for(pchan= (bPoseChannel *)pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) {
item= PyUnicode_FromString(pchan->name);
PyList_Append(ret, item);
Py_DECREF(item);
}
}
return ret;
}

@ -114,7 +114,7 @@ public:
static PyObject* pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject* pyattr_get_channel_names(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
/* attribute check */
static int CheckFrame(void *self, const PyAttributeDef*)
{

@ -60,6 +60,7 @@ public:
void GetMRDPose(struct bPose **pose);
void GetPose(struct bPose **pose);
void SetPose (struct bPose *pose);
struct bPose *GetOrigPose() {return m_pose;} // never edit this, only for accessing names
void ApplyPose();
void RestorePose();

@ -146,7 +146,7 @@ PyAttributeDef KX_NetworkMessageActuator::Attributes[] = {
KX_PYATTRIBUTE_STRING_RW("propName", 0, 100, false, KX_NetworkMessageActuator, m_toPropName),
KX_PYATTRIBUTE_STRING_RW("subject", 0, 100, false, KX_NetworkMessageActuator, m_subject),
KX_PYATTRIBUTE_BOOL_RW("usePropBody", KX_NetworkMessageActuator, m_bPropBody),
KX_PYATTRIBUTE_STRING_RW("body", 0, 100, false, KX_NetworkMessageActuator, m_body),
KX_PYATTRIBUTE_STRING_RW("body", 0, 16384, false, KX_NetworkMessageActuator, m_body),
{ NULL } //Sentinel
};

@ -402,6 +402,8 @@ void KX_BulletPhysicsController::RestoreDynamics()
btRigidBody *body = GetRigidBody();
if (body && m_suspended)
{
// before make sure any position change that was done in this logic frame are accounted for
SetTransform();
GetPhysicsEnvironment()->updateCcdPhysicsController(this,
m_savedMass,
m_savedCollisionFlags,

@ -328,7 +328,7 @@ bool ConvertPythonToMesh(PyObject * value, RAS_MeshObject **object, bool py_none
KX_MeshProxy *kx_mesh = static_cast<KX_MeshProxy*>BGE_PROXY_REF(value);
/* sets the error */
if (*object==NULL) {
if (kx_mesh==NULL) {
PyErr_Format(PyExc_SystemError, "%s, " BGE_PROXY_ERROR_MSG, error_prefix);
return false;
}

@ -104,7 +104,8 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
// do nothing on negative events, otherwise sounds are played twice!
bool bNegativeEvent = IsNegativeEvent();
bool bPositiveEvent = m_posevent;
RemoveAllEvents();
if (!m_soundObject)
@ -153,8 +154,17 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
// remember that we tried to stop the actuator
m_isplaying = false;
}
else
{
#if 1
// Warning: when de-activating the actuator, after a single negative event this runs again with...
// m_posevent==false && m_posevent==false, in this case IsNegativeEvent() returns false
// and assumes this is a positive event.
// check that we actually have a positive event so as not to play sounds when being disabled.
else if(bPositiveEvent) { // <- added since 2.49
#else
else { // <- works in most cases except a loop-end sound will never stop unless
// the negative pulse is done continuesly
#endif
if (!m_isplaying)
{
switch (m_type)

@ -24,7 +24,7 @@ The Blender Game Engine Python API Reference
Additional Modules:
-------------------
These modules have no GameEngine spesific functionality but are useful in many cases.
These modules have no GameEngine specific functionality but are useful in many cases.
- L{Mathutils}
- L{Geometry}

@ -310,6 +310,8 @@ class BL_ActionActuator(SCA_IActuator):
@ivar action: The name of the action to set as the current action.
@type action: string
@ivar channelNames: A list of channel names that may be used with L{setChannel} and L{getChannel}
@type channelNames: list of strings
@ivar frameStart: Specifies the starting frame of the animation.
@type frameStart: float
@ivar frameEnd: Specifies the ending frame of the animation.
@ -340,7 +342,8 @@ class BL_ActionActuator(SCA_IActuator):
"""
Alternative to the 2 arguments, 4 arguments (channel, matrix, loc, size, quat) are also supported.
@param channel: A string specifying the name of the bone channel, created if missing.
@note: These values are relative to the bones rest position, currently the api has no way to get this info (which is annoying), but can be worked around by using bones with a rest pose that has no translation.
@param channel: A string specifying the name of the bone channel, error raised if not in L{channelNames}.
@type channel: string
@param matrix: A 4x4 matrix specifying the overriding transformation
as an offset from the bone's rest position.
@ -349,7 +352,7 @@ class BL_ActionActuator(SCA_IActuator):
def getChannel(channel):
"""
@param channel: A string specifying the name of the bone channel. error raised if missing.
@param channel: A string specifying the name of the bone channel. error raised if not in L{channelNames}.
@type channel: string
@rtype: tuple
@return: (loc, size, quat)