From c32720a0c0e8a846ff1f54a663e2cea848df724f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 28 Jul 2010 05:47:46 +0000 Subject: bugfix [#23055] transforms with proportional fall off affect hidden vertices in certain situations faces were not being checked if they were hidden before adding their internal edges for connected proportional editing. --- source/blender/editors/transform/transform_conversions.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 0edf6f6d10c..2f8da7c2dd6 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1775,14 +1775,17 @@ static int connectivity_edge(float mtx[][3], EditVert *v1, EditVert *v2) float edge_len; int done = 0; + /* note: hidden verts are not being checked for, this assumes + * flushing of hidden faces & edges is working right */ + + if (v1->f2 + v2->f2 == 4) + return 0; + sub_v3_v3v3(edge_vec, v1->co, v2->co); mul_m3_v3(mtx, edge_vec); edge_len = len_v3(edge_vec); - if (v1->f2 + v2->f2 == 4) - return 0; - if (v1->f2) { if (v2->f2) { if (v2->tmp.fp + edge_len + THRESHOLD < v1->tmp.fp) { @@ -1848,7 +1851,7 @@ static void editmesh_set_connectivity_distance(EditMesh *em, float mtx[][3]) /* do internal edges for quads */ for(efa= em->faces.first; efa; efa= efa->next) { - if (efa->v4) { + if (efa->v4 && efa->h==0) { done |= connectivity_edge(mtx, efa->v1, efa->v3); done |= connectivity_edge(mtx, efa->v2, efa->v4); } -- cgit v1.2.3 From f2e1136ca3983e671f1484ddbe471c8a422ab9ea Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 28 Jul 2010 07:00:40 +0000 Subject: bugfix [#23053] Blender crashes when adding image as a strip buffer overrun when copying image name. --- source/blender/editors/space_sequencer/sequencer_add.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/blender') diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 4d51ac05fbd..b00fcfcc22a 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -181,7 +181,9 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op) /* used for image strip */ /* best guess, first images name */ RNA_BEGIN(op->ptr, itemptr, "files") { - RNA_string_get(&itemptr, "name", seq_load->name); + char *name= RNA_string_get_alloc(&itemptr, "name", NULL, 0); + BLI_strncpy(seq_load->name, name, sizeof(seq_load->name)); + MEM_freeN(name); break; } RNA_END; -- cgit v1.2.3 From fa9550bba066e076b7cedd1a131f9fb44d16db10 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 28 Jul 2010 07:37:24 +0000 Subject: fix for un-initialized memory use with thumb's & minor internal improvement for bpy.utils.clean_name() --- source/blender/imbuf/intern/thumbs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender') diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index 234c8837b35..dcbd6df7ced 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -243,12 +243,12 @@ void IMB_thumb_makedirs() /* create thumbnail for file and returns new imbuf for thumbnail */ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, ImBuf *img) { - char uri[URI_MAX]; + char uri[URI_MAX]= ""; char desc[URI_MAX+22]; char tpath[FILE_MAX]; char tdir[FILE_MAX]; char temp[FILE_MAX]; - char mtime[40]; + char mtime[40]= "0"; /* incase we can't stat the file */ char cwidth[40]; char cheight[40]; char thumb[40]; -- cgit v1.2.3 From 79dd2cc8e9073039d3518c41d90adb006d344201 Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Wed, 28 Jul 2010 08:05:39 +0000 Subject: Fix [#22197] empty XYZ text size changing according to distance from origin Partial revert for commit r 27946 Empty/axis xyz text is now purely aligned to object space. Previous 3d view matrix manipulation stuff that I added wasn't correct, and causing more problems than it solved. Perhaps someone can tweak this later to be fixed size/screen aligned, but for now this is less annoying. --- source/blender/editors/space_view3d/drawarmature.c | 11 +----- source/blender/editors/space_view3d/drawobject.c | 43 ++++++---------------- .../blender/editors/space_view3d/view3d_intern.h | 2 +- 3 files changed, 15 insertions(+), 41 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index d16f89e5785..5e0c49e6224 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -1882,15 +1882,12 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, /* Draw additional axes on the bone tail */ if ( (arm->flag & ARM_DRAWAXES) && (arm->flag & ARM_POSEMODE) ) { - float mat[4][4]; glPushMatrix(); copy_m4_m4(bmat, pchan->pose_mat); bone_matrix_translate_y(bmat, pchan->bone->length); glMultMatrixf(bmat); - mul_m4_m4m4(mat, bmat, rv3d->viewmatob); - - drawaxes(rv3d, mat, pchan->bone->length*0.25f, 0, OB_ARROWS); + drawaxes(pchan->bone->length*0.25f, 0, OB_ARROWS); glPopMatrix(); } @@ -2078,16 +2075,12 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt) } /* Draw additional axes */ if (arm->flag & ARM_DRAWAXES) { - float mat[4][4]; glPushMatrix(); get_matrix_editbone(eBone, bmat); bone_matrix_translate_y(bmat, eBone->length); glMultMatrixf(bmat); - mul_m4_m4m4(mat, bmat, rv3d->viewmatob); - - /* do cached text draw immediate to include transform */ - drawaxes(rv3d, mat, eBone->length*0.25f, 0, OB_ARROWS); + drawaxes(eBone->length*0.25f, 0, OB_ARROWS); glPopMatrix(); } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 30bfa123007..5bb1ea2cc9f 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -321,31 +321,12 @@ static float cosval[32] ={ 1.00000000 }; -static void draw_xyz_wire(RegionView3D *rv3d, float mat[][4], float *c, float size, int axis) +static void draw_xyz_wire(float *c, float size, int axis) { float v1[3]= {0.f, 0.f, 0.f}, v2[3] = {0.f, 0.f, 0.f}; - float imat[4][4]; - float dim; - float dx[3], dy[3]; - - /* hrms, really only works properly after glLoadMatrixf(rv3d->viewmat); */ - float pixscale= rv3d->persmat[0][3]*c[0]+ rv3d->persmat[1][3]*c[1]+ rv3d->persmat[2][3]*c[2] + rv3d->persmat[3][3]; - pixscale*= rv3d->pixsize; - - /* halfway blend between fixed size in worldspace vs viewspace - - * alleviates some of the weirdness due to not using viewmat for gl matrix */ - dim = (0.05*size*0.5) + (size*10.f*pixscale*0.5); - - invert_m4_m4(imat, mat); - normalize_v3(imat[0]); - normalize_v3(imat[1]); - - copy_v3_v3(dx, imat[0]); - copy_v3_v3(dy, imat[1]); + float dim = size * 0.1; + float dx[3]={dim, 0.0, 0.0}, dy[3]={0.0, dim, 0.0}, dz[3]={0.0, 0.0, dim}; - mul_v3_fl(dx, dim); - mul_v3_fl(dy, dim); - switch(axis) { case 0: /* x axis */ glBegin(GL_LINES); @@ -397,7 +378,7 @@ static void draw_xyz_wire(RegionView3D *rv3d, float mat[][4], float *c, float si /* start at top left */ sub_v3_v3v3(v1, c, dx); - add_v3_v3v3(v1, c, dy); + add_v3_v3v3(v1, c, dz); glVertex3fv(v1); @@ -406,9 +387,9 @@ static void draw_xyz_wire(RegionView3D *rv3d, float mat[][4], float *c, float si glVertex3fv(v1); - mul_v3_fl(dy, 2.f); + mul_v3_fl(dz, 2.f); sub_v3_v3(v1, dx); - sub_v3_v3(v1, dy); + sub_v3_v3(v1, dz); glVertex3fv(v1); @@ -423,7 +404,7 @@ static void draw_xyz_wire(RegionView3D *rv3d, float mat[][4], float *c, float si } /* flag is same as for draw_object */ -void drawaxes(RegionView3D *rv3d, float mat[][4], float size, int flag, char drawtype) +void drawaxes(float size, int flag, char drawtype) { int axis; float v1[3]= {0.0, 0.0, 0.0}; @@ -522,7 +503,7 @@ void drawaxes(RegionView3D *rv3d, float mat[][4], float size, int flag, char dra v2[axis]+= size*0.125; - draw_xyz_wire(rv3d, mat, v2, size, axis); + draw_xyz_wire(v2, size, axis); } break; } @@ -5925,7 +5906,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } case OB_EMPTY: if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) - drawaxes(rv3d, rv3d->viewmatob, ob->empty_drawsize, flag, ob->empty_drawtype); + drawaxes(ob->empty_drawsize, flag, ob->empty_drawtype); break; case OB_LAMP: if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { @@ -5951,7 +5932,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) break; default: if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { - drawaxes(rv3d, rv3d->viewmatob, 1.0, flag, OB_ARROWS); + drawaxes(1.0, flag, OB_ARROWS); } } @@ -6151,7 +6132,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(dtx && (G.f & G_RENDER_OGL)==0) { if(dtx & OB_AXIS) { - drawaxes(rv3d, rv3d->viewmatob, 1.0f, flag, OB_ARROWS); + drawaxes(1.0f, flag, OB_ARROWS); } if(dtx & OB_BOUNDBOX) { if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) @@ -6525,7 +6506,7 @@ void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object draw_object_mesh_instance(scene, v3d, rv3d, ob, dt, outline); break; case OB_EMPTY: - drawaxes(rv3d, rv3d->viewmatob, ob->empty_drawsize, 0, ob->empty_drawtype); + drawaxes(ob->empty_drawsize, 0, ob->empty_drawtype); break; } } diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 846300ff9a6..fd78c8298e9 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -105,7 +105,7 @@ void draw_object(Scene *scene, struct ARegion *ar, View3D *v3d, Base *base, int int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, int dt); void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, int dt, int outline); void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob); -void drawaxes(struct RegionView3D *rv3d, float mat[][4], float size, int flag, char drawtype); +void drawaxes(float size, int flag, char drawtype); void view3d_cached_text_draw_begin(void); void view3d_cached_text_draw_add(float x, float y, float z, char *str, short xoffs, short flag); -- cgit v1.2.3 From 4ddcb653996d2a3934ef8787510f234087c4e462 Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Wed, 28 Jul 2010 08:06:46 +0000 Subject: Assorted small volume render related fixes. --- source/blender/render/intern/source/rayshade.c | 14 ++------------ source/blender/render/intern/source/shadeinput.c | 2 +- source/blender/render/intern/source/shadeoutput.c | 2 +- source/blender/render/intern/source/volumetric.c | 9 ++++++--- 4 files changed, 10 insertions(+), 17 deletions(-) (limited to 'source/blender') diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index ed52f37fcfa..b4a43373ef4 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -558,19 +558,9 @@ void shade_ray(Isect *is, ShadeInput *shi, ShadeResult *shr) shi->mat= vlr->mat; /* shi->mat is being set in nodetree */ } else { - int tempdepth; - /* XXX dodgy business here, set ray depth to -1 - * to ignore raytrace in shade_material_loop() - * this could really use a refactor --Matt */ - if (shi->volume_depth == 0) { - tempdepth = shi->depth; - shi->depth = -1; - shade_material_loop(shi, shr); - shi->depth = tempdepth; - } else { - shade_material_loop(shi, shr); - } + shade_material_loop(shi, shr); } + /* raytrace likes to separate the spec color */ VECSUB(shr->diff, shr->combined, shr->spec); } diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index 2f0f5c72070..fc9aba20870 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -130,7 +130,7 @@ void shade_material_loop(ShadeInput *shi, ShadeResult *shr) } /* depth >= 1 when ray-shading */ - if(shi->depth==0) { + if(shi->depth==0 || shi->volume_depth > 0) { if(R.r.mode & R_RAYTRACE) { if(shi->ray_mirror!=0.0f || ((shi->mat->mode & MA_TRANSP) && (shi->mat->mode & MA_RAYTRANSP) && shr->alpha!=1.0f)) { /* ray trace works on combined, but gives pass info */ diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 806cafaf89b..81de553b209 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -1644,7 +1644,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) if(((passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) || (passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) { /* AO was calculated for scanline already */ - if(shi->depth) + if(shi->depth || shi->volume_depth) ambient_occlusion(shi); VECCOPY(shr->ao, shi->ao); VECCOPY(shr->env, shi->env); // XXX multiply diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c index 21a0ab1d2a8..4ddbc079e91 100644 --- a/source/blender/render/intern/source/volumetric.c +++ b/source/blender/render/intern/source/volumetric.c @@ -193,7 +193,7 @@ static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, float *co, float *co isect.labda = FLT_MAX; isect.mode= RE_RAY_MIRROR; - isect.skip = RE_SKIP_VLR_NEIGHBOUR | RE_SKIP_VLR_RENDER_CHECK; + isect.skip = RE_SKIP_VLR_NEIGHBOUR; isect.orig.ob = (void*) shi->obi; isect.orig.face = (void*)vlr; isect.last_hit = NULL; @@ -446,7 +446,7 @@ static void vol_get_transmittance(ShadeInput *shi, float *tr, float *co, float * const float stepd = (t0 - pt0) * d; float sigma_t[3]; - vol_get_sigma_t(shi, sigma_t, co); + vol_get_sigma_t(shi, sigma_t, p); tau[0] += stepd * sigma_t[0]; tau[1] += stepd * sigma_t[1]; @@ -609,7 +609,10 @@ static void volumeintegrate(struct ShadeInput *shi, float *col, float *co, float /* transmittance component (alpha) */ vol_get_transmittance_seg(shi, tr, stepsize, co, density); - if (luminance(tr) < shi->mat->vol.depth_cutoff) break; + if (t0 > t1 * 0.25) { + /* only use depth cutoff after we've traced a little way into the volume */ + if (luminance(tr) < shi->mat->vol.depth_cutoff) break; + } vol_get_emission(shi, emit_col, p); -- cgit v1.2.3 From 2a3c1a4cf316e6ebc812078145979a642b2c9698 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 28 Jul 2010 11:10:56 +0000 Subject: Fix #22964: incorrect derivatives for global texture coordinates, showed up as artifacts in bump mapping. --- source/blender/render/intern/source/texture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender') diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c index c8a15372e21..658748bdaeb 100644 --- a/source/blender/render/intern/source/texture.c +++ b/source/blender/render/intern/source/texture.c @@ -1731,7 +1731,7 @@ void do_material_tex(ShadeInput *shi) co= shi->tang; dx= shi->dxno; dy= shi->dyno; } else if(mtex->texco==TEXCO_GLOB) { - co= shi->gl; dx= shi->dxco; dy= shi->dyco; + co= shi->gl; dx= shi->dxgl; dy= shi->dygl; } else if(mtex->texco==TEXCO_UV) { if(mtex->texflag & MTEX_DUPLI_MAPTO) { -- cgit v1.2.3 From d44a2b5b1b782bd89b562843806ccad7af0dd25f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 28 Jul 2010 12:11:40 +0000 Subject: fix for running rna subclasses own __init__ functions. - exceptions in the __init__ functions were not being checked for and segfaulting - avoid creating a new BPy_StructRNA instance per function call, use the existing one if the type matches. --- source/blender/makesrna/intern/rna_wm.c | 4 +-- source/blender/python/intern/bpy_rna.c | 48 ++++++++++++++++++++++----------- 2 files changed, 34 insertions(+), 18 deletions(-) (limited to 'source/blender') diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 1797df2abf0..84053c0a181 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -980,7 +980,6 @@ static void rna_def_operator(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_string_funcs(prop, "rna_Operator_name_get", "rna_Operator_name_length", NULL); RNA_def_property_ui_text(prop, "Name", ""); - RNA_def_struct_name_property(srna, prop); prop= RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); @@ -1001,6 +1000,7 @@ static void rna_def_operator(BlenderRNA *brna) RNA_def_property_string_sdna(prop, NULL, "type->idname"); RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */ RNA_def_property_flag(prop, PROP_REGISTER); + RNA_def_struct_name_property(srna, prop); prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->name"); @@ -1043,7 +1043,6 @@ static void rna_def_macro_operator(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_string_funcs(prop, "rna_Operator_name_get", "rna_Operator_name_length", NULL); RNA_def_property_ui_text(prop, "Name", ""); - RNA_def_struct_name_property(srna, prop); prop= RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); @@ -1056,6 +1055,7 @@ static void rna_def_macro_operator(BlenderRNA *brna) RNA_def_property_string_sdna(prop, NULL, "type->idname"); RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */ RNA_def_property_flag(prop, PROP_REGISTER); + RNA_def_struct_name_property(srna, prop); prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->name"); diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 4a9c69ebedd..6b8c9a5e3a4 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -3086,37 +3086,47 @@ static struct PyMethodDef pyrna_prop_collection_methods[] = { * todo - also accept useful args */ static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - BPy_StructRNA *base = NULL; + BPy_StructRNA *base; - if (!PyArg_ParseTuple(args, "O!:bpy_struct.__new__", &pyrna_struct_Type, &base)) + if (!PyArg_ParseTuple(args, "|O!:bpy_struct.__new__", &pyrna_struct_Type, &base)) return NULL; - - if (type == &pyrna_struct_Type) { - return pyrna_struct_CreatePyObject(&base->ptr); - } else { + + if (type == Py_TYPE(base)) { + Py_INCREF(base); + return (PyObject *)base; + } else if (PyType_IsSubtype(type, &pyrna_struct_Type)) { BPy_StructRNA *ret = (BPy_StructRNA *) type->tp_alloc(type, 0); ret->ptr = base->ptr; return (PyObject *)ret; } + else { + PyErr_Format(PyExc_TypeError, "bpy_struct.__new__(type): type '%.200s' is not a subtype of bpy_struct.", type->tp_name); + return NULL; + } } /* only needed for subtyping, so a new class gets a valid BPy_StructRNA * todo - also accept useful args */ static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - BPy_PropertyRNA *base = NULL; + BPy_PropertyRNA *base; - if (!PyArg_ParseTuple(args, "O!:Base BPy_PropertyRNA", &pyrna_prop_Type, &base)) + if (!PyArg_ParseTuple(args, "O!:bpy_prop.__new__", &pyrna_prop_Type, &base)) return NULL; - if (ELEM3(type, &pyrna_prop_Type, &pyrna_prop_array_Type, &pyrna_prop_collection_Type)) { - return pyrna_prop_CreatePyObject(&base->ptr, base->prop); - } else { + if (type == Py_TYPE(base)) { + Py_INCREF(base); + return (PyObject *)base; + } else if (PyType_IsSubtype(type, &pyrna_prop_Type)) { BPy_PropertyRNA *ret = (BPy_PropertyRNA *) type->tp_alloc(type, 0); ret->ptr = base->ptr; ret->prop = base->prop; return (PyObject *)ret; } + else { + PyErr_Format(PyExc_TypeError, "bpy_prop.__new__(type): type '%.200s' is not a subtype of bpy_prop.", type->tp_name); + return NULL; + } } PyObject *pyrna_param_to_py(PointerRNA *ptr, ParameterList *parms, PropertyRNA *prop, void *data) @@ -4570,10 +4580,13 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par else { args = PyTuple_New(1); PyTuple_SET_ITEM(args, 0, py_srna); - py_class_instance = PyObject_Call(py_class, args, NULL); + py_class_instance= PyObject_Call(py_class, args, NULL); Py_DECREF(args); - - if(py_class_instance_store) { + + if(py_class_instance == NULL) { + err= -1; /* so the error is not overridden below */ + } + else if(py_class_instance_store) { *py_class_instance_store = py_class_instance; Py_INCREF(py_class_instance); } @@ -4626,8 +4639,11 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par } } else { - PyErr_Format(PyExc_RuntimeError, "could not create instance of %.200s to call callback function %.200s.", RNA_struct_identifier(ptr->type), RNA_function_identifier(func)); - err= -1; + /* the error may be alredy set if the class instance couldnt be created */ + if(err != -1) { + PyErr_Format(PyExc_RuntimeError, "could not create instance of %.200s to call callback function %.200s.", RNA_struct_identifier(ptr->type), RNA_function_identifier(func)); + err= -1; + } } if (ret == NULL) { /* covers py_class_instance failing too */ -- cgit v1.2.3 From 114b86f6d7781836635799deb12631a4f36c4eee Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 28 Jul 2010 13:15:29 +0000 Subject: Fix #22996: switching scenes did not exit editmode, meaning changes made were not visible in the other scene in object mode. --- source/blender/editors/screen/screen_edit.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/blender') diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 952f34ae2be..5082992aaba 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -51,6 +51,7 @@ #include "WM_types.h" #include "ED_image.h" +#include "ED_object.h" #include "ED_view3d.h" #include "ED_screen.h" #include "ED_screen_types.h" @@ -1369,6 +1370,8 @@ void ED_screen_set_scene(bContext *C, Scene *scene) bScreen *sc; bScreen *curscreen= CTX_wm_screen(C); + ED_object_exit_editmode(C, EM_FREEDATA|EM_DO_UNDO); + for(sc= CTX_data_main(C)->screen.first; sc; sc= sc->id.next) { if((U.flag & USER_SCENEGLOBAL) || sc==curscreen) { -- cgit v1.2.3 From b51350fb4f93a1e8c2093f99ccb26ebe81ff3fb9 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 28 Jul 2010 13:19:02 +0000 Subject: Fix #22959: uv selection mode was not initialized correctly for new scenes. --- source/blender/blenkernel/intern/scene.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 9d736bd92eb..3c7f6e13445 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -395,6 +395,7 @@ Scene *add_scene(char *name) sce->toolsettings->jointrilimit = 0.8f; sce->toolsettings->selectmode= SCE_SELECT_VERTEX; + sce->toolsettings->uv_selectmode= UV_SELECT_VERTEX; sce->toolsettings->normalsize= 0.1; sce->toolsettings->autokey_mode= U.autokey_mode; -- cgit v1.2.3 From 2c8d7921bc6bc32dd1fa24e3e00cc717c4ed5ccb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 28 Jul 2010 16:26:42 +0000 Subject: bugfix [#23065] Pickle can not dump instances of user defined classes - __import__("__main__").__dict__ will now always match the current scripts namespace. (which is what pickle expects). - __builtins__ as a module rather then a dict from PyEval_GetBuiltins() acts slightly differently, use the module to follow python. --- source/blender/python/intern/bpy_interface.c | 31 ++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'source/blender') diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 5f2f37be062..13b8cd4036a 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -152,9 +152,28 @@ void BPY_update_modules( void ) static PyObject *CreateGlobalDictionary( bContext *C, const char *filename ) { PyObject *item; - PyObject *dict = PyDict_New( ); - PyDict_SetItemString( dict, "__builtins__", PyEval_GetBuiltins( ) ); - + PyObject *dict; +#if 1 + /* important we use the dict from __main__, this is what python expects + * for 'pickle' to work as well as strings like this... + + >> foo = 10 + >> print(__import__("__main__").foo) + */ + dict= PyModule_GetDict(PyImport_AddModule("__main__")); + PyDict_Clear(dict); + Py_INCREF(dict); + + /* using builtins rather then PyEval_GetBuiltins() + * print's many less items when printing, the modules __dict__ + * this is how python works so better follow. */ + PyDict_SetItemString(dict, "__builtins__", PyImport_AddModule("builtins")); +#else + /* otherwise this works for 99% of cases, from 2.4x */ + dict = PyDict_New(); + PyDict_SetItemString( dict, "__builtins__", PyEval_GetBuiltins()); +#endif + item = PyUnicode_FromString( "__main__" ); PyDict_SetItemString( dict, "__name__", item ); Py_DECREF(item); @@ -388,7 +407,11 @@ int BPY_run_python_script( bContext *C, const char *fn, struct Text *text, struc } else { Py_DECREF( py_result ); } - + + /* so __main__ module isnt left with an invalid __file__ variable which could be confusing */ + if (PyDict_DelItemString(py_dict, "__file__")) + PyErr_Clear(); + Py_DECREF(py_dict); bpy_context_clear(C, &gilstate); -- cgit v1.2.3 From c8b6533ddaf421b51d44af7de4816f41086c9510 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 28 Jul 2010 16:47:12 +0000 Subject: Fix #23071: making vertex parent not correct with subsurf modifier, now it also uses the final derivedmesh for the coordinates in edit mode. --- source/blender/blenkernel/intern/object.c | 59 +++++++++++++------------------ 1 file changed, 25 insertions(+), 34 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 81799a5409d..39e02ee584d 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1837,47 +1837,38 @@ static void give_parvert(Object *par, int nr, float *vec) if(par->type==OB_MESH) { Mesh *me= par->data; - em = BKE_mesh_get_editmesh(me); + DerivedMesh *dm; - if(em) { - EditVert *eve; + em = BKE_mesh_get_editmesh(me); + dm = (em)? em->derivedFinal: par->derivedFinal; - for(eve= em->verts.first; eve; eve= eve->next) { - if(eve->keyindex==nr) { - memcpy(vec, eve->co, sizeof(float)*3); - break; + if(dm) { + MVert *mvert= dm->getVertArray(dm); + int *index = (int *)dm->getVertDataArray(dm, CD_ORIGINDEX); + int i, count = 0, vindex, numVerts = dm->getNumVerts(dm); + + /* get the average of all verts with (original index == nr) */ + for(i = 0; i < numVerts; i++) { + vindex= (index)? index[i]: i; + + if(vindex == nr) { + add_v3_v3(vec, mvert[i].co); + count++; } } - BKE_mesh_end_editmesh(me, em); - } - else { - DerivedMesh *dm = par->derivedFinal; - - if(dm) { - MVert *mvert= dm->getVertArray(dm); - int *index = (int *)dm->getVertDataArray(dm, CD_ORIGINDEX); - int i, count = 0, vindex, numVerts = dm->getNumVerts(dm); - - /* get the average of all verts with (original index == nr) */ - for(i = 0; i < numVerts; i++) { - vindex= (index)? index[i]: i; - - if(vindex == nr) { - add_v3_v3(vec, mvert[i].co); - count++; - } - } - if (count==0) { - /* keep as 0,0,0 */ - } else if(count > 0) { - mul_v3_fl(vec, 1.0f / count); - } else { - /* use first index if its out of range */ - dm->getVertCo(dm, 0, vec); - } + if (count==0) { + /* keep as 0,0,0 */ + } else if(count > 0) { + mul_v3_fl(vec, 1.0f / count); + } else { + /* use first index if its out of range */ + dm->getVertCo(dm, 0, vec); } } + + if(em) + BKE_mesh_end_editmesh(me, em); } else if (ELEM(par->type, OB_CURVE, OB_SURF)) { Nurb *nu; -- cgit v1.2.3 From fe77e6d91901e34d50b4f692593ad77ec6507ce7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 28 Jul 2010 23:24:17 +0000 Subject: minor changes to r30843 - the __main__ modules namespace was initialized cleanly but left dirty, now restore when finished executing a script incase a module uses this later. - made the interactive console use the __main__ modules namespace. --- source/blender/python/intern/bpy_interface.c | 43 ++++++++++++++++++---------- 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'source/blender') diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 13b8cd4036a..83f407bab67 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -149,11 +149,12 @@ void BPY_update_modules( void ) /***************************************************************************** * Description: This function creates a new Python dictionary object. *****************************************************************************/ -static PyObject *CreateGlobalDictionary( bContext *C, const char *filename ) +static PyObject *CreateGlobalDictionary(bContext *C, const char *filename, PyObject *main_ns_orig) { PyObject *item; PyObject *dict; -#if 1 + + /* important we use the dict from __main__, this is what python expects * for 'pickle' to work as well as strings like this... @@ -161,6 +162,7 @@ static PyObject *CreateGlobalDictionary( bContext *C, const char *filename ) >> print(__import__("__main__").foo) */ dict= PyModule_GetDict(PyImport_AddModule("__main__")); + PyDict_Merge(main_ns_orig, dict, 1); PyDict_Clear(dict); Py_INCREF(dict); @@ -168,12 +170,8 @@ static PyObject *CreateGlobalDictionary( bContext *C, const char *filename ) * print's many less items when printing, the modules __dict__ * this is how python works so better follow. */ PyDict_SetItemString(dict, "__builtins__", PyImport_AddModule("builtins")); -#else - /* otherwise this works for 99% of cases, from 2.4x */ - dict = PyDict_New(); - PyDict_SetItemString( dict, "__builtins__", PyEval_GetBuiltins()); -#endif - + + item = PyUnicode_FromString( "__main__" ); PyDict_SetItemString( dict, "__name__", item ); Py_DECREF(item); @@ -188,6 +186,13 @@ static PyObject *CreateGlobalDictionary( bContext *C, const char *filename ) return dict; } +static void CreateGlobalDictionary_Restore(PyObject *main_ns_orig) +{ + PyObject *main_ns= PyModule_GetDict(PyImport_AddModule("__main__")); + PyDict_Clear(main_ns); + PyDict_Merge(main_ns, main_ns_orig, 1); +} + /* must be called before Py_Initialize */ void BPY_start_python_path(void) { @@ -341,6 +346,7 @@ void BPY_end_python( void ) int BPY_run_python_script( bContext *C, const char *fn, struct Text *text, struct ReportList *reports) { PyObject *py_dict, *py_result= NULL; + PyObject *main_ns_orig= PyDict_New(); PyGILState_STATE gilstate; if (fn==NULL && text==NULL) { @@ -352,7 +358,7 @@ int BPY_run_python_script( bContext *C, const char *fn, struct Text *text, struc if (text) { char fn_dummy[FILE_MAXDIR]; bpy_text_filename_get(fn_dummy, text); - py_dict = CreateGlobalDictionary(C, fn_dummy); + py_dict = CreateGlobalDictionary(C, fn_dummy, main_ns_orig); if( !text->compiled ) { /* if it wasn't already compiled, do it now */ char *buf = txt_to_buf( text ); @@ -373,7 +379,7 @@ int BPY_run_python_script( bContext *C, const char *fn, struct Text *text, struc else { FILE *fp= fopen(fn, "r"); - py_dict = CreateGlobalDictionary(C, fn); + py_dict = CreateGlobalDictionary(C, fn, main_ns_orig); if(fp) { #ifdef _WIN32 @@ -408,9 +414,8 @@ int BPY_run_python_script( bContext *C, const char *fn, struct Text *text, struc Py_DECREF( py_result ); } - /* so __main__ module isnt left with an invalid __file__ variable which could be confusing */ - if (PyDict_DelItemString(py_dict, "__file__")) - PyErr_Clear(); + CreateGlobalDictionary_Restore(main_ns_orig); + Py_DECREF(main_ns_orig); Py_DECREF(py_dict); @@ -562,6 +567,7 @@ int BPY_eval_button(bContext *C, const char *expr, double *value) { PyGILState_STATE gilstate; PyObject *dict, *mod, *retval; + PyObject *main_ns_orig= PyDict_New(); int error_ret = 0; if (!value || !expr) return -1; @@ -573,7 +579,7 @@ int BPY_eval_button(bContext *C, const char *expr, double *value) bpy_context_set(C, &gilstate); - dict= CreateGlobalDictionary(C, NULL); + dict= CreateGlobalDictionary(C, NULL, main_ns_orig); mod = PyImport_ImportModule("math"); if (mod) { @@ -623,6 +629,9 @@ int BPY_eval_button(bContext *C, const char *expr, double *value) BPy_errors_to_report(CTX_wm_reports(C)); } + CreateGlobalDictionary_Restore(main_ns_orig); + Py_DECREF(main_ns_orig); + Py_DECREF(dict); bpy_context_clear(C, &gilstate); @@ -633,6 +642,7 @@ int BPY_eval_string(bContext *C, const char *expr) { PyGILState_STATE gilstate; PyObject *dict, *retval; + PyObject *main_ns_orig= PyDict_New(); int error_ret = 0; if (!expr) return -1; @@ -643,7 +653,7 @@ int BPY_eval_string(bContext *C, const char *expr) bpy_context_set(C, &gilstate); - dict= CreateGlobalDictionary(C, NULL); + dict= CreateGlobalDictionary(C, NULL, main_ns_orig); retval = PyRun_String(expr, Py_eval_input, dict, dict); @@ -656,6 +666,9 @@ int BPY_eval_string(bContext *C, const char *expr) Py_DECREF(retval); } + CreateGlobalDictionary_Restore(main_ns_orig); + Py_DECREF(main_ns_orig); + Py_DECREF(dict); bpy_context_clear(C, &gilstate); -- cgit v1.2.3 From 7ef2e33ea331561691fbc189fa88d34f77ef896e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 29 Jul 2010 00:06:22 +0000 Subject: bugfix [#23075] Point clouds invisible with VBOs --- source/blender/blenkernel/intern/cdderivedmesh.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index a931a87e8c3..fb1e8c00991 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -241,7 +241,8 @@ static void cdDM_drawVerts(DerivedMesh *dm) else { /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */ GPU_vertex_setup(dm); if( !GPU_buffer_legacy(dm) ) { - glDrawArrays(GL_POINTS,0,dm->drawObject->nelements); + if(dm->drawObject->nelements) glDrawArrays(GL_POINTS,0, dm->drawObject->nelements); + else glDrawArrays(GL_POINTS,0, dm->drawObject->nlooseverts); } GPU_buffer_unbind(); } -- cgit v1.2.3 From 88cbcb0206b7f727b24c6018a24dc1c1a08e9531 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 29 Jul 2010 00:44:53 +0000 Subject: bugfix [#23062] Resolve conflict button in text editor dissappers in Blener 2.5 beta release also uncommented console some code for testing by mistake & remove warning. --- source/blender/editors/space_text/text_ops.c | 2 +- source/blender/makesrna/intern/rna_modifier.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 91fb616a63f..25726bae84b 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -218,7 +218,7 @@ static int open_exec(bContext *C, wmOperator *op) PropertyPointerRNA *pprop; PointerRNA idptr; char str[FILE_MAX]; - short internal = RNA_int_get(op->ptr, "internal"); + short internal = RNA_boolean_get(op->ptr, "internal"); RNA_string_get(op->ptr, "filepath", str); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index f4398b99beb..4ace614640c 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -242,7 +242,7 @@ static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr) break; if(ob->type == OB_MESH && !psys) { /* add particle system */ - psmd = object_add_particle_system(scene, ob, NULL); + psmd = (ParticleSystemModifierData *)object_add_particle_system(scene, ob, NULL); if(psmd) { psys = psmd->psys; -- cgit v1.2.3 From 4e405a9f3e2d13562515467f99775b1c7f6d496d Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Thu, 29 Jul 2010 02:29:32 +0000 Subject: Fixed some potential memory corruption --- source/blender/editors/sculpt_paint/paint_stroke.c | 2 +- source/blender/editors/sculpt_paint/sculpt.c | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 634829060b4..814b30a6673 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -789,7 +789,7 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev Paint *paint = paint_get_active(CTX_data_scene(C)); // XXX Brush *brush = paint_brush(paint); // XXX - float mouse[2]; + float mouse[3]; PointerRNA itemptr; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 546fbc14dfa..27d2d668790 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -3073,20 +3073,15 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, SculptSession cache->special_rotation = atan2(dx, dy) + M_PI; if (brush->flag & BRUSH_EDGE_TO_EDGE) { - float d[3]; - float halfway[3]; + float halfway[2]; float out[3]; - d[0] = dx; - d[1] = dy; - d[2] = 0; - - mul_v3_v3fl(halfway, d, 0.5f); - add_v3_v3(halfway, cache->initial_mouse); + halfway[0] = dx*0.5 + cache->initial_mouse[0]; + halfway[1] = dy*0.5 + cache->initial_mouse[1]; if (sculpt_stroke_get_location(C, stroke, out, halfway)) { copy_v3_v3(sd->anchored_location, out); - copy_v3_v3(sd->anchored_initial_mouse, halfway); + copy_v2_v2(sd->anchored_initial_mouse, halfway); copy_v2_v2(cache->tex_mouse, halfway); copy_v3_v3(cache->true_location, sd->anchored_location); sd->anchored_size /= 2.0f; @@ -3114,7 +3109,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, SculptSession const float dy = cache->last_rake[1] - cache->mouse[1]; if (cache->first_time) { - copy_v3_v3(cache->last_rake, cache->mouse); + copy_v2_v2(cache->last_rake, cache->mouse); } else if (dx*dx + dy*dy >= r*r) { cache->special_rotation = atan2(dx, dy); -- cgit v1.2.3 From 407f394952d7d8f831824eff49d2ea85be8b22bc Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Thu, 29 Jul 2010 05:16:42 +0000 Subject: == Sculpt == * Changed rotation brush to not scale down the rotation angle; easier to control this way (and works the same as anchored brush rotation.) Note: rotate brush seems to work much better with USE_ORIGINAL_NORMAL, this should probably be made the default, if not forced on. --- source/blender/editors/sculpt_paint/sculpt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender') diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 27d2d668790..3d74496ab67 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -3125,7 +3125,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, SculptSession dx = cache->mouse[0] - cache->initial_mouse[0]; dy = cache->mouse[1] - cache->initial_mouse[1]; - cache->vertex_rotation = -atan2(dx, dy) / 4.0f; + cache->vertex_rotation = -atan2(dx, dy); sd->draw_anchored = 1; copy_v2_v2(sd->anchored_initial_mouse, cache->initial_mouse); -- cgit v1.2.3 From e33460150b0a0bf63e63db6bceb36114028feea0 Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Thu, 29 Jul 2010 07:21:57 +0000 Subject: Added back modal keymap items for view manipulation mode switching in zoom/pan, so they can be added in customisation. Not sure why these were removed. --- source/blender/editors/space_view3d/view3d_edit.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/blender') diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index f4fbb501fc3..2e26988877f 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -826,6 +826,9 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf) { static EnumPropertyItem modal_items[] = { {VIEW_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, + + {VIEWROT_MODAL_SWITCH_ZOOM, "SWITCH_TO_ZOOM", 0, "Switch to Zoom"}, + {VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"}, {0, NULL, 0, NULL, NULL}}; @@ -968,6 +971,9 @@ void viewzoom_modal_keymap(wmKeyConfig *keyconf) { static EnumPropertyItem modal_items[] = { {VIEW_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, + + {VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"}, + {VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"}, {0, NULL, 0, NULL, NULL}}; -- cgit v1.2.3 From 25762f4945daf2c582f804d46c996f584a56e103 Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Thu, 29 Jul 2010 07:22:43 +0000 Subject: Fix weird colours in areas of high transmission when camera inside a volume. --- source/blender/render/intern/source/volumetric.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'source/blender') diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c index 4ddbc079e91..a58d96736d5 100644 --- a/source/blender/render/intern/source/volumetric.c +++ b/source/blender/render/intern/source/volumetric.c @@ -786,8 +786,7 @@ void shade_volume_inside(ShadeInput *shi, ShadeResult *shr) MatInside *m; Material *mat_backup; ObjectInstanceRen *obi_backup; - float prev_alpha = shr->alpha; - + /* XXX: extend to multiple volumes perhaps later */ mat_backup = shi->mat; obi_backup = shi->obi; @@ -797,10 +796,10 @@ void shade_volume_inside(ShadeInput *shi, ShadeResult *shr) shi->obi = m->obi; shi->obr = m->obi->obr; - volume_trace(shi, shr, VOL_SHADE_INSIDE); - shr->alpha += prev_alpha; - CLAMP(shr->alpha, 0.f, 1.f); + memset(shr, 0, sizeof(ShadeResult)); + volume_trace(shi, shr, VOL_SHADE_INSIDE); + shi->mat = mat_backup; shi->obi = obi_backup; shi->obr = obi_backup->obr; -- cgit v1.2.3 From 3f06cab75eb1203ae8f68535763cce456f52a895 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 29 Jul 2010 10:09:20 +0000 Subject: Fix #23073: glsl and 3d view background color didn't take color managment into account yet, should now be consistent with render. --- source/blender/editors/space_view3d/view3d_draw.c | 17 +- source/blender/gpu/intern/gpu_material.c | 7 + source/blender/gpu/intern/gpu_shader_material.glsl | 32 ++ .../blender/gpu/intern/gpu_shader_material.glsl.c | 388 +++++++++++---------- 4 files changed, 258 insertions(+), 186 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index a88ec9ead64..357b6e584e9 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1968,6 +1968,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, { Scene *sce; Base *base; + float backcol[3]; int bwinx, bwiny; glPushMatrix(); @@ -1987,7 +1988,11 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, /* set background color, fallback on the view background color */ if(scene->world) { - glClearColor(scene->world->horr, scene->world->horg, scene->world->horb, 0.0); + if(scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) + linearrgb_to_srgb_v3_v3(backcol, &scene->world->horr); + else + copy_v3_v3(backcol, &scene->world->horr); + glClearColor(backcol[0], backcol[1], backcol[2], 0.0); } else { UI_ThemeClearColor(TH_BACK); @@ -2205,6 +2210,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) Scene *sce; Base *base; Object *ob; + float backcol[3]; int retopo= 0, sculptparticle= 0; Object *obact = OBACT; char *grid_unit= NULL; @@ -2223,8 +2229,13 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) } /* clear background */ - if((v3d->flag2 & V3D_RENDER_OVERRIDE) && scene->world) - glClearColor(scene->world->horr, scene->world->horg, scene->world->horb, 0.0); + if((v3d->flag2 & V3D_RENDER_OVERRIDE) && scene->world) { + if(scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) + linearrgb_to_srgb_v3_v3(backcol, &scene->world->horr); + else + copy_v3_v3(backcol, &scene->world->horr); + glClearColor(backcol[0], backcol[1], backcol[2], 0.0); + } else UI_ThemeClearColor(TH_BACK); diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 9ed7729fea3..429eaea9b43 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -1004,6 +1004,10 @@ static void do_material_tex(GPUShadeInput *shi) else GPU_link(mat, "set_value_one", &tin); } + + if(tex->type==TEX_IMAGE) + if(mat->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) + GPU_link(mat, "srgb_to_linearrgb", tcol, tcol); if(mtex->mapto & MAP_COL) { GPUNodeLink *colfac; @@ -1244,6 +1248,9 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr) mat->obcolalpha = 1; GPU_link(mat, "shade_alpha_obcolor", shr->combined, GPU_builtin(GPU_OBCOLOR), &shr->combined); } + + if(mat->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) + GPU_link(mat, "linearrgb_to_srgb", shr->combined, &shr->combined); } GPUNodeLink *GPU_blender_material(GPUMaterial *mat, Material *ma) diff --git a/source/blender/gpu/intern/gpu_shader_material.glsl b/source/blender/gpu/intern/gpu_shader_material.glsl index c824e755afc..d517018e257 100644 --- a/source/blender/gpu/intern/gpu_shader_material.glsl +++ b/source/blender/gpu/intern/gpu_shader_material.glsl @@ -75,6 +75,38 @@ void hsv_to_rgb(vec4 hsv, out vec4 outcol) outcol = vec4(rgb, hsv.w); } +float srgb_to_linearrgb(float c) +{ + if(c < 0.04045) + return (c < 0.0)? 0.0: c * (1.0/12.92); + else + return pow((c + 0.055)*(1.0/1.055), 2.4); +} + +float linearrgb_to_srgb(float c) +{ + if(c < 0.0031308) + return (c < 0.0)? 0.0: c * 12.92; + else + return 1.055 * pow(c, 1.0/2.4) - 0.055f; +} + +void srgb_to_linearrgb(vec4 col_from, out vec4 col_to) +{ + col_to.r = srgb_to_linearrgb(col_from.r); + col_to.g = srgb_to_linearrgb(col_from.g); + col_to.b = srgb_to_linearrgb(col_from.b); + col_to.a = col_from.a; +} + +void linearrgb_to_srgb(vec4 col_from, out vec4 col_to) +{ + col_to.r = linearrgb_to_srgb(col_from.r); + col_to.g = linearrgb_to_srgb(col_from.g); + col_to.b = linearrgb_to_srgb(col_from.b); + col_to.a = col_from.a; +} + #define M_PI 3.14159265358979323846 /*********** SHADER NODES ***************/ diff --git a/source/blender/gpu/intern/gpu_shader_material.glsl.c b/source/blender/gpu/intern/gpu_shader_material.glsl.c index 920cd16c369..9c447111528 100644 --- a/source/blender/gpu/intern/gpu_shader_material.glsl.c +++ b/source/blender/gpu/intern/gpu_shader_material.glsl.c @@ -1,192 +1,214 @@ /* DataToC output of file */ -int datatoc_gpu_shader_material_glsl_size= 33537; +int datatoc_gpu_shader_material_glsl_size= 34246; char datatoc_gpu_shader_material_glsl[]= { - 10, -102,108,111, 97,116, 32,101,120,112, 95, 98,108,101,110,100,101,114, 40,102,108,111, 97,116, 32,102, 41, 10,123, 10, 9,114,101, -116,117,114,110, 32,112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, 56, 50, 56, 52, 54, 44, 32,102, 41, 59, 10,125, 10, 10,118, -111,105,100, 32,114,103, 98, 95,116,111, 95,104,115,118, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,118,101, 99, - 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, 99,109, 97,120, 44, 32, 99,109,105,110, 44, 32,104, - 44, 32,115, 44, 32,118, 44, 32, 99,100,101,108,116, 97, 59, 10, 9,118,101, 99, 51, 32, 99, 59, 10, 10, 9, 99,109, 97,120, 32, - 61, 32,109, 97,120, 40,114,103, 98, 91, 48, 93, 44, 32,109, 97,120, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, - 41, 41, 59, 10, 9, 99,109,105,110, 32, 61, 32,109,105,110, 40,114,103, 98, 91, 48, 93, 44, 32,109,105,110, 40,114,103, 98, 91, - 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10, 9, 99,100,101,108,116, 97, 32, 61, 32, 99,109, 97,120, 45, 99,109,105, -110, 59, 10, 10, 9,118, 32, 61, 32, 99,109, 97,120, 59, 10, 9,105,102, 32, 40, 99,109, 97,120, 33, 61, 48, 46, 48, 41, 10, 9, - 9,115, 32, 61, 32, 99,100,101,108,116, 97, 47, 99,109, 97,120, 59, 10, 9,101,108,115,101, 32,123, 10, 9, 9,115, 32, 61, 32, - 48, 46, 48, 59, 10, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 10, 9,105,102, 32, 40,115, 32, 61, 61, 32, 48, 46, - 48, 41, 32,123, 10, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9, 99, 32, 61, - 32, 40,118,101, 99, 51, 40, 99,109, 97,120, 44, 32, 99,109, 97,120, 44, 32, 99,109, 97,120, 41, 32, 45, 32,114,103, 98, 46,120, -121,122, 41, 47, 99,100,101,108,116, 97, 59, 10, 10, 9, 9,105,102, 32, 40,114,103, 98, 46,120, 61, 61, 99,109, 97,120, 41, 32, -104, 32, 61, 32, 99, 91, 50, 93, 32, 45, 32, 99, 91, 49, 93, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,114,103, 98, 46, -121, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 50, 46, 48, 32, 43, 32, 99, 91, 48, 93, 32, 45, 32, 32, 99, 91, 50, 93, 59, - 10, 9, 9,101,108,115,101, 32,104, 32, 61, 32, 52, 46, 48, 32, 43, 32, 99, 91, 49, 93, 32, 45, 32, 99, 91, 48, 93, 59, 10, 10, - 9, 9,104, 32, 47, 61, 32, 54, 46, 48, 59, 10, 10, 9, 9,105,102, 32, 40,104, 60, 48, 46, 48, 41, 10, 9, 9, 9,104, 32, 43, - 61, 32, 49, 46, 48, 59, 10, 9,125, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,104, 44, 32,115, 44, 32, -118, 44, 32,114,103, 98, 46,119, 41, 59, 10,125, 10, 10,118,111,105,100, 32,104,115,118, 95,116,111, 95,114,103, 98, 40,118,101, - 99, 52, 32,104,115,118, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97, -116, 32,105, 44, 32,102, 44, 32,112, 44, 32,113, 44, 32,116, 44, 32,104, 44, 32,115, 44, 32,118, 59, 10, 9,118,101, 99, 51, 32, -114,103, 98, 59, 10, 10, 9,104, 32, 61, 32,104,115,118, 91, 48, 93, 59, 10, 9,115, 32, 61, 32,104,115,118, 91, 49, 93, 59, 10, - 9,118, 32, 61, 32,104,115,118, 91, 50, 93, 59, 10, 10, 9,105,102, 40,115, 61, 61, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, - 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,118, 44, 32,118, 41, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9, -105,102, 40,104, 61, 61, 49, 46, 48, 41, 10, 9, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9, 10, 9, 9,104, 32, 42, 61, - 32, 54, 46, 48, 59, 10, 9, 9,105, 32, 61, 32,102,108,111,111,114, 40,104, 41, 59, 10, 9, 9,102, 32, 61, 32,104, 32, 45, 32, -105, 59, 10, 9, 9,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,102, 44, 32,102, 44, 32,102, 41, 59, 10, 9, 9,112, 32, 61, 32, -118, 42, 40, 49, 46, 48, 45,115, 41, 59, 10, 9, 9,113, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42,102, 41, 41, 59, 10, - 9, 9,116, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42, 40, 49, 46, 48, 45,102, 41, 41, 41, 59, 10, 9, 9, 10, 9, 9, -105,102, 32, 40,105, 32, 61, 61, 32, 48, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,116, 44, 32,112, - 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 49, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, - 99, 51, 40,113, 44, 32,118, 44, 32,112, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 50, 46, 48, - 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,118, 44, 32,116, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, - 32, 40,105, 32, 61, 61, 32, 51, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,113, 44, 32,118, 41, 59, - 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 52, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, - 40,116, 44, 32,112, 44, 32,118, 41, 59, 10, 9, 9,101,108,115,101, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32, -112, 44, 32,113, 41, 59, 10, 9,125, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 44, 32,104, -115,118, 46,119, 41, 59, 10,125, 10, 10, 35,100,101,102,105,110,101, 32, 77, 95, 80, 73, 32, 51, 46, 49, 52, 49, 53, 57, 50, 54, - 53, 51, 53, 56, 57, 55, 57, 51, 50, 51, 56, 52, 54, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 83, 72, 65, 68, - 69, 82, 32, 78, 79, 68, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32, -118, 99,111,108, 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, - 32,118,101, 99, 52, 32,118, 99,111,108, 41, 10,123, 10, 9,118, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 97,116,116,118, 99, -111,108, 46,120, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,121, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116, -118, 99,111,108, 46,122, 47, 50, 53, 53, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,117,118, 95, 97, -116,116,114,105, 98,117,116,101, 40,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, - 41, 10,123, 10, 9,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, - 49, 46, 48, 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,103,101,111,109, 40,118,101, - 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, - 44, 32,118,101, 99, 51, 32, 97,116,116,111,114, 99,111, 44, 32,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,118,101, 99, 52, - 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,103,108,111, 98, 97,108, 44, 32,111,117,116, 32,118, -101, 99, 51, 32,108,111, 99, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,111,117,116, 32,118,101, - 99, 51, 32,111,114, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110, -111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, -102,114,111,110,116, 98, 97, 99,107, 41, 10,123, 10, 9,108,111, 99, 97,108, 32, 61, 32, 99,111, 59, 10, 9,118,105,101,119, 32, - 61, 32,110,111,114,109, 97,108,105,122,101, 40,108,111, 99, 97,108, 41, 59, 10, 9,103,108,111, 98, 97,108, 32, 61, 32, 40,118, -105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40,108,111, 99, 97,108, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, - 10, 9,111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59, 10, 9,117,118, 95, 97,116,116,114,105, 98,117,116,101, 40, - 97,116,116,117,118, 44, 32,117,118, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, - 40,110,111,114, 41, 59, 9, 47, 42, 32, 98,108,101,110,100,101,114, 32,114,101,110,100,101,114, 32,110,111,114,109, 97,108, 32, -105,115, 32,110,101,103, 97,116,101,100, 32, 42, 47, 10, 9,118, 99,111,108, 95, 97,116,116,114,105, 98,117,116,101, 40, 97,116, -116,118, 99,111,108, 44, 32,118, 99,111,108, 41, 59, 10, 9,102,114,111,110,116, 98, 97, 99,107, 32, 61, 32, 49, 46, 48, 59, 10, -125, 10, 10,118,111,105,100, 32,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,109, 97,116, 52, 32,109, - 97,116, 44, 32,118,101, 99, 51, 32,109,105,110,118,101, 99, 44, 32,118,101, 99, 51, 32,109, 97,120,118,101, 99, 44, 32,102,108, -111, 97,116, 32,100,111,109,105,110, 44, 32,102,108,111, 97,116, 32,100,111,109, 97,120, 44, 32,111,117,116, 32,118,101, 99, 51, - 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 40,109, 97,116, 32, 42, 32,118,101, 99, 52, - 40,118,101, 99, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,105,102, 40,100,111,109,105,110, 32, 61, 61, 32, 49, 46, - 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32,109, 97,120, 40,111,117,116,118,101, 99, 44, 32,109,105,110,118,101, 99, - 41, 59, 10, 9,105,102, 40,100,111,109, 97,120, 32, 61, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32, -109,105,110, 40,111,117,116,118,101, 99, 44, 32,109, 97,120,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32, 99, 97,109, -101,114, 97, 40,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,105,101,119, 44, 32,111, -117,116, 32,102,108,111, 97,116, 32,111,117,116,100,101,112,116,104, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, -100,105,115,116, 41, 10,123, 10, 9,111,117,116,100,101,112,116,104, 32, 61, 32, 97, 98,115, 40, 99,111, 46,122, 41, 59, 10, 9, -111,117,116,100,105,115,116, 32, 61, 32,108,101,110,103,116,104, 40, 99,111, 41, 59, 10, 9,111,117,116,118,105,101,119, 32, 61, - 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,100,100, + 10,102,108,111, 97,116, + 32,101,120,112, 95, 98,108,101,110,100,101,114, 40,102,108,111, 97,116, 32,102, 41, 10,123, 10, 9,114,101,116,117,114,110, 32, +112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, 56, 50, 56, 52, 54, 44, 32,102, 41, 59, 10,125, 10, 10,118,111,105,100, 32,114, +103, 98, 95,116,111, 95,104,115,118, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, + 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, 99,109, 97,120, 44, 32, 99,109,105,110, 44, 32,104, 44, 32,115, 44, 32, +118, 44, 32, 99,100,101,108,116, 97, 59, 10, 9,118,101, 99, 51, 32, 99, 59, 10, 10, 9, 99,109, 97,120, 32, 61, 32,109, 97,120, + 40,114,103, 98, 91, 48, 93, 44, 32,109, 97,120, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10, 9, + 99,109,105,110, 32, 61, 32,109,105,110, 40,114,103, 98, 91, 48, 93, 44, 32,109,105,110, 40,114,103, 98, 91, 49, 93, 44, 32,114, +103, 98, 91, 50, 93, 41, 41, 59, 10, 9, 99,100,101,108,116, 97, 32, 61, 32, 99,109, 97,120, 45, 99,109,105,110, 59, 10, 10, 9, +118, 32, 61, 32, 99,109, 97,120, 59, 10, 9,105,102, 32, 40, 99,109, 97,120, 33, 61, 48, 46, 48, 41, 10, 9, 9,115, 32, 61, 32, + 99,100,101,108,116, 97, 47, 99,109, 97,120, 59, 10, 9,101,108,115,101, 32,123, 10, 9, 9,115, 32, 61, 32, 48, 46, 48, 59, 10, + 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 10, 9,105,102, 32, 40,115, 32, 61, 61, 32, 48, 46, 48, 41, 32,123, 10, + 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9, 99, 32, 61, 32, 40,118,101, 99, + 51, 40, 99,109, 97,120, 44, 32, 99,109, 97,120, 44, 32, 99,109, 97,120, 41, 32, 45, 32,114,103, 98, 46,120,121,122, 41, 47, 99, +100,101,108,116, 97, 59, 10, 10, 9, 9,105,102, 32, 40,114,103, 98, 46,120, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 99, + 91, 50, 93, 32, 45, 32, 99, 91, 49, 93, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,114,103, 98, 46,121, 61, 61, 99,109, + 97,120, 41, 32,104, 32, 61, 32, 50, 46, 48, 32, 43, 32, 99, 91, 48, 93, 32, 45, 32, 32, 99, 91, 50, 93, 59, 10, 9, 9,101,108, +115,101, 32,104, 32, 61, 32, 52, 46, 48, 32, 43, 32, 99, 91, 49, 93, 32, 45, 32, 99, 91, 48, 93, 59, 10, 10, 9, 9,104, 32, 47, + 61, 32, 54, 46, 48, 59, 10, 10, 9, 9,105,102, 32, 40,104, 60, 48, 46, 48, 41, 10, 9, 9, 9,104, 32, 43, 61, 32, 49, 46, 48, + 59, 10, 9,125, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,104, 44, 32,115, 44, 32,118, 44, 32,114,103, + 98, 46,119, 41, 59, 10,125, 10, 10,118,111,105,100, 32,104,115,118, 95,116,111, 95,114,103, 98, 40,118,101, 99, 52, 32,104,115, +118, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,105, 44, 32, +102, 44, 32,112, 44, 32,113, 44, 32,116, 44, 32,104, 44, 32,115, 44, 32,118, 59, 10, 9,118,101, 99, 51, 32,114,103, 98, 59, 10, + 10, 9,104, 32, 61, 32,104,115,118, 91, 48, 93, 59, 10, 9,115, 32, 61, 32,104,115,118, 91, 49, 93, 59, 10, 9,118, 32, 61, 32, +104,115,118, 91, 50, 93, 59, 10, 10, 9,105,102, 40,115, 61, 61, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 32, 61, 32,118, +101, 99, 51, 40,118, 44, 32,118, 44, 32,118, 41, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,105,102, 40,104, 61, + 61, 49, 46, 48, 41, 10, 9, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9, 10, 9, 9,104, 32, 42, 61, 32, 54, 46, 48, 59, + 10, 9, 9,105, 32, 61, 32,102,108,111,111,114, 40,104, 41, 59, 10, 9, 9,102, 32, 61, 32,104, 32, 45, 32,105, 59, 10, 9, 9, +114,103, 98, 32, 61, 32,118,101, 99, 51, 40,102, 44, 32,102, 44, 32,102, 41, 59, 10, 9, 9,112, 32, 61, 32,118, 42, 40, 49, 46, + 48, 45,115, 41, 59, 10, 9, 9,113, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42,102, 41, 41, 59, 10, 9, 9,116, 32, 61, + 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42, 40, 49, 46, 48, 45,102, 41, 41, 41, 59, 10, 9, 9, 10, 9, 9,105,102, 32, 40,105, + 32, 61, 61, 32, 48, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,116, 44, 32,112, 41, 59, 10, 9, 9, +101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 49, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,113, 44, + 32,118, 44, 32,112, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 50, 46, 48, 41, 32,114,103, 98, + 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,118, 44, 32,116, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, + 61, 32, 51, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,113, 44, 32,118, 41, 59, 10, 9, 9,101,108, +115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 52, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,116, 44, 32,112, + 44, 32,118, 41, 59, 10, 9, 9,101,108,115,101, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,112, 44, 32,113, 41, + 59, 10, 9,125, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 44, 32,104,115,118, 46,119, 41, + 59, 10,125, 10, 10,102,108,111, 97,116, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,102,108,111, + 97,116, 32, 99, 41, 10,123, 10, 9,105,102, 40, 99, 32, 60, 32, 48, 46, 48, 52, 48, 52, 53, 41, 10, 9, 9,114,101,116,117,114, +110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 40, 49, 46, 48, 47, 49, 50, 46, 57, 50, + 41, 59, 10, 9,101,108,115,101, 10, 9, 9,114,101,116,117,114,110, 32,112,111,119, 40, 40, 99, 32, 43, 32, 48, 46, 48, 53, 53, + 41, 42, 40, 49, 46, 48, 47, 49, 46, 48, 53, 53, 41, 44, 32, 50, 46, 52, 41, 59, 10,125, 10, 10,102,108,111, 97,116, 32,108,105, +110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, 10, 9,105,102, 40, 99, + 32, 60, 32, 48, 46, 48, 48, 51, 49, 51, 48, 56, 41, 10, 9, 9,114,101,116,117,114,110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, + 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 49, 50, 46, 57, 50, 59, 10, 9,101,108,115,101, 10, 9, 9,114,101,116,117,114,110, + 32, 49, 46, 48, 53, 53, 32, 42, 32,112,111,119, 40, 99, 44, 32, 49, 46, 48, 47, 50, 46, 52, 41, 32, 45, 32, 48, 46, 48, 53, 53, +102, 59, 10,125, 10, 10,118,111,105,100, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,118,101, 99, + 52, 32, 99,111,108, 95,102,114,111,109, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10, 9, + 99,111,108, 95,116,111, 46,114, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, + 95,102,114,111,109, 46,114, 41, 59, 10, 9, 99,111,108, 95,116,111, 46,103, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105, +110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,103, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 98, 32, 61, + 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, 10, + 9, 99,111,108, 95,116,111, 46, 97, 32, 61, 32, 99,111,108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32, +108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 95,102,114,111,109, 44, + 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10, 9, 99,111,108, 95,116,111, 46,114, 32, 61, 32, +108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,114, 41, 59, 10, 9, + 99,111,108, 95,116,111, 46,103, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, + 95,102,114,111,109, 46,103, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 98, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95, +116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 97, 32, 61, + 32, 99,111,108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10, 35,100,101,102,105,110,101, 32, 77, 95, 80, 73, 32, 51, 46, 49, + 52, 49, 53, 57, 50, 54, 53, 51, 53, 56, 57, 55, 57, 51, 50, 51, 56, 52, 54, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 32, 83, 72, 65, 68, 69, 82, 32, 78, 79, 68, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, + 10,118,111,105,100, 32,118, 99,111,108, 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 52, 32, 97,116,116,118, 99,111, +108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 41, 10,123, 10, 9,118, 99,111,108, 32, 61, 32,118,101, 99, 52, + 40, 97,116,116,118, 99,111,108, 46,120, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,121, 47, 50, 53, 53, 46, + 48, 44, 32, 97,116,116,118, 99,111,108, 46,122, 47, 50, 53, 53, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105, +100, 32,117,118, 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,111,117,116, 32,118, +101, 99, 51, 32,117,118, 41, 10,123, 10, 9,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 42, 50, 46, 48, 32, 45, + 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,103, +101,111,109, 40,118,101, 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,109, 97,116, 52, 32,118,105,101,119, +105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 97,116,116,111,114, 99,111, 44, 32,118,101, 99, 50, 32, 97,116,116,117,118, + 44, 32,118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,103,108,111, 98, 97,108, 44, + 32,111,117,116, 32,118,101, 99, 51, 32,108,111, 99, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32, +111,117,116, 32,118,101, 99, 51, 32,111,114, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 44, 32,111,117,116, 32, +118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 44, 32,111,117,116, 32, +102,108,111, 97,116, 32,102,114,111,110,116, 98, 97, 99,107, 41, 10,123, 10, 9,108,111, 99, 97,108, 32, 61, 32, 99,111, 59, 10, + 9,118,105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108,111, 99, 97,108, 41, 59, 10, 9,103,108,111, 98, 97, +108, 32, 61, 32, 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40,108,111, 99, 97,108, 44, 32, 49, 46, 48, 41, + 41, 46,120,121,122, 59, 10, 9,111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59, 10, 9,117,118, 95, 97,116,116,114, +105, 98,117,116,101, 40, 97,116,116,117,118, 44, 32,117,118, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32, 45,110,111,114, +109, 97,108,105,122,101, 40,110,111,114, 41, 59, 9, 47, 42, 32, 98,108,101,110,100,101,114, 32,114,101,110,100,101,114, 32,110, +111,114,109, 97,108, 32,105,115, 32,110,101,103, 97,116,101,100, 32, 42, 47, 10, 9,118, 99,111,108, 95, 97,116,116,114,105, 98, +117,116,101, 40, 97,116,116,118, 99,111,108, 44, 32,118, 99,111,108, 41, 59, 10, 9,102,114,111,110,116, 98, 97, 99,107, 32, 61, + 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, 32, +109, 97,116, 52, 32,109, 97,116, 44, 32,118,101, 99, 51, 32,109,105,110,118,101, 99, 44, 32,118,101, 99, 51, 32,109, 97,120,118, +101, 99, 44, 32,102,108,111, 97,116, 32,100,111,109,105,110, 44, 32,102,108,111, 97,116, 32,100,111,109, 97,120, 44, 32,111,117, +116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 40,109, 97,116, 32, + 42, 32,118,101, 99, 52, 40,118,101, 99, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,105,102, 40,100,111,109,105,110, + 32, 61, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32,109, 97,120, 40,111,117,116,118,101, 99, 44, 32, +109,105,110,118,101, 99, 41, 59, 10, 9,105,102, 40,100,111,109, 97,120, 32, 61, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, +118,101, 99, 32, 61, 32,109,105,110, 40,111,117,116,118,101, 99, 44, 32,109, 97,120,118,101, 99, 41, 59, 10,125, 10, 10,118,111, +105,100, 32, 99, 97,109,101,114, 97, 40,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, +105,101,119, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,101,112,116,104, 44, 32,111,117,116, 32,102,108,111, + 97,116, 32,111,117,116,100,105,115,116, 41, 10,123, 10, 9,111,117,116,100,101,112,116,104, 32, 61, 32, 97, 98,115, 40, 99,111, + 46,122, 41, 59, 10, 9,111,117,116,100,105,115,116, 32, 61, 32,108,101,110,103,116,104, 40, 99,111, 41, 59, 10, 9,111,117,116, +118,105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97, +116,104, 95, 97,100,100, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111, +117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, + 49, 32, 43, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,115,117, 98,116,114, 97, 99,116, 40, +102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97, +116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 45, 32,118, 97,108, + 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109,117,108,116,105,112,108,121, 40,102,108,111, 97,116, 32,118, + 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97, +108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 42, 32,118, 97,108, 50, 59, 10,125, 10, 10,118, +111,105,100, 32,109, 97,116,104, 95,100,105,118,105,100,101, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97, +116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, + 40,118, 97,108, 50, 32, 61, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10, 9,101, +108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 47, 32,118, 97,108, 50, 59, 10,125, 10, 10,118, +111,105,100, 32,109, 97,116,104, 95,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, + 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,115,105,110, 40,118, 97,108, 41, 59, + 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 99,111,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32, +111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 99,111, +115, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,116, 97,110,103,101,110,116, 40,102,108,111, + 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116, +118, 97,108, 32, 61, 32,116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,115,105, +110, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, + 10, 9,105,102, 32, 40,118, 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, + 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 97,115,105,110, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111, +117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97, 99,111,115, 40,102, +108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105, +102, 32, 40,118, 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, 10, 9, 9, +111,117,116,118, 97,108, 32, 61, 32, 97, 99,111,115, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, + 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,116, 97,110, 40,102,108,111, 97, +116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, + 97,108, 32, 61, 32, 97,116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,112,111,119, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, - 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 43, 32,118, 97, -108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,115,117, 98,116,114, 97, 99,116, 40,102,108,111, 97,116, 32, -118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, - 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 45, 32,118, 97,108, 50, 59, 10,125, 10, 10, -118,111,105,100, 32,109, 97,116,104, 95,109,117,108,116,105,112,108,121, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102, -108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9, -111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 42, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97, -116,104, 95,100,105,118,105,100,101, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, - 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 50, 32, - 61, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9, -111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 47, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97, -116,104, 95,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, -118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,115,105,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111, -105,100, 32,109, 97,116,104, 95, 99,111,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108, -111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 99,111,115, 40,118, 97,108, 41, - 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,116, 97,110,103,101,110,116, 40,102,108,111, 97,116, 32,118, 97,108, - 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, -116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,115,105,110, 40,102,108,111, 97, -116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40, -118, 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, 10, 9, 9,111,117,116, -118, 97,108, 32, 61, 32, 97,115,105,110, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, - 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97, 99,111,115, 40,102,108,111, 97,116, 32,118, - 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, - 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, - 32, 61, 32, 97, 99,111,115, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, - 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,116, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 44, - 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 97, -116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,112,111,119, 40,102,108,111, 97,116, - 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, -118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 49, 32, 62, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97, -108, 32, 61, 32,112,111,119, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, -118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,108,111,103, 40,102,108,111, 97, -116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117, -116,118, 97,108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 62, 32, 48, 46, 48, 32, 32, 38, 38, 32,118, 97,108, 50, 32, - 62, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 61, 32,108,111,103, 50, 40,118, 97,108, 49, 41, 32, 47, 32,108,111, -103, 50, 40,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 61, 32, 48, 46, 48, 59, 10,125, - 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109, 97,120, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97, -116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116, -118, 97,108, 32, 61, 32,109, 97,120, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, - 97,116,104, 95,109,105,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32, -111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,109,105, -110, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,114,111,117,110, -100, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, - 10, 9,111,117,116,118, 97,108, 61, 32,102,108,111,111,114, 40,118, 97,108, 32, 43, 32, 48, 46, 53, 41, 59, 10,125, 10, 10,118, -111,105,100, 32,109, 97,116,104, 95,108,101,115,115, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102, -108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9, -105,102, 40,118, 97,108, 49, 32, 60, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10, - 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97, -116,104, 95,103,114,101, 97,116,101,114, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97, -116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 40, -118, 97,108, 49, 32, 62, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108, -115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,115,113,117,101,101, -122,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,102,108,111, 97,116, 32,119,105,100,116,104, 44, 32,102,108,111, 97,116, - 32, 99,101,110,116,101,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117, -116,118, 97,108, 32, 61, 32, 49, 46, 48, 47, 40, 49, 46, 48, 32, 43, 32,112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, 56, 51, - 44, 32, 45, 40, 40,118, 97,108, 45, 99,101,110,116,101,114, 41, 42,119,105,100,116,104, 41, 41, 41, 59, 10,125, 10, 10,118,111, -105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,100,100, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, - 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, -118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 43, 32,118, 50, 59, 10, 9,111,117,116,118, 97, -108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, - 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, 48, 59, 10,125, 10, 10,118, -111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,115,117, 98, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, - 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117, -116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 45, 32,118, 50, 59, 10, 9,111,117,116,118, - 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, - 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, 48, 59, 10,125, 10, 10, -118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,118,101,114, 97,103,101, 40,118,101, 99, 51, 32,118, 49, 44, 32,118, + 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 49, 32, 62, 61, 32, 48, 46, 48, 41, 10, 9, + 9,111,117,116,118, 97,108, 32, 61, 32,112,111,119, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, + 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,108,111, +103, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108, +111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 62, 32, 48, 46, 48, 32, 32, 38, 38, + 32,118, 97,108, 50, 32, 62, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 61, 32,108,111,103, 50, 40,118, 97,108, 49, + 41, 32, 47, 32,108,111,103, 50, 40,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 61, 32, + 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109, 97,120, 40,102,108,111, 97,116, 32,118, 97,108, 49, + 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10, +123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,109, 97,120, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10, +118,111,105,100, 32,109, 97,116,104, 95,109,105,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32, +118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97, +108, 32, 61, 32,109,105,110, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116, +104, 95,114,111,117,110,100, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, +118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 61, 32,102,108,111,111,114, 40,118, 97,108, 32, 43, 32, 48, 46, 53, 41, + 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,108,101,115,115, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, + 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97, +108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 60, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, + 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118, +111,105,100, 32,109, 97,116,104, 95,103,114,101, 97,116,101,114, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, + 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10, +123, 10, 9,105,102, 40,118, 97,108, 49, 32, 62, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, + 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, + 32,115,113,117,101,101,122,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,102,108,111, 97,116, 32,119,105,100,116,104, 44, + 32,102,108,111, 97,116, 32, 99,101,110,116,101,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, + 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 47, 40, 49, 46, 48, 32, 43, 32,112,111,119, 40, 50, 46, 55, 49, + 56, 50, 56, 49, 56, 51, 44, 32, 45, 40, 40,118, 97,108, 45, 99,101,110,116,101,114, 41, 42,119,105,100,116,104, 41, 41, 41, 59, + 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,100,100, 40,118,101, 99, 51, 32,118, 49, 44, 32,118, 101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 43, 32,118, 50, 59, 10, - 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10, 9,111,117,116,118,101, - 99, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118, -101, 99, 95,109, 97,116,104, 95,100,111,116, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117, -116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, - 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40, 48, 44, 32, 48, 44, 32, 48, 41, 59, 10, 9,111,117,116, -118, 97,108, 32, 61, 32,100,111,116, 40,118, 49, 44, 32,118, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, - 97,116,104, 95, 99,114,111,115,115, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32, -118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, - 10, 9,111,117,116,118,101, 99, 32, 61, 32, 99,114,111,115,115, 40,118, 49, 44, 32,118, 50, 41, 59, 10, 9,111,117,116,118, 97, -108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95, -109, 97,116,104, 95,110,111,114,109, 97,108,105,122,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32, -111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116, -118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,118, 41, 59, 10, 9,111,117,116,118,101, 99, 32, 61, 32,110,111,114,109, 97, -108,105,122,101, 40,118, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,110,101,103, 97,116,101, - 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, 41, 10,123, 10, 9,111,117,116,118, 32, - 61, 32, 45,118, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,114,109, 97,108, 40,118,101, 99, 51, 32,100,105,114, 44, 32,118, -101, 99, 51, 32,110,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114, 44, 32,111,117,116, 32,102,108, -111, 97,116, 32,111,117,116,100,111,116, 41, 10,123, 10, 9,111,117,116,110,111,114, 32, 61, 32,100,105,114, 59, 10, 9,111,117, -116,100,111,116, 32, 61, 32, 45,100,111,116, 40,100,105,114, 44, 32,110,111,114, 41, 59, 10,125, 10, 10,118,111,105,100, 32, 99, -117,114,118,101,115, 95,118,101, 99, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 51, 32,118,101, 99, 44, 32,115, - 97,109,112,108,101,114, 49, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, -101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 46,120, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118, -101,109, 97,112, 44, 32, 40,118,101, 99, 46,120, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 41, 46,120, 59, 10, 9,111,117,116, -118,101, 99, 46,121, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 40,118,101, 99, - 46,121, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 41, 46,121, 59, 10, 9,111,117,116,118,101, 99, 46,122, 32, 61, 32,116,101, -120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 40,118,101, 99, 46,122, 32, 43, 32, 49, 46, 48, 41, 42, - 48, 46, 53, 41, 46,122, 59, 10, 9,105,102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 32,123, 10, 9, 9,111,117,116, -118,101, 99, 32, 61, 32, 40,111,117,116,118,101, 99, 42,102, 97, 99, 41, 32, 43, 32, 40,118,101, 99, 42, 40, 49, 46, 48, 45,102, - 97, 99, 41, 41, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32, 99,117,114,118,101,115, 95,114,103, 98, 40,102,108,111, 97, -116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,115, 97,109,112,108,101,114, 49, 68, 32, 99,117,114,118,101, -109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 46, -114, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120,116,117,114,101, 49, - 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 99,111,108, 46,114, 41, 46, 97, 41, 46,114, 59, 10, 9,111,117,116, 99,111,108, - 46,103, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120,116,117,114,101, - 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 99,111,108, 46,103, 41, 46, 97, 41, 46,103, 59, 10, 9,111,117,116, 99,111, -108, 46, 98, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120,116,117,114, -101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 99,111,108, 46, 98, 41, 46, 97, 41, 46, 98, 59, 10, 9,105,102, 32, 40, -102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 32,123, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32, 40,111,117,116, 99,111,108, - 42,102, 97, 99, 41, 32, 43, 32, 40, 99,111,108, 42, 40, 49, 46, 48, 45,102, 97, 99, 41, 41, 59, 10, 9,125, 10, 9,111,117,116, + 9,111,117,116,118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, 40, +111,117,116,118,101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, 48, + 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,115,117, 98, 40,118,101, 99, 51, 32,118, 49, 44, 32, +118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108, +111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 45, 32,118, 50, 59, + 10, 9,111,117,116,118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, + 40,111,117,116,118,101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, + 48, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,118,101,114, 97,103,101, 40,118,101, 99, 51, + 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111, +117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, + 43, 32,118, 50, 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10, + 9,111,117,116,118,101, 99, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10, +118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,100,111,116, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32, +118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111, +117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40, 48, 44, 32, 48, 44, 32, 48, 41, + 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32,100,111,116, 40,118, 49, 44, 32,118, 50, 41, 59, 10,125, 10, 10,118,111,105,100, + 32,118,101, 99, 95,109, 97,116,104, 95, 99,114,111,115,115, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, + 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, +118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 99,114,111,115,115, 40,118, 49, 44, 32,118, 50, 41, 59, 10, + 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105, +100, 32,118,101, 99, 95,109, 97,116,104, 95,110,111,114,109, 97,108,105,122,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, + 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10, +123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,118, 41, 59, 10, 9,111,117,116,118,101, 99, 32, 61, + 32,110,111,114,109, 97,108,105,122,101, 40,118, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, +110,101,103, 97,116,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, 41, 10,123, 10, + 9,111,117,116,118, 32, 61, 32, 45,118, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,114,109, 97,108, 40,118,101, 99, 51, 32, +100,105,114, 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114, 44, 32, +111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,111,116, 41, 10,123, 10, 9,111,117,116,110,111,114, 32, 61, 32,100,105, +114, 59, 10, 9,111,117,116,100,111,116, 32, 61, 32, 45,100,111,116, 40,100,105,114, 44, 32,110,111,114, 41, 59, 10,125, 10, 10, +118,111,105,100, 32, 99,117,114,118,101,115, 95,118,101, 99, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 51, 32, +118,101, 99, 44, 32,115, 97,109,112,108,101,114, 49, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, + 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 46,120, 32, 61, 32,116,101,120,116,117,114,101, 49, + 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 40,118,101, 99, 46,120, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 41, 46,120, + 59, 10, 9,111,117,116,118,101, 99, 46,121, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, + 44, 32, 40,118,101, 99, 46,121, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 41, 46,121, 59, 10, 9,111,117,116,118,101, 99, 46, +122, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 40,118,101, 99, 46,122, 32, 43, + 32, 49, 46, 48, 41, 42, 48, 46, 53, 41, 46,122, 59, 10, 10, 9,105,102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 10, + 9, 9,111,117,116,118,101, 99, 32, 61, 32, 40,111,117,116,118,101, 99, 42,102, 97, 99, 41, 32, 43, 32, 40,118,101, 99, 42, 40, + 49, 46, 48, 45,102, 97, 99, 41, 41, 59, 10, 10,125, 10, 10,118,111,105,100, 32, 99,117,114,118,101,115, 95,114,103, 98, 40,102, +108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,115, 97,109,112,108,101,114, 49, 68, 32, 99,117, +114,118,101,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99, +111,108, 46,114, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120,116,117, +114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 99,111,108, 46,114, 41, 46, 97, 41, 46,114, 59, 10, 9,111,117,116, + 99,111,108, 46,103, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120,116, +117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 99,111,108, 46,103, 41, 46, 97, 41, 46,103, 59, 10, 9,111,117, +116, 99,111,108, 46, 98, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120, +116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 99,111,108, 46, 98, 41, 46, 97, 41, 46, 98, 59, 10, 10, 9, +105,102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32, 40,111,117,116, 99, +111,108, 42,102, 97, 99, 41, 32, 43, 32, 40, 99,111,108, 42, 40, 49, 46, 48, 45,102, 97, 99, 41, 41, 59, 10, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 40,118, -- cgit v1.2.3 From 365a4b4dcc56d447120c4edda79f185047322c4d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 29 Jul 2010 11:47:00 +0000 Subject: bugfix [#21093] Alt-arrowkey 'Swap Strips' confused --- source/blender/editors/space_sequencer/sequencer_edit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 5d258ea0054..a55b2e77431 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2420,9 +2420,9 @@ void SEQUENCER_OT_previous_edit(wmOperatorType *ot) static void swap_sequence(Scene* scene, Sequence* seqa, Sequence* seqb) { int gap = seqb->startdisp - seqa->enddisp; - seqb->start = seqa->start; + seqb->start = (seqb->start - seqb->startdisp) + seqa->startdisp; calc_sequence(scene, seqb); - seqa->start = seqb->enddisp + gap; + seqa->start = (seqa->start - seqa->startdisp) + seqb->enddisp + gap; calc_sequence(scene, seqa); } -- cgit v1.2.3 From ab7c879963fbfee436c03ff49849258c5b10d726 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 29 Jul 2010 12:16:15 +0000 Subject: Fix for error while weight painting: RNA_boolean_get: OperatorStrokeElement.flip not found. flip was renamed to pen_flip but not updated everywhere. --- source/blender/editors/physics/particle_edit.c | 2 +- source/blender/editors/sculpt_paint/paint_vertex.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index f463da3f6a4..d491b1a9731 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -3336,7 +3336,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) RNA_float_get_array(itemptr, "mouse", mousef); mouse[0] = mousef[0]; mouse[1] = mousef[1]; - flip= RNA_boolean_get(itemptr, "flip"); + flip= RNA_boolean_get(itemptr, "pen_flip"); if(bedit->first) { bedit->lastmouse[0]= mouse[0]; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 93555613b07..f7cc135fb75 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1445,7 +1445,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P /* load projection matrix */ mul_m4_m4m4(mat, ob->obmat, vc->rv3d->persmat); - flip = RNA_boolean_get(itemptr, "flip"); + flip = RNA_boolean_get(itemptr, "pen_flip"); pressure = RNA_float_get(itemptr, "pressure"); RNA_float_get_array(itemptr, "mouse", mval); mval[0]-= vc->ar->winrct.xmin; @@ -1860,7 +1860,7 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P float pressure, mval[2]; RNA_float_get_array(itemptr, "mouse", mval); - flip = RNA_boolean_get(itemptr, "flip"); + flip = RNA_boolean_get(itemptr, "pen_flip"); pressure = RNA_float_get(itemptr, "pressure"); view3d_operator_needs_opengl(C); -- cgit v1.2.3 From b1f53d98e4332cfa17b7e30fb8fa11feda5d826e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 29 Jul 2010 22:34:46 +0000 Subject: patch [#23088] 2.5 Text Editor: Preserve indentation with spaces from Fabian Fricke (frigi) --- source/blender/blenkernel/BKE_text.h | 2 +- source/blender/blenkernel/intern/text.c | 17 +++++++++-------- source/blender/editors/space_text/text_ops.c | 17 ++++++++++++----- 3 files changed, 22 insertions(+), 14 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index 244fffa06ea..bcda86fdae4 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -92,7 +92,7 @@ void unindent (struct Text *text); void comment (struct Text *text); void indent (struct Text *text); void uncomment (struct Text *text); -int setcurr_tab (struct Text *text); +int setcurr_tab_spaces (struct Text *text, int space); void txt_add_marker (struct Text *text, struct TextLine *line, int start, int end, char color[4], int group, int flags); short txt_clear_marker_region (struct Text *text, struct TextLine *line, int start, int end, int group, int flags); diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 71c5963c52b..5a6ebb187cf 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -2683,19 +2683,20 @@ void uncomment(Text *text) } } -int setcurr_tab (Text *text) +int setcurr_tab_spaces (Text *text, int space) { int i = 0; int test = 0; - char *word = ":"; - char *comm = "#"; + const char *word = ":"; + const char *comm = "#"; + const char indent= (text->flags & TXT_TABSTOSPACES) ? ' ' : '\t'; static char *back_words[]= {"return", "break", "continue", "pass", "yield", NULL}; if (!text) return 0; if (!text->curl) return 0; - - while (text->curl->line[i] == '\t') + + while (text->curl->line[i] == indent) { - //we only count thos tabs that are before any text or before the curs; + //we only count those tabs/spaces that are before any text or before the curs; if (i == text->curc) { return i; @@ -2718,7 +2719,7 @@ int setcurr_tab (Text *text) } } if (indent) { - i++; + i += space; } } @@ -2729,7 +2730,7 @@ int setcurr_tab (Text *text) { if(strcspn(text->curl->line, back_words[test]) < strcspn(text->curl->line, comm)) { - i--; + i -= space; } } } diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 25726bae84b..5638cb6daf5 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -902,15 +902,22 @@ void TEXT_OT_unindent(wmOperatorType *ot) static int line_break_exec(bContext *C, wmOperator *op) { + SpaceText *st= CTX_wm_space_text(C); Text *text= CTX_data_edit_text(C); - int a, curtab; + int a, curts; + int space = (text->flags & TXT_TABSTOSPACES) ? st->tabnumber : 1; - // double check tabs before splitting the line - curtab= setcurr_tab(text); + // double check tabs/spaces before splitting the line + curts= setcurr_tab_spaces(text, space); txt_split_curline(text); - for(a=0; a < curtab; a++) - txt_add_char(text, '\t'); + for(a=0; a < curts; a++) { + if (text->flags & TXT_TABSTOSPACES) { + txt_add_char(text, ' '); + } else { + txt_add_char(text, '\t'); + } + } if(text->curl) { if(text->curl->prev) -- cgit v1.2.3 From eec131899647cdf17c50553e265a925857f35cfe Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Fri, 30 Jul 2010 00:06:59 +0000 Subject: Preview commit in sculpt brushes broke resetting curves in other areas (rgb curves etc). Fixed by adding a 'slope' parameter to curvemap_reset() to mirror curve presets around Y axis. Also removed curve preset with 'random' icon, wasn't doing what it looked like it should, this was intended only for hue correct node anyway. --- source/blender/blenkernel/BKE_colortools.h | 4 +++- source/blender/blenkernel/intern/brush.c | 2 +- source/blender/blenkernel/intern/colortools.c | 16 +++++++++++++++- source/blender/editors/interface/interface_templates.c | 4 ++-- source/blender/editors/sculpt_paint/paint_utils.c | 1 - source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c | 2 +- 6 files changed, 22 insertions(+), 7 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h index 1f2dee6dcfc..e0ebedb320b 100644 --- a/source/blender/blenkernel/BKE_colortools.h +++ b/source/blender/blenkernel/BKE_colortools.h @@ -53,9 +53,11 @@ void curvemapping_free(struct CurveMapping *cumap); struct CurveMapping *curvemapping_copy(struct CurveMapping *cumap); void curvemapping_set_black_white(struct CurveMapping *cumap, float *black, float *white); +#define CURVEMAP_SLOPE_NEGATIVE 0 +#define CURVEMAP_SLOPE_POSITIVE 1 +void curvemap_reset(struct CurveMap *cuma, struct rctf *clipr, int preset, int slope); void curvemap_remove(struct CurveMap *cuma, int flag); void curvemap_insert(struct CurveMap *cuma, float x, float y); -void curvemap_reset(struct CurveMap *cuma, struct rctf *clipr, int preset); void curvemap_sethandle(struct CurveMap *cuma, int type); void curvemapping_changed(struct CurveMapping *cumap, int rem_doubles); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 1e4fb13d1df..b9d7ea177d4 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -452,7 +452,7 @@ void brush_curve_preset(Brush *b, /*CurveMappingPreset*/int preset) cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE; b->curve->preset = preset; - curvemap_reset(cm, &b->curve->clipr, b->curve->preset); + curvemap_reset(cm, &b->curve->clipr, b->curve->preset, CURVEMAP_SLOPE_NEGATIVE); curvemapping_changed(b->curve, 0); } diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index a07c18f42f3..11801557c99 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -236,7 +236,7 @@ void curvemap_insert(CurveMap *cuma, float x, float y) cuma->curve= cmp; } -void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset) +void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset, int slope) { if(cuma->curve) MEM_freeN(cuma->curve); @@ -320,6 +320,20 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset) break; } + /* mirror curve in x direction to have positive slope + * rather than default negative slope */ + if (slope == CURVEMAP_SLOPE_POSITIVE) { + int i, last=cuma->totpoint-1; + CurveMapPoint *newpoints= MEM_dupallocN(cuma->curve); + + for (i=0; itotpoint; i++) { + newpoints[i].y = cuma->curve[last-i].y; + } + + MEM_freeN(cuma->curve); + cuma->curve = newpoints; + } + if(cuma->table) { MEM_freeN(cuma->table); cuma->table= NULL; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 6bc81b7ab18..28d0e131ef2 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1747,7 +1747,7 @@ static void curvemap_tools_dofunc(bContext *C, void *cumap_v, int event) switch(event) { case 0: /* reset */ - curvemap_reset(cuma, &cumap->clipr, cumap->preset); + curvemap_reset(cuma, &cumap->clipr, cumap->preset, CURVEMAP_SLOPE_POSITIVE); curvemapping_changed(cumap, 0); break; case 1: @@ -1827,7 +1827,7 @@ static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v) cumap->preset = CURVE_PRESET_LINE; for(a=0; acm+a, &cumap->clipr, cumap->preset); + curvemap_reset(cumap->cm+a, &cumap->clipr, cumap->preset, CURVEMAP_SLOPE_POSITIVE); cumap->black[0]=cumap->black[1]=cumap->black[2]= 0.0f; cumap->white[0]=cumap->white[1]=cumap->white[2]= 1.0f; diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index ecce64f2d10..30b3ddf6e8d 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -216,7 +216,6 @@ void BRUSH_OT_curve_preset(wmOperatorType *ot) {CURVE_PRESET_SHARP, "SHARP", 0, "Sharp", ""}, {CURVE_PRESET_SMOOTH, "SMOOTH", 0, "Smooth", ""}, {CURVE_PRESET_MAX, "MAX", 0, "Max", ""}, - {CURVE_PRESET_MID9, "MID9", 0, "Mid9", ""}, {CURVE_PRESET_LINE, "LINE", 0, "Line", ""}, {CURVE_PRESET_ROUND, "ROUND", 0, "Round", ""}, {CURVE_PRESET_ROOT, "ROOT", 0, "Root", ""}, diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c b/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c index 95db66d92f7..9eb79bb8c36 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c @@ -141,7 +141,7 @@ static void node_composit_init_huecorrect(bNode* node) for (c=0; c<3; c++) { CurveMap *cuma = &cumapping->cm[c]; - curvemap_reset(cuma, &cumapping->clipr, cumapping->preset); + curvemap_reset(cuma, &cumapping->clipr, cumapping->preset, CURVEMAP_SLOPE_POSITIVE); } /* default to showing Saturation */ -- cgit v1.2.3 From 9a9e04edfba277e6315be8a4a400fbda2b1423d3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 30 Jul 2010 00:20:05 +0000 Subject: patch [#23060] ColorRamp python access functions from Dan Eicher (dna) elem = color_ramp.elements.new(position=0.3) color_ramp.elements.remove(elem) - Modified the patch to make generic functions for adding and removing (inline code was in 3 different places) --- source/blender/blenkernel/BKE_texture.h | 3 + source/blender/blenkernel/intern/texture.c | 67 ++++++++++++++++++ source/blender/blenloader/intern/readfile.c | 4 -- .../blender/editors/interface/interface_handlers.c | 20 +----- .../editors/interface/interface_templates.c | 80 +++------------------- source/blender/makesrna/intern/rna_color.c | 79 ++++++++++++++++++++- 6 files changed, 159 insertions(+), 94 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h index 39c12a2bfd8..380672dae04 100644 --- a/source/blender/blenkernel/BKE_texture.h +++ b/source/blender/blenkernel/BKE_texture.h @@ -61,6 +61,9 @@ void init_colorband(struct ColorBand *coba, int rangetype); struct ColorBand *add_colorband(int rangetype); int do_colorband(struct ColorBand *coba, float in, float out[4]); void colorband_table_RGBA(struct ColorBand *coba, float **array, int *size); +int vergcband(const void *a1, const void *a2); +struct CBData *colorband_element_add(struct ColorBand *coba, float position); +int colorband_element_remove(struct ColorBand *coba, int index); void default_tex(struct Tex *tex); struct Tex *add_texture(const char *name); diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 57816b7e470..d05d8ccbc08 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -403,6 +403,73 @@ void colorband_table_RGBA(ColorBand *coba, float **array, int *size) do_colorband(coba, (float)a/(float)CM_TABLE, &(*array)[a*4]); } +int vergcband(const void *a1, const void *a2) +{ + const CBData *x1=a1, *x2=a2; + + if( x1->pos > x2->pos ) return 1; + else if( x1->pos < x2->pos) return -1; + return 0; +} + +CBData *colorband_element_add(struct ColorBand *coba, float position) +{ + int a; + + if(coba->tot==MAXCOLORBAND) { + return NULL; + } + else if(coba->tot > 0) { + CBData *xnew; + float col[4]; + + do_colorband(coba, position, col); + + xnew = &coba->data[coba->tot]; + xnew->pos = position; + + xnew->r = col[0]; + xnew->g = col[1]; + xnew->b = col[2]; + xnew->a = col[3]; + } + + coba->tot++; + coba->cur = coba->tot-1; + + for(a = 0; a < coba->tot; a++) + coba->data[a].cur = a; + + qsort(coba->data, coba->tot, sizeof(CBData), vergcband); + + for(a = 0; a < coba->tot; a++) { + if(coba->data[a].cur == coba->cur) { + coba->cur = a; + break; + } + } + + return coba->data + coba->cur; +} + +int colorband_element_remove(struct ColorBand *coba, int index) +{ + int a; + + if(coba->tot < 2) + return 0; + + if(index < 0 || index >= coba->tot) + return 0; + + for(a = index; a < coba->tot; a++) { + coba->data[a] = coba->data[a + 1]; + } + if(coba->cur) coba->cur--; + coba->tot--; + return 1; +} + /* ******************* TEX ************************ */ void free_texture(Tex *tex) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 3227d4b25bb..c050f25256a 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -11078,10 +11078,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) { - GroupObject *go = NULL; - Base *base = NULL; - Scene *scene = NULL; - smd->domain->vorticity = 2.0f; smd->domain->time_scale = 1.0f; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 0f8f84b94dc..f617cc4ae8d 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3251,24 +3251,8 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle if(event->ctrl) { /* insert new key on mouse location */ - if(coba->tot < MAXCOLORBAND-1) { - float pos= ((float)(mx - but->x1))/(but->x2-but->x1); - float col[4]; - - do_colorband(coba, pos, col); /* executes it */ - - coba->tot++; - coba->cur= coba->tot-1; - - coba->data[coba->cur].r= col[0]; - coba->data[coba->cur].g= col[1]; - coba->data[coba->cur].b= col[2]; - coba->data[coba->cur].a= col[3]; - coba->data[coba->cur].pos= pos; - - ui_colorband_update(coba); - } - + float pos= ((float)(mx - but->x1))/(but->x2-but->x1); + colorband_element_add(coba, pos); button_activate_state(C, but, BUTTON_STATE_EXIT); } else { diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 28d0e131ef2..01d2ad29b0e 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1302,71 +1302,20 @@ static void rna_update_cb(bContext *C, void *arg_cb, void *arg_unused) #define B_BANDCOL 1 -static int vergcband(const void *a1, const void *a2) -{ - const CBData *x1=a1, *x2=a2; - - if( x1->pos > x2->pos ) return 1; - else if( x1->pos < x2->pos) return -1; - return 0; -} - -static void colorband_pos_cb(bContext *C, void *cb_v, void *coba_v) -{ - ColorBand *coba= coba_v; - int a; - - if(coba->tot<2) return; - - for(a=0; atot; a++) coba->data[a].cur= a; - qsort(coba->data, coba->tot, sizeof(CBData), vergcband); - for(a=0; atot; a++) { - if(coba->data[a].cur==coba->cur) { - coba->cur= a; - break; - } - } - - rna_update_cb(C, cb_v, NULL); -} - static void colorband_add_cb(bContext *C, void *cb_v, void *coba_v) { ColorBand *coba= coba_v; + float pos= 0.5f; - if(coba->tot > 0) { - CBData *xnew, *x1, *x2; - float col[4]; - - xnew= &coba->data[coba->tot]; - - if(coba->tot > 1) { - if(coba->cur > 0) { - x1= &coba->data[coba->cur-1]; - x2= &coba->data[coba->cur]; - } - else { - x1= &coba->data[coba->cur]; - x2= &coba->data[coba->cur+1]; - } - - xnew->pos = x1->pos + ((x2->pos - x1->pos) / 2); - } - - do_colorband(coba, xnew->pos, col); - - xnew->r= col[0]; - xnew->g= col[1]; - xnew->b= col[2]; - xnew->a= col[3]; + if(coba->tot > 1) { + if(coba->cur > 0) pos= (coba->data[coba->cur-1].pos + coba->data[coba->cur].pos) * 0.5f; + else pos= (coba->data[coba->cur+1].pos + coba->data[coba->cur].pos) * 0.5f; } - if(coba->tot < MAXCOLORBAND-1) coba->tot++; - coba->cur= coba->tot-1; - - colorband_pos_cb(C, cb_v, coba_v); - - ED_undo_push(C, "Add colorband"); + if(colorband_element_add(coba, pos)) { + rna_update_cb(C, cb_v, NULL); + ED_undo_push(C, "Add colorband"); + } } static void colorband_del_cb(bContext *C, void *cb_v, void *coba_v) @@ -1374,17 +1323,10 @@ static void colorband_del_cb(bContext *C, void *cb_v, void *coba_v) ColorBand *coba= coba_v; int a; - if(coba->tot<2) return; - - for(a=coba->cur; atot; a++) { - coba->data[a]= coba->data[a+1]; + if(colorband_element_remove(coba, coba->cur)) { + ED_undo_push(C, "Delete colorband"); + rna_update_cb(C, cb_v, NULL); } - if(coba->cur) coba->cur--; - coba->tot--; - - ED_undo_push(C, "Delete colorband"); - - rna_update_cb(C, cb_v, NULL); } static void colorband_flip_cb(bContext *C, void *cb_v, void *coba_v) diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 9e004cd5946..f33ca10f934 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -42,6 +42,7 @@ #include "BKE_colortools.h" #include "BKE_depsgraph.h" #include "BKE_node.h" +#include "BKE_texture.h" #include "WM_api.h" #include "WM_types.h" @@ -270,6 +271,29 @@ static void rna_ColorRamp_update(Main *bmain, Scene *scene, PointerRNA *ptr) } } +static void rna_ColorRamp_eval(struct ColorBand *coba, float position, float color[4]) +{ + do_colorband(coba, position, color); +} + +static CBData *rna_ColorRampElement_new(struct ColorBand *coba, ReportList *reports, float position) +{ + CBData *element= colorband_element_add(coba, position); + + if(element==NULL) + BKE_reportf(reports, RPT_ERROR, "Unable to add element to colorband (limit %d)", MAXCOLORBAND); + + return element; +} + +static void rna_ColorRampElement_remove(struct ColorBand *coba, ReportList *reports, CBData *element) +{ + int index = (int)(element - coba->data); + if(colorband_element_remove(coba, index) == 0) + BKE_report(reports, RPT_ERROR, "Element not found in element collection or last element"); + +} + static void rna_Scopes_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Scopes *s= (Scopes*)ptr->data; @@ -396,7 +420,7 @@ static void rna_def_color_ramp_element(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - + srna= RNA_def_struct(brna, "ColorRampElement", NULL); RNA_def_struct_sdna(srna, "CBData"); RNA_def_struct_path_func(srna, "rna_ColorRampElement_path"); @@ -415,11 +439,42 @@ static void rna_def_color_ramp_element(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_ColorRamp_update"); } +static void rna_def_color_ramp_element_api(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + PropertyRNA *parm; + FunctionRNA *func; + + RNA_def_property_srna(cprop, "ColorRampElements"); + srna= RNA_def_struct(brna, "ColorRampElements", NULL); + RNA_def_struct_sdna(srna, "ColorBand"); + RNA_def_struct_path_func(srna, "rna_ColorRampElement_path"); + RNA_def_struct_ui_text(srna, "Color Ramp Elements", "Collection of Color Ramp Elements"); + + /* TODO, make these functions generic in texture.c */ + func = RNA_def_function(srna, "new", "rna_ColorRampElement_new"); + RNA_def_function_ui_description(func, "Add element to ColorRamp"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm= RNA_def_float(func, "position", 0.0f, 0.0f, 1.0f, "Position", "Position to add element", 0.0f, 1.0f); + RNA_def_property_flag(parm, PROP_REQUIRED); + /* return type */ + parm= RNA_def_pointer(func, "element", "ColorRampElement", "", "New element."); + RNA_def_function_return(func, parm); + + func = RNA_def_function(srna, "remove", "rna_ColorRampElement_remove"); + RNA_def_function_ui_description(func, "Delete element from ColorRamp"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + //parm= RNA_def_int(func, "index", 0, 0, 31, "Index", "Element to delete.", 0, 31); + parm= RNA_def_pointer(func, "element", "ColorRampElement", "", "Element to remove."); + RNA_def_property_flag(parm, PROP_REQUIRED); +} + static void rna_def_color_ramp(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - + FunctionRNA *func; + static EnumPropertyItem prop_interpolation_items[] = { {1, "EASE", 0, "Ease", ""}, {3, "CARDINAL", 0, "Cardinal", ""}, @@ -438,12 +493,30 @@ static void rna_def_color_ramp(BlenderRNA *brna) RNA_def_property_struct_type(prop, "ColorRampElement"); RNA_def_property_ui_text(prop, "Elements", ""); RNA_def_property_update(prop, 0, "rna_ColorRamp_update"); - + rna_def_color_ramp_element_api(brna, prop); + prop= RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "ipotype"); RNA_def_property_enum_items(prop, prop_interpolation_items); RNA_def_property_ui_text(prop, "Interpolation", ""); RNA_def_property_update(prop, 0, "rna_ColorRamp_update"); + + prop= RNA_def_property(srna, "total", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "tot"); + /* needs a function to do the right thing when adding elements like colorband_add_cb() */ + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_range(prop, 0, 31); /* MAXCOLORBAND = 32 */ + RNA_def_property_ui_text(prop, "Total", "Total number of elements"); + RNA_def_property_update(prop, 0, "rna_ColorRamp_update"); + + func = RNA_def_function(srna, "evaluate", "rna_ColorRamp_eval"); + RNA_def_function_ui_description(func, "Evaluate ColorRamp"); + prop= RNA_def_float(func, "position", 1.0f, 0.0f, 1.0f, "Position", "Evaluate ColorRamp at position", 0.0f, 1.0f); + RNA_def_property_flag(prop, PROP_REQUIRED); + /* return */ + prop = RNA_def_float_color(func, "color", 4, NULL, -FLT_MAX, FLT_MAX, "Color", "Color at given position", -FLT_MAX, FLT_MAX); + RNA_def_property_flag(prop, PROP_THICK_WRAP); + RNA_def_function_output(func, prop); } static void rna_def_histogram(BlenderRNA *brna) -- cgit v1.2.3 From 520d12e13e2143cfd54a7696df94cd87e7a51e39 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 30 Jul 2010 01:13:07 +0000 Subject: 3 duplicate functions: bone_flip_name() object_flip_name() flip_side_name() removed object_flip_name() & bone_flip_name(), use flip_side_name() --- source/blender/blenkernel/BKE_armature.h | 1 - source/blender/blenkernel/intern/armature.c | 111 ------------------- source/blender/editors/armature/editarmature.c | 15 ++- source/blender/editors/armature/poseobject.c | 20 ++-- .../editors/interface/interface_templates.c | 1 - source/blender/editors/object/object_select.c | 120 +-------------------- source/blender/editors/sculpt_paint/paint_vertex.c | 12 +-- 7 files changed, 24 insertions(+), 256 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index 2c661a74573..242de4d788b 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -80,7 +80,6 @@ void free_armature(struct bArmature *arm); void make_local_armature(struct bArmature *arm); struct bArmature *copy_armature(struct bArmature *arm); -void bone_flip_name (char *name, int strip_number); int bone_autoside_name (char *name, int strip_number, short axis, float head, float tail); struct Bone *get_named_bone (struct bArmature *arm, const char *name); diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 990993b1077..b9b171780c7 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -245,117 +245,6 @@ Bone *get_named_bone (bArmature *arm, const char *name) return bone; } - -#define IS_SEPARATOR(a) (a=='.' || a==' ' || a=='-' || a=='_') - -/* finds the best possible flipped name. For renaming; check for unique names afterwards */ -/* if strip_number: removes number extensions */ -void bone_flip_name (char *name, int strip_number) -{ - int len; - char prefix[128]={""}; /* The part before the facing */ - char suffix[128]={""}; /* The part after the facing */ - char replace[128]={""}; /* The replacement string */ - char number[128]={""}; /* The number extension string */ - char *index=NULL; - - len= strlen(name); - if(len<3) return; // we don't do names like .R or .L - - /* We first check the case with a .### extension, let's find the last period */ - if(isdigit(name[len-1])) { - index= strrchr(name, '.'); // last occurrence - if (index && isdigit(index[1]) ) { // doesnt handle case bone.1abc2 correct..., whatever! - if(strip_number==0) - strcpy(number, index); - *index= 0; - len= strlen(name); - } - } - - strcpy (prefix, name); - - /* first case; separator . - _ with extensions r R l L */ - if( IS_SEPARATOR(name[len-2]) ) { - switch(name[len-1]) { - case 'l': - prefix[len-1]= 0; - strcpy(replace, "r"); - break; - case 'r': - prefix[len-1]= 0; - strcpy(replace, "l"); - break; - case 'L': - prefix[len-1]= 0; - strcpy(replace, "R"); - break; - case 'R': - prefix[len-1]= 0; - strcpy(replace, "L"); - break; - } - } - /* case; beginning with r R l L , with separator after it */ - else if( IS_SEPARATOR(name[1]) ) { - switch(name[0]) { - case 'l': - strcpy(replace, "r"); - strcpy(suffix, name+1); - prefix[0]= 0; - break; - case 'r': - strcpy(replace, "l"); - strcpy(suffix, name+1); - prefix[0]= 0; - break; - case 'L': - strcpy(replace, "R"); - strcpy(suffix, name+1); - prefix[0]= 0; - break; - case 'R': - strcpy(replace, "L"); - strcpy(suffix, name+1); - prefix[0]= 0; - break; - } - } - else if(len > 5) { - /* hrms, why test for a separator? lets do the rule 'ultimate left or right' */ - index = BLI_strcasestr(prefix, "right"); - if (index==prefix || index==prefix+len-5) { - if(index[0]=='r') - strcpy (replace, "left"); - else { - if(index[1]=='I') - strcpy (replace, "LEFT"); - else - strcpy (replace, "Left"); - } - *index= 0; - strcpy (suffix, index+5); - } - else { - index = BLI_strcasestr(prefix, "left"); - if (index==prefix || index==prefix+len-4) { - if(index[0]=='l') - strcpy (replace, "right"); - else { - if(index[1]=='E') - strcpy (replace, "RIGHT"); - else - strcpy (replace, "Right"); - } - *index= 0; - strcpy (suffix, index+4); - } - } - } - - sprintf (name, "%s%s%s%s", prefix, replace, suffix, number); -} - /* Finds the best possible extension to the name on a particular axis. (For renaming, check for unique names afterwards) * This assumes that bone names are at most 32 chars long! * strip_number: removes number extensions (TODO: not used) diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 5386dbc8b98..7db20fea6eb 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -1752,9 +1752,8 @@ EditBone *ED_armature_bone_get_mirrored(ListBase *edbo, EditBone *ebo) if (ebo == NULL) return NULL; - - BLI_strncpy(name, ebo->name, sizeof(name)); - bone_flip_name(name, 0); // 0 = don't strip off number extensions + + flip_side_name(name, ebo->name, FALSE); for (eboflip= edbo->first; eboflip; eboflip=eboflip->next) { if (ebo != eboflip) { @@ -4741,11 +4740,10 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m /* find flipped group */ if (dgroup && mirror) { char name[32]; - - BLI_strncpy(name, dgroup->name, 32); + // 0 = don't strip off number extensions - bone_flip_name(name, 0); - + flip_side_name(name, dgroup->name, FALSE); + for (curdg = ob->defbase.first; curdg; curdg=curdg->next) { if (!strcmp(curdg->name, name)) break; @@ -5540,8 +5538,7 @@ static int armature_flip_names_exec (bContext *C, wmOperator *op) /* loop through selected bones, auto-naming them */ CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) { - BLI_strncpy(newname, ebone->name, sizeof(newname)); - bone_flip_name(newname, 1); // 1 = do strip off number extensions + flip_side_name(newname, ebone->name, TRUE); // 1 = do strip off number extensions ED_armature_bone_rename(arm, ebone->name, newname); } CTX_DATA_END; diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 6b71ed1ca7a..633b0b48a38 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -897,7 +897,6 @@ static int pose_paste_exec (bContext *C, wmOperator *op) Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); bPoseChannel *chan, *pchan; - char name[32]; int flip= RNA_boolean_get(op->ptr, "flipped"); /* sanity checks */ @@ -913,10 +912,12 @@ static int pose_paste_exec (bContext *C, wmOperator *op) for (chan= g_posebuf->chanbase.first; chan; chan=chan->next) { if (chan->flag & POSE_KEY) { /* get the name - if flipping, we must flip this first */ - BLI_strncpy(name, chan->name, sizeof(name)); + char name[32]; if (flip) - bone_flip_name(name, 0); /* 0 = don't strip off number extensions */ - + flip_side_name(name, chan->name, 0); /* 0 = don't strip off number extensions */ + else + BLI_strncpy(name, chan->name, sizeof(name)); + /* only copy when channel exists, poses are not meant to add random channels to anymore */ pchan= get_pose_channel(ob->pose, name); @@ -1431,7 +1432,6 @@ static int pose_flip_names_exec (bContext *C, wmOperator *op) { Object *ob= CTX_data_active_object(C); bArmature *arm; - char newname[32]; /* paranoia checks */ if (ELEM(NULL, ob, ob->pose)) @@ -1441,8 +1441,8 @@ static int pose_flip_names_exec (bContext *C, wmOperator *op) /* loop through selected bones, auto-naming them */ CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones) { - BLI_strncpy(newname, pchan->name, sizeof(newname)); - bone_flip_name(newname, 1); // 1 = do strip off number extensions + char newname[32]; + flip_side_name(newname, pchan->name, TRUE); ED_armature_bone_rename(arm, pchan->name, newname); } CTX_DATA_END; @@ -1546,10 +1546,8 @@ void pose_activate_flipped_bone(Scene *scene) if(arm->act_bone) { char name[32]; - - BLI_strncpy(name, arm->act_bone->name, 32); - bone_flip_name(name, 1); // 0 = do not strip off number extensions - + flip_side_name(name, arm->act_bone->name, TRUE); + pchanf= get_pose_channel(ob->pose, name); if(pchanf && pchanf->bone != arm->act_bone) { arm->act_bone->flag &= ~BONE_SELECTED; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 01d2ad29b0e..488258d2a06 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1321,7 +1321,6 @@ static void colorband_add_cb(bContext *C, void *cb_v, void *coba_v) static void colorband_del_cb(bContext *C, void *cb_v, void *coba_v) { ColorBand *coba= coba_v; - int a; if(colorband_element_remove(coba, coba->cur)) { ED_undo_push(C, "Delete colorband"); diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 7eedefc358b..3c86c135914 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -53,6 +53,7 @@ #include "BKE_report.h" #include "BKE_scene.h" #include "BKE_utildefines.h" +#include "BKE_deform.h" #include "WM_api.h" #include "WM_types.h" @@ -824,130 +825,17 @@ void OBJECT_OT_select_same_group(wmOperatorType *ot) } /**************************** Select Mirror ****************************/ - -/* finds the best possible flipped name. For renaming; check for unique names afterwards */ -/* if strip_number: removes number extensions */ -void object_flip_name (char *name) -{ - int len; - char prefix[128]={""}; /* The part before the facing */ - char suffix[128]={""}; /* The part after the facing */ - char replace[128]={""}; /* The replacement string */ - char number[128]={""}; /* The number extension string */ - char *index=NULL; - - len= strlen(name); - if(len<3) return; // we don't do names like .R or .L - - /* We first check the case with a .### extension, let's find the last period */ - if(isdigit(name[len-1])) { - index= strrchr(name, '.'); // last occurrence - if (index && isdigit(index[1]) ) { // doesnt handle case bone.1abc2 correct..., whatever! - strcpy(number, index); - *index= 0; - len= strlen(name); - } - } - - strcpy (prefix, name); - -#define IS_SEPARATOR(a) ((a)=='.' || (a)==' ' || (a)=='-' || (a)=='_') - - /* first case; separator . - _ with extensions r R l L */ - if( IS_SEPARATOR(name[len-2]) ) { - switch(name[len-1]) { - case 'l': - prefix[len-1]= 0; - strcpy(replace, "r"); - break; - case 'r': - prefix[len-1]= 0; - strcpy(replace, "l"); - break; - case 'L': - prefix[len-1]= 0; - strcpy(replace, "R"); - break; - case 'R': - prefix[len-1]= 0; - strcpy(replace, "L"); - break; - } - } - /* case; beginning with r R l L , with separator after it */ - else if( IS_SEPARATOR(name[1]) ) { - switch(name[0]) { - case 'l': - strcpy(replace, "r"); - strcpy(suffix, name+1); - prefix[0]= 0; - break; - case 'r': - strcpy(replace, "l"); - strcpy(suffix, name+1); - prefix[0]= 0; - break; - case 'L': - strcpy(replace, "R"); - strcpy(suffix, name+1); - prefix[0]= 0; - break; - case 'R': - strcpy(replace, "L"); - strcpy(suffix, name+1); - prefix[0]= 0; - break; - } - } - else if(len > 5) { - /* hrms, why test for a separator? lets do the rule 'ultimate left or right' */ - index = BLI_strcasestr(prefix, "right"); - if (index==prefix || index==prefix+len-5) { - if(index[0]=='r') - strcpy (replace, "left"); - else { - if(index[1]=='I') - strcpy (replace, "LEFT"); - else - strcpy (replace, "Left"); - } - *index= 0; - strcpy (suffix, index+5); - } - else { - index = BLI_strcasestr(prefix, "left"); - if (index==prefix || index==prefix+len-4) { - if(index[0]=='l') - strcpy (replace, "right"); - else { - if(index[1]=='E') - strcpy (replace, "RIGHT"); - else - strcpy (replace, "Right"); - } - *index= 0; - strcpy (suffix, index+4); - } - } - } - -#undef IS_SEPARATOR - - sprintf (name, "%s%s%s%s", prefix, replace, suffix, number); -} - static int object_select_mirror_exec(bContext *C, wmOperator *op) { - char tmpname[32]; short extend; extend= RNA_boolean_get(op->ptr, "extend"); CTX_DATA_BEGIN(C, Base*, primbase, selected_bases) { - strcpy(tmpname, primbase->object->id.name+2); - object_flip_name(tmpname); - + char tmpname[32]; + flip_side_name(tmpname, primbase->object->id.name+2, TRUE); + CTX_DATA_BEGIN(C, Base*, secbase, visible_bases) { if(!strcmp(secbase->object->id.name+2, tmpname)) { ED_base_object_select(secbase, BA_SELECT); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index f7cc135fb75..8832c7c857f 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -386,9 +386,8 @@ void wpaint_fill(VPaint *wp, Object *ob, float paintweight) int actdef= 0; char name[32]; - BLI_strncpy(name, defgroup->name, 32); - bone_flip_name(name, 0); /* 0 = don't strip off number extensions */ - + flip_side_name(name, defgroup->name, FALSE); + for (curdef = ob->defbase.first; curdef; curdef=curdef->next, actdef++) if (!strcmp(curdef->name, name)) break; @@ -1390,10 +1389,9 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *event) bDeformGroup *curdef; int actdef= 0; char name[32]; - - BLI_strncpy(name, defgroup->name, 32); - bone_flip_name(name, 0); /* 0 = don't strip off number extensions */ - + + flip_side_name(name, defgroup->name, FALSE); + for (curdef = ob->defbase.first; curdef; curdef=curdef->next, actdef++) if (!strcmp(curdef->name, name)) break; -- cgit v1.2.3 From 449f8ce4feeef8cfa57a8cbe299e0e718b9473b4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 30 Jul 2010 06:09:23 +0000 Subject: bugfix [#22859] Multi-user images cant be made into single user in texure panel. turns out this isnt exactly a bug since support was never written for this but may as well support it. now rna/py can do image.copy() too. --- source/blender/blenkernel/BKE_image.h | 2 +- source/blender/blenkernel/intern/deform.c | 1 + source/blender/blenkernel/intern/image.c | 24 ++++++++++++++++-------- source/blender/blenkernel/intern/library.c | 3 ++- source/blender/blenkernel/intern/node.c | 2 +- source/blender/makesdna/DNA_image_types.h | 4 ++-- 6 files changed, 23 insertions(+), 13 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index d7eb5fe8246..c842efaa3b2 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -159,7 +159,7 @@ void BKE_image_memorypack(struct Image *ima); void BKE_image_print_memlist(void); /* empty image block, of similar type and filename */ -struct Image *BKE_image_copy(struct Image *ima); +struct Image *copy_image(struct Image *ima); /* merge source into dest, and free source */ void BKE_image_merge(struct Image *dest, struct Image *source); diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index ccb6ebe1f1e..5f262c526c3 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -471,6 +471,7 @@ void flip_side_name (char *name, const char *from_name, int strip_number) #undef IS_SEPARATOR sprintf (name, "%s%s%s%s", prefix, replace, suffix, number); + printf("'%s' --> '%s'\n", from_name, name); } float defvert_find_weight(const struct MDeformVert *dvert, int group_num) diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index ffd0b378f07..77607ae25b6 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -287,17 +287,25 @@ static void image_assign_ibuf(Image *ima, ImBuf *ibuf, int index, int frame) } /* empty image block, of similar type and filename */ -Image *BKE_image_copy(Image *ima) +Image *copy_image(Image *ima) { - Image *new= image_alloc(ima->id.name+2, ima->source, ima->type); + Image *nima= image_alloc(ima->id.name+2, ima->source, ima->type); - BLI_strncpy(new->name, ima->name, sizeof(ima->name)); - - new->gen_x= ima->gen_x; - new->gen_y= ima->gen_y; - new->gen_type= ima->gen_type; + BLI_strncpy(nima->name, ima->name, sizeof(ima->name)); + + nima->flag= ima->flag; + nima->tpageflag= ima->tpageflag; - return new; + nima->gen_x= ima->gen_x; + nima->gen_y= ima->gen_y; + nima->gen_type= ima->gen_type; + + nima->animspeed= ima->animspeed; + + nima->aspx= ima->aspx; + nima->aspy= ima->aspy; + + return nima; } void BKE_image_merge(Image *dest, Image *source) diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index acfaef9eb88..716a0b7d41b 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -262,7 +262,8 @@ int id_copy(ID *id, ID **newid, int test) if(!test) *newid= (ID*)copy_texture((Tex*)id); return 1; case ID_IM: - return 0; /* not implemented */ + if(!test) *newid= (ID*)copy_image((Image*)id); + return 1; case ID_WV: return 0; /* deprecated */ case ID_LT: diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index add011d0950..ff1887b0883 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -2565,7 +2565,7 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree) if(ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { if(node->id) { if(node->flag & NODE_DO_OUTPUT) - node->new_node->id= (ID *)BKE_image_copy((Image *)node->id); + node->new_node->id= (ID *)copy_image((Image *)node->id); else node->new_node->id= NULL; } diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h index 1695ceb73a5..d1aa3c00ac4 100644 --- a/source/blender/makesdna/DNA_image_types.h +++ b/source/blender/makesdna/DNA_image_types.h @@ -105,7 +105,7 @@ typedef struct Image { /* **************** IMAGE ********************* */ -/* flag */ +/* Image.flag */ #define IMA_FIELDS 1 #define IMA_STD_FIELD 2 #define IMA_DO_PREMUL 4 @@ -115,7 +115,7 @@ typedef struct Image { #define IMA_DEPRECATED 64 #define IMA_OLD_PREMUL 128 -/* tpageflag */ +/* Image.tpageflag */ #define IMA_TILES 1 #define IMA_TWINANIM 2 #define IMA_COLCYCLE 4 /* Depreciated */ -- cgit v1.2.3 From 648f40f409f1f3fd351a9baa3d0a9f29c4033cf1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 30 Jul 2010 06:48:18 +0000 Subject: bugfix [#22660] Text Boxes properties are not animateable. suggestion [#23093] Curve -> CurveMapping in brush... --- source/blender/makesrna/intern/rna_brush.c | 2 +- source/blender/makesrna/intern/rna_curve.c | 15 ++++++++++++++- source/blender/python/intern/bpy_rna.c | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) (limited to 'source/blender') diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 7a08e1403e3..b9664c556db 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -731,7 +731,7 @@ static void rna_def_brush(BlenderRNA *brna) prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_ui_text(prop, "Curve", "Editable falloff curve"); + RNA_def_property_ui_text(prop, "CurveMapping", "Editable falloff curve"); RNA_def_property_update(prop, 0, "rna_Brush_update"); /* texture */ diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 84807446f50..e006f3444b0 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -510,6 +510,18 @@ static void rna_Curve_active_spline_set(PointerRNA *ptr, PointerRNA value) cu->actnu= BLI_findindex(nubase, nu); } +static char *rna_TextBox_path(PointerRNA *ptr) +{ + Curve *cu= (Curve*)ptr->id.data; + TextBox *tb= ptr->data; + int index= (int)(tb - cu->tb); + + if (index >= 0 && index < cu->totbox) + return BLI_sprintfN("textboxes[%d]", index); + else + return BLI_strdup(""); +} + #else static void rna_def_bpoint(BlenderRNA *brna) @@ -841,7 +853,6 @@ static void rna_def_textbox(BlenderRNA *brna) srna= RNA_def_struct(brna, "TextBox", NULL); RNA_def_struct_ui_text(srna, "Text Box", "Text bounding box for layout"); - // XXX: still needs path function /* number values */ prop= RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE); @@ -867,6 +878,8 @@ static void rna_def_textbox(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, 50.0f); RNA_def_property_ui_text(prop, "Textbox Height", ""); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); + + RNA_def_struct_path_func(srna, "rna_TextBox_path"); } static void rna_def_charinfo(BlenderRNA *brna) diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 6b8c9a5e3a4..2a708c82697 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -4803,7 +4803,7 @@ static PyObject *pyrna_basetype_register(PyObject *self, PyObject *py_class) reg= RNA_struct_register(srna); if(!reg) { - PyErr_SetString(PyExc_ValueError, "bpy.types.register(...): expected a Type subclassed from a registerable rna type (no register supported)."); + PyErr_Format(PyExc_ValueError, "bpy.types.register(...): expected a subclass of a registerable rna type (%.200s does not support registration).", RNA_struct_identifier(srna)); return NULL; } -- cgit v1.2.3 From 477c924f50c4dffcbf358fb8de63ec28dc35cbf1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 30 Jul 2010 08:43:22 +0000 Subject: bugfix [#20038] Vertex path selection not working in Vertex/Face mode - disable this tool if edge mode isnt enabled using its poll function. Also fixed a bug where it would de-select the last active edge. - made view3d grid drawing use GL_LINES's for less context switching. --- source/blender/editors/mesh/editmesh_mods.c | 26 +++++++++++++--- source/blender/editors/space_view3d/view3d_draw.c | 37 ++++++++++++++--------- 2 files changed, 44 insertions(+), 19 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index 4bea6488adb..f952820c1f0 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -2150,7 +2150,7 @@ static void mouse_mesh_shortest_path(bContext *C, short mval[2]) if(ese && ese->type == EDITEDGE) { eed_act = (EditEdge*)ese->data; if (eed_act != eed) { - if (edgetag_shortest_path(vc.scene, em, eed_act, eed)) { + if (edgetag_shortest_path(vc.scene, em, eed_act, eed)) { /* <- this is where the magic happens */ EM_remove_selection(em, eed_act, EDITEDGE); path = 1; } @@ -2163,13 +2163,19 @@ static void mouse_mesh_shortest_path(bContext *C, short mval[2]) } /* even if this is selected it may not be in the selection list */ - if(edgetag_context_check(vc.scene, eed)==EDGE_MODE_SELECT) + if(edgetag_context_check(vc.scene, eed)==0) { EM_remove_selection(em, eed, EDITEDGE); + } else { /* other modes need to keep the last edge tagged */ - if(eed_act) - EM_select_edge(eed_act, 0); + if(eed_act) { + if(vc.scene->toolsettings->edge_mode!=EDGE_MODE_SELECT) { + /* for non-select modes, always de-select the previous active edge */ + EM_select_edge(eed_act, 0); + } + } + /* set the new edge active */ EM_select_edge(eed, 1); EM_store_selection(em, eed, EDITEDGE); } @@ -2208,6 +2214,16 @@ static int mesh_shortest_path_select_invoke(bContext *C, wmOperator *op, wmEvent return OPERATOR_FINISHED; } + +static int mesh_shortest_path_select_poll(bContext *C) +{ + if(ED_operator_editmesh_view3d(C)) { + Object *obedit= CTX_data_edit_object(C); + EditMesh *em= BKE_mesh_get_editmesh(obedit->data); + return (em->selectmode & SCE_SELECT_EDGE); + } + return 0; +} void MESH_OT_select_shortest_path(wmOperatorType *ot) { @@ -2218,7 +2234,7 @@ void MESH_OT_select_shortest_path(wmOperatorType *ot) /* api callbacks */ ot->invoke= mesh_shortest_path_select_invoke; - ot->poll= ED_operator_editmesh_view3d; + ot->poll= mesh_shortest_path_select_poll; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 357b6e584e9..8408152d23c 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -211,28 +211,37 @@ int view3d_test_clipping(RegionView3D *rv3d, float *vec, int local) static void drawgrid_draw(ARegion *ar, float wx, float wy, float x, float y, float dx) -{ - float fx, fy; - +{ + float v1[2], v2[2]; + x+= (wx); y+= (wy); - fx= x/dx; - fx= x-dx*floor(fx); + + v1[1]= 0.0f; + v2[1]= (float)ar->winy; + + v1[0] = v2[0] = x-dx*floor(x/dx); - while(fx< ar->winx) { - fdrawline(fx, 0.0, fx, (float)ar->winy); - fx+= dx; + glBegin(GL_LINES); + + while(v1[0] < ar->winx) { + glVertex2fv(v1); + glVertex2fv(v2); + v1[0] = v2[0] = v1[0] + dx; } - fy= y/dx; - fy= y-dx*floor(fy); - + v1[0]= 0.0f; + v2[0]= (float)ar->winx; - while(fy< ar->winy) { - fdrawline(0.0, fy, (float)ar->winx, fy); - fy+= dx; + v1[1]= v2[1]= y-dx*floor(y/dx); + + while(v1[1] < ar->winy) { + glVertex2fv(v1); + glVertex2fv(v2); + v1[1] = v2[1] = v1[1] + dx; } + glEnd(); } #define GRID_MIN_PX 6.0f -- cgit v1.2.3 From fdae90fb1fc8496ad90c0cf980c1799abab2c2fb Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 30 Jul 2010 09:32:21 +0000 Subject: Revert [#23093] Curve -> CurveMapping in brush. Don't use camel case for UI text, and this makes it inconsistent with the property name too, Curve is just fine... --- source/blender/makesrna/intern/rna_brush.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender') diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index b9664c556db..7a08e1403e3 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -731,7 +731,7 @@ static void rna_def_brush(BlenderRNA *brna) prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_ui_text(prop, "CurveMapping", "Editable falloff curve"); + RNA_def_property_ui_text(prop, "Curve", "Editable falloff curve"); RNA_def_property_update(prop, 0, "rna_Brush_update"); /* texture */ -- cgit v1.2.3 From 3b9b4f76054e55465c3c0ddbaed3f09618860b58 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 30 Jul 2010 10:44:00 +0000 Subject: Fix #23103: * missing glsl update when changing color management setting * disable glsl lamps only when disabling them for render --- source/blender/editors/render/render_shading.c | 18 ++++++++++++++++++ source/blender/editors/space_view3d/view3d_draw.c | 2 +- source/blender/gpu/intern/gpu_material.c | 2 +- source/blender/makesrna/intern/rna_scene.c | 21 +++++++++++++++------ 4 files changed, 35 insertions(+), 8 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 6e8c3b721d0..9fd0074b9f1 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -209,6 +209,21 @@ static void image_changed(Main *bmain, Image *ima) texture_changed(bmain, tex); } +static void scene_changed(Main *bmain, Scene *sce) +{ + Object *ob; + Material *ma; + + /* glsl */ + for(ob=bmain->object.first; ob; ob=ob->id.next) + if(ob->gpulamp.first) + GPU_lamp_free(ob); + + for(ma=bmain->mat.first; ma; ma=ma->id.next) + if(ma->gpumaterial.first) + GPU_material_free(ma); +} + void ED_render_id_flush_update(Main *bmain, ID *id) { if(!id) @@ -230,6 +245,9 @@ void ED_render_id_flush_update(Main *bmain, ID *id) case ID_IM: image_changed(bmain, (Image*)id); break; + case ID_SCE: + scene_changed(bmain, (Scene*)id); + break; default: break; } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 8408152d23c..69375674d94 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1807,7 +1807,7 @@ static void gpu_render_lamp_update(Scene *scene, View3D *v3d, Object *ob, Object lamp = GPU_lamp_from_blender(scene, ob, par); if(lamp) { - GPU_lamp_update(lamp, ob->lay, (ob->restrictflag & OB_RESTRICT_VIEW), obmat); + GPU_lamp_update(lamp, ob->lay, (ob->restrictflag & OB_RESTRICT_RENDER), obmat); GPU_lamp_update_colors(lamp, la->r, la->g, la->b, la->energy); if((ob->lay & v3d->lay) && GPU_lamp_has_shadow_buffer(lamp)) { diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 429eaea9b43..f5898c8d0be 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -1363,7 +1363,7 @@ static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *l lamp->col[1]= la->g*lamp->energy; lamp->col[2]= la->b*lamp->energy; - GPU_lamp_update(lamp, ob->lay, (ob->restrictflag & OB_RESTRICT_VIEW), ob->obmat); + GPU_lamp_update(lamp, ob->lay, (ob->restrictflag & OB_RESTRICT_RENDER), ob->obmat); lamp->spotsi= la->spotsize; if(lamp->mode & LA_HALO) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index e48f07f48d6..a08e9e4252f 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -679,6 +679,13 @@ static int rna_RenderSettings_engine_get(PointerRNA *ptr) return 0; } +static void rna_Scene_glsl_update(Main *bmain, Scene *unused, PointerRNA *ptr) +{ + Scene *scene= (Scene*)ptr->id.data; + + DAG_id_flush_update(&scene->id, 0); +} + static void rna_RenderSettings_color_management_update(Main *bmain, Scene *unused, PointerRNA *ptr) { /* reset image nodes */ @@ -697,6 +704,8 @@ static void rna_RenderSettings_color_management_update(Main *bmain, Scene *unuse } } } + + rna_Scene_glsl_update(bmain, unused, ptr); } static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value) @@ -1749,32 +1758,32 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "glsl_lights", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_LIGHTS); RNA_def_property_ui_text(prop, "GLSL Lights", "Use lights for GLSL rendering"); - RNA_def_property_update(prop, NC_SCENE|NA_EDITED, NULL); + RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_glsl_update"); prop= RNA_def_property(srna, "glsl_shaders", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_SHADERS); RNA_def_property_ui_text(prop, "GLSL Shaders", "Use shaders for GLSL rendering"); - RNA_def_property_update(prop, NC_SCENE|NA_EDITED, NULL); + RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_glsl_update"); prop= RNA_def_property(srna, "glsl_shadows", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_SHADOWS); RNA_def_property_ui_text(prop, "GLSL Shadows", "Use shadows for GLSL rendering"); - RNA_def_property_update(prop, NC_SCENE|NA_EDITED, NULL); + RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_glsl_update"); prop= RNA_def_property(srna, "glsl_ramps", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_RAMPS); RNA_def_property_ui_text(prop, "GLSL Ramps", "Use ramps for GLSL rendering"); - RNA_def_property_update(prop, NC_SCENE|NA_EDITED, NULL); + RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_glsl_update"); prop= RNA_def_property(srna, "glsl_nodes", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_NODES); RNA_def_property_ui_text(prop, "GLSL Nodes", "Use nodes for GLSL rendering"); - RNA_def_property_update(prop, NC_SCENE|NA_EDITED, NULL); + RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_glsl_update"); prop= RNA_def_property(srna, "glsl_extra_textures", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_EXTRA_TEX); RNA_def_property_ui_text(prop, "GLSL Extra Textures", "Use extra textures like normal or specular maps for GLSL rendering"); - RNA_def_property_update(prop, NC_SCENE|NA_EDITED, NULL); + RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_glsl_update"); } static void rna_def_scene_render_layer(BlenderRNA *brna) -- cgit v1.2.3 From 385c8af44956b54a8d789bb3f55678f79b21a4de Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 30 Jul 2010 11:19:41 +0000 Subject: bugfix [#23104] Crash when console: .local_view. autocomplete --- source/blender/makesrna/intern/rna_space.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'source/blender') diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 227466f808d..8bb736f7976 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -310,22 +310,32 @@ static PointerRNA rna_SpaceView3D_region_3d_get(PointerRNA *ptr) { View3D *v3d= (View3D*)(ptr->data); ScrArea *sa= rna_area_from_space(ptr); - ListBase *regionbase= (sa->spacedata.first == v3d)? &sa->regionbase: &v3d->regionbase; - ARegion *ar= regionbase->last; /* always last in list, weak .. */ + void *regiondata= NULL; + if(sa) { + ListBase *regionbase= (sa->spacedata.first == v3d)? &sa->regionbase: &v3d->regionbase; + ARegion *ar= regionbase->last; /* always last in list, weak .. */ + regiondata= ar->regiondata; + } - return rna_pointer_inherit_refine(ptr, &RNA_RegionView3D, ar->regiondata); + return rna_pointer_inherit_refine(ptr, &RNA_RegionView3D, regiondata); } static PointerRNA rna_SpaceView3D_region_quadview_get(PointerRNA *ptr) { View3D *v3d= (View3D*)(ptr->data); ScrArea *sa= rna_area_from_space(ptr); - ListBase *regionbase= (sa->spacedata.first == v3d)? &sa->regionbase: &v3d->regionbase; - ARegion *ar= regionbase->last; /* always before last in list, weak .. */ - - ar= (ar->alignment == RGN_ALIGN_QSPLIT)? ar->prev: NULL; + void *regiondata= NULL; + if(sa) { + ListBase *regionbase= (sa->spacedata.first == v3d)? &sa->regionbase: &v3d->regionbase; + ARegion *ar= regionbase->last; /* always before last in list, weak .. */ + + ar= (ar->alignment == RGN_ALIGN_QSPLIT)? ar->prev: NULL; + if(ar) { + regiondata= ar->regiondata; + } + } - return rna_pointer_inherit_refine(ptr, &RNA_RegionView3D, (ar)? ar->regiondata: NULL); + return rna_pointer_inherit_refine(ptr, &RNA_RegionView3D, regiondata); } static void rna_RegionView3D_quadview_update(Main *main, Scene *scene, PointerRNA *ptr) -- cgit v1.2.3 From 9e45fa7f2fb7b7044340c8a9b28b9a3dcc2e4300 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 30 Jul 2010 11:40:23 +0000 Subject: bugfix [#23106] Blender crashes (segfault) when scene strip file is missing --- source/blender/blenkernel/intern/sequencer.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 0651f1a6261..f55cae7eaef 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1800,8 +1800,8 @@ static ImBuf * seq_render_scene_strip_impl( { ImBuf * ibuf = 0; float frame= seq->sfra + nr + seq->anim_startofs; - float oldcfra = seq->scene->r.cfra; - Object *oldcamera= seq->scene->camera; + float oldcfra; + Object *oldcamera; ListBase oldmarkers; /* Hack! This function can be called from do_render_seq(), in that case @@ -1820,21 +1820,20 @@ static ImBuf * seq_render_scene_strip_impl( int doseq; int doseq_gl= G.rendering ? /*(scene->r.seq_flag & R_SEQ_GL_REND)*/ 0 : (scene->r.seq_flag & R_SEQ_GL_PREV); int have_seq= FALSE; - Scene *sce= seq->scene;// *oldsce= scene; + Scene *sce= seq->scene; /* dont refer to seq->scene above this point!, it can be NULL */ int sce_valid= FALSE; - have_seq= (sce->r.scemode & R_DOSEQ) - && sce->ed && sce->ed->seqbase.first; - if(sce) { + have_seq= (sce->r.scemode & R_DOSEQ) && sce->ed && sce->ed->seqbase.first; sce_valid= (sce->camera || have_seq); } - if (!sce_valid) { - return 0; - } + if (!sce_valid) + return NULL; + + oldcfra= seq->scene->r.cfra; + oldcamera= seq->scene->camera; - /* prevent eternal loop */ doseq= scene->r.scemode & R_DOSEQ; scene->r.scemode &= ~R_DOSEQ; -- cgit v1.2.3 From 5251a9b3bf39c1520bdad4c8aa3f6273def76c77 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 30 Jul 2010 11:50:00 +0000 Subject: 2.5: remove vertex normal flip option, this is more harmful than helpful in many cases, and also gave incorrect rim lighting. --- source/blender/blenkernel/intern/mesh.c | 1 - source/blender/makesdna/DNA_curve_types.h | 2 +- source/blender/makesdna/DNA_mesh_types.h | 2 +- source/blender/makesrna/intern/rna_curve.c | 5 --- source/blender/makesrna/intern/rna_mesh.c | 4 -- .../blender/render/intern/include/render_types.h | 16 ++++---- .../blender/render/intern/include/renderdatabase.h | 2 +- .../blender/render/intern/source/convertblender.c | 43 +--------------------- source/blender/render/intern/source/rayshade.c | 4 -- .../blender/render/intern/source/renderdatabase.c | 28 +------------- source/blender/render/intern/source/shadeinput.c | 25 +++---------- 11 files changed, 20 insertions(+), 112 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index cd8b2eb0a8e..66e8c10206c 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -697,7 +697,6 @@ void mball_to_mesh(ListBase *lb, Mesh *me) if(dl==0) return; if(dl->type==DL_INDEX4) { - me->flag= ME_NOPUNOFLIP; me->totvert= dl->nr; me->totface= dl->parts; diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h index c13cb08badd..283c810a1f6 100644 --- a/source/blender/makesdna/DNA_curve_types.h +++ b/source/blender/makesdna/DNA_curve_types.h @@ -245,7 +245,7 @@ typedef struct Curve { #define CU_PATH 8 #define CU_FOLLOW 16 #define CU_UV_ORCO 32 -#define CU_NOPUNOFLIP 64 +#define CU_DEPRECATED 64 #define CU_STRETCH 128 #define CU_OFFS_PATHDIST 256 #define CU_FAST 512 /* Font: no filling inside editmode */ diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h index 68b05dd6595..4e41309cff4 100644 --- a/source/blender/makesdna/DNA_mesh_types.h +++ b/source/blender/makesdna/DNA_mesh_types.h @@ -129,7 +129,7 @@ typedef struct TFace { /* me->flag */ /* #define ME_ISDONE 1 */ -#define ME_NOPUNOFLIP 2 +#define ME_DEPRECATED 2 #define ME_TWOSIDED 4 #define ME_UVEFFECT 8 #define ME_VCOLEFFECT 16 diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index e006f3444b0..d10aed1595a 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -706,11 +706,6 @@ static void rna_def_nurbs(BlenderRNA *brna, StructRNA *srna) RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_UV_ORCO); RNA_def_property_ui_text(prop, "Map Along Length", "Generate texture mapping coordinates following the curve direction, rather than the local bounding box"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); - - prop= RNA_def_property(srna, "vertex_normal_flip", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CU_NOPUNOFLIP); - RNA_def_property_ui_text(prop, "Vertex Normal Flip", "Flip vertex normals towards the camera during render"); - RNA_def_property_update(prop, 0, "rna_Curve_update_data"); } static void rna_def_font(BlenderRNA *brna, StructRNA *srna) diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 6e172e3bdd0..37d6b2b93de 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1748,10 +1748,6 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_range(prop, 1, 80); RNA_def_property_ui_text(prop, "Auto Smooth Angle", "Defines maximum angle between face normals that 'Auto Smooth' will operate on"); - prop= RNA_def_property(srna, "vertex_normal_flip", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ME_NOPUNOFLIP); - RNA_def_property_ui_text(prop, "Vertex Normal Flip", "Flip vertex normals towards the camera during render"); - prop= RNA_def_property(srna, "double_sided", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_TWOSIDED); RNA_def_property_ui_text(prop, "Double Sided", "Render/display the mesh with double or single sided lighting"); diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index 2b0de46f2e6..c75ae594daf 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -587,23 +587,21 @@ typedef struct LampRen { #define R_HALO 2 #define R_SEC_FIELD 4 #define R_LAMPHALO 8 -#define R_GLOB_NOPUNOFLIP 16 -#define R_NEED_TANGENT 32 -#define R_BAKE_TRACE 128 -#define R_BAKING 256 +#define R_NEED_TANGENT 16 +#define R_BAKE_TRACE 32 +#define R_BAKING 64 /* vlakren->flag (vlak = face in dutch) char!!! */ #define R_SMOOTH 1 #define R_HIDDEN 2 /* strand flag, means special handling */ #define R_STRAND 4 -#define R_NOPUNOFLIP 8 -#define R_FULL_OSA 16 -#define R_FACE_SPLIT 32 +#define R_FULL_OSA 8 +#define R_FACE_SPLIT 16 /* Tells render to divide face other way. */ -#define R_DIVIDE_24 64 +#define R_DIVIDE_24 32 /* vertex normals are tangent or view-corrected vector, for hair strands */ -#define R_TANGENT 128 +#define R_TANGENT 64 /* strandbuffer->flag */ #define R_STRAND_BSPLINE 1 diff --git a/source/blender/render/intern/include/renderdatabase.h b/source/blender/render/intern/include/renderdatabase.h index 2a0086b436c..76e7fe7b4f3 100644 --- a/source/blender/render/intern/include/renderdatabase.h +++ b/source/blender/render/intern/include/renderdatabase.h @@ -115,7 +115,7 @@ struct MCol *RE_vlakren_get_mcol(struct ObjectRen *obr, VlakRen *ren, int n, cha float *RE_vlakren_get_surfnor(struct ObjectRen *obr, VlakRen *ren, int verify); float *RE_vlakren_get_nmap_tangent(struct ObjectRen *obr, VlakRen *ren, int verify); RadFace **RE_vlakren_get_radface(struct ObjectRen *obr, VlakRen *ren, int verify); -int RE_vlakren_get_normal(struct Render *re, struct ObjectInstanceRen *obi, struct VlakRen *vlr, float *nor); +void RE_vlakren_get_normal(struct Render *re, struct ObjectInstanceRen *obi, struct VlakRen *vlr, float *nor); float *RE_strandren_get_surfnor(struct ObjectRen *obr, struct StrandRen *strand, int verify); float *RE_strandren_get_uv(struct ObjectRen *obr, struct StrandRen *strand, int n, char **name, int verify); diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index c5d69e69586..6564dd09864 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -355,17 +355,6 @@ static void split_v_renderfaces(ObjectRen *obr, int startvlak, int startvert, in } } -/* ------------------------------------------------------------------------- */ - -static int check_vnormal(float *n, float *veno) -{ - float inp; - - inp=n[0]*veno[0]+n[1]*veno[1]+n[2]*veno[2]; - if(inp < -FLT_EPSILON10) return 1; - return 0; -} - /* ------------------------------------------------------------------------- */ /* Stress, tangents and normals */ /* ------------------------------------------------------------------------- */ @@ -536,9 +525,6 @@ static void calc_vertexnormals(Render *re, ObjectRen *obr, int do_tangent, int d float n1[3], n2[3], n3[3], n4[3]; float fac1, fac2, fac3, fac4=0.0f; - if(re->flag & R_GLOB_NOPUNOFLIP) - vlr->flag |= R_NOPUNOFLIP; - sub_v3_v3v3(n1, v2->co, v1->co); normalize_v3(n1); sub_v3_v3v3(n2, v3->co, v2->co); @@ -562,21 +548,11 @@ static void calc_vertexnormals(Render *re, ObjectRen *obr, int do_tangent, int d fac3= saacos(-n2[0]*n3[0]-n2[1]*n3[1]-n2[2]*n3[2]); fac4= saacos(-n3[0]*n4[0]-n3[1]*n4[1]-n3[2]*n4[2]); - if(!(vlr->flag & R_NOPUNOFLIP)) { - if( check_vnormal(vlr->n, v4->n) ) fac4= -fac4; - } - v4->n[0] +=fac4*vlr->n[0]; v4->n[1] +=fac4*vlr->n[1]; v4->n[2] +=fac4*vlr->n[2]; } - if(!(vlr->flag & R_NOPUNOFLIP)) { - if( check_vnormal(vlr->n, v1->n) ) fac1= -fac1; - if( check_vnormal(vlr->n, v2->n) ) fac2= -fac2; - if( check_vnormal(vlr->n, v3->n) ) fac3= -fac3; - } - v1->n[0] +=fac1*vlr->n[0]; v1->n[1] +=fac1*vlr->n[1]; v1->n[2] +=fac1*vlr->n[2]; @@ -1021,7 +997,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par else width= 1.0f; if(ma->mode & MA_TANGENT_STR) - flag= R_SMOOTH|R_NOPUNOFLIP|R_TANGENT; + flag= R_SMOOTH|R_TANGENT; else flag= R_SMOOTH; @@ -2431,7 +2407,7 @@ static void init_render_mball(Render *re, ObjectRen *obr) normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co); vlr->mat= ma; - vlr->flag= ME_SMOOTH+R_NOPUNOFLIP; + vlr->flag= ME_SMOOTH; vlr->ec= 0; /* mball -too bad- always has triangles, because quads can be non-planar */ @@ -2460,10 +2436,8 @@ static void init_render_mball(Render *re, ObjectRen *obr) /* returns amount of vertices added for orco */ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar, float *orco, float mat[4][4]) { - Object *ob= obr->ob; VertRen *v1, *v2, *v3, *v4, *ver; VlakRen *vlr, *vlr1, *vlr2, *vlr3; - Curve *cu= ob->data; float *data, n1[3]; int u, v, orcoret= 0; int p1, p2, p3, p4, a; @@ -2543,9 +2517,6 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar, vlr->mat= matar[ dl->col]; vlr->ec= ME_V1V2+ME_V2V3; vlr->flag= dl->rt; - if( (cu->flag & CU_NOPUNOFLIP) ) { - vlr->flag |= R_NOPUNOFLIP; - } add_v3_v3(v1->n, n1); add_v3_v3(v2->n, n1); @@ -2694,9 +2665,6 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr, vlr->mat= ma; vlr->flag= flag; - if(cu &&(cu->flag & ME_NOPUNOFLIP)) { - vlr->flag |= R_NOPUNOFLIP; - } vlr->ec= 0; /* mesh edges rendered separately */ if(len==0) obr->totvlak--; @@ -2904,9 +2872,6 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset) vlr->mat= matar[ dl->col ]; vlr->flag= 0; - if( (cu->flag & CU_NOPUNOFLIP) ) { - vlr->flag |= R_NOPUNOFLIP; - } vlr->ec= 0; } } @@ -3391,9 +3356,6 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset) vlr->mat= ma; vlr->flag= flag; - if((me->flag & ME_NOPUNOFLIP) ) { - vlr->flag |= R_NOPUNOFLIP; - } vlr->ec= 0; /* mesh edges rendered separately */ if(len==0) obr->totvlak--; @@ -5612,7 +5574,6 @@ void RE_Database_Baking(Render *re, Scene *scene, unsigned int lay, int type, Ob RE_init_threadcount(re); - re->flag |= R_GLOB_NOPUNOFLIP; re->flag |= R_BAKING; re->excludeob= actob; if(actob) diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index b4a43373ef4..724fd9a3110 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -531,10 +531,6 @@ void shade_ray(Isect *is, ShadeInput *shi, ShadeResult *shr) shade_input_set_normals(shi); - /* point normals to viewing direction */ - if(INPR(shi->facenor, shi->view) < 0.0f) - shade_input_flip_normals(shi); - shade_input_set_shade_texco(shi); if (shi->mat->material_type == MA_TYPE_VOLUME) { if(ELEM(is->mode, RE_RAY_SHADOW, RE_RAY_SHADOW_TRA)) { diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c index 2bfc8f6c1ef..ce55935d392 100644 --- a/source/blender/render/intern/source/renderdatabase.c +++ b/source/blender/render/intern/source/renderdatabase.c @@ -440,10 +440,9 @@ VlakRen *RE_vlakren_copy(ObjectRen *obr, VlakRen *vlr) return vlr1; } -int RE_vlakren_get_normal(Render *re, ObjectInstanceRen *obi, VlakRen *vlr, float *nor) +void RE_vlakren_get_normal(Render *re, ObjectInstanceRen *obi, VlakRen *vlr, float *nor) { - float v1[3], (*nmat)[3]= obi->nmat; - int flipped= 0; + float (*nmat)[3]= obi->nmat; if(obi->flag & R_TRANSFORMED) { VECCOPY(nor, vlr->n); @@ -453,29 +452,6 @@ int RE_vlakren_get_normal(Render *re, ObjectInstanceRen *obi, VlakRen *vlr, floa } else VECCOPY(nor, vlr->n); - - if((vlr->flag & R_NOPUNOFLIP)==0) { - if(re->r.mode & R_ORTHO) { - if(nor[2] > 0.0f) - flipped= 1; - } - else { - VECCOPY(v1, vlr->v1->co); - if(obi->flag & R_TRANSFORMED) - mul_m4_v3(obi->mat, v1); - if(INPR(v1, nor) < 0.0f) { - flipped= 1; - } - } - - if(flipped) { - nor[0]= -nor[0]; - nor[1]= -nor[1]; - nor[2]= -nor[2]; - } - } - - return flipped; } void RE_set_customdata_names(ObjectRen *obr, CustomData *data) diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index fc9aba20870..56ab56d0411 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -273,7 +273,8 @@ void shade_input_set_triangle_i(ShadeInput *shi, ObjectInstanceRen *obi, VlakRen shi->mode= shi->mat->mode_l; /* or-ed result for all nodes */ /* facenormal copy, can get flipped */ - shi->flippednor= RE_vlakren_get_normal(&R, obi, vlr, shi->facenor); + shi->flippednor= 0; + RE_vlakren_get_normal(&R, obi, vlr, shi->facenor); /* calculate vertexnormals */ if(vlr->flag & R_SMOOTH) { @@ -286,24 +287,6 @@ void shade_input_set_triangle_i(ShadeInput *shi, ObjectInstanceRen *obi, VlakRen mul_m3_v3(obi->nmat, shi->n2); mul_m3_v3(obi->nmat, shi->n3); } - - if(!(vlr->flag & (R_NOPUNOFLIP|R_TANGENT))) { - if(INPR(shi->facenor, shi->n1) < 0.0f) { - shi->n1[0]= -shi->n1[0]; - shi->n1[1]= -shi->n1[1]; - shi->n1[2]= -shi->n1[2]; - } - if(INPR(shi->facenor, shi->n2) < 0.0f) { - shi->n2[0]= -shi->n2[0]; - shi->n2[1]= -shi->n2[1]; - shi->n2[2]= -shi->n2[2]; - } - if(INPR(shi->facenor, shi->n3) < 0.0f) { - shi->n3[0]= -shi->n3[0]; - shi->n3[1]= -shi->n3[1]; - shi->n3[2]= -shi->n3[2]; - } - } } } @@ -826,6 +809,10 @@ void shade_input_set_normals(ShadeInput *shi) /* used in nodes */ VECCOPY(shi->vno, shi->vn); + /* flip normals to viewing direction */ + if(!(shi->vlr->flag & R_TANGENT)) + if(dot_v3v3(shi->facenor, shi->view) < 0.0f) + shade_input_flip_normals(shi); } /* use by raytrace, sss, bake to flip into the right direction */ -- cgit v1.2.3 From ae662b823552c7962e5f3dbf9dbf298b319d2d26 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 30 Jul 2010 11:55:41 +0000 Subject: bugfix [#23105] Scene strips renders out darker (no gamma corection?) --- source/blender/blenkernel/intern/sequencer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index f55cae7eaef..4f3ad50e294 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1882,8 +1882,12 @@ static ImBuf * seq_render_scene_strip_impl( IMB_saveiff(imb, "/tmp/foo.image", IB_rect | IB_metadata); IMB_freeImBuf(imb); } */ - - } else if (rres.rect32) { + + /* float buffers in the sequencer are not linear */ + ibuf->profile= IB_PROFILE_LINEAR_RGB; + IMB_convert_profile(ibuf, IB_PROFILE_SRGB); + } + else if (rres.rect32) { ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect, 0); memcpy(ibuf->rect, rres.rect32, 4*rres.rectx*rres.recty); } -- cgit v1.2.3 From 2f4a78ec21ab7e350b3a77178982dffddce8d509 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 30 Jul 2010 13:31:22 +0000 Subject: Fix #23086: crash reading 1bit tiff files. --- source/blender/imbuf/intern/tiff.c | 125 ++++++++++--------------------------- 1 file changed, 32 insertions(+), 93 deletions(-) (limited to 'source/blender') diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index 99f74fea640..6b94583f17d 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -301,17 +301,6 @@ int imb_is_a_tiff(unsigned char *mem) (memcmp(lil_endian, mem, IMB_TIFF_NCB) == 0) ); } -static void scanline_contig_8bit(unsigned char *rect, unsigned char *cbuf, int scanline_w, int spp) -{ - int i; - for (i=0; i < scanline_w; i++) { - rect[i*4 + 0] = cbuf[i*spp + 0]; - rect[i*4 + 1] = cbuf[i*spp + 1]; - rect[i*4 + 2] = cbuf[i*spp + 2]; - rect[i*4 + 3] = (spp==4)?cbuf[i*spp + 3]:255; - } -} - static void scanline_contig_16bit(float *rectf, unsigned short *sbuf, int scanline_w, int spp) { int i; @@ -334,13 +323,6 @@ static void scanline_contig_32bit(float *rectf, float *fbuf, int scanline_w, int } } -static void scanline_separate_8bit(unsigned char *rect, unsigned char *cbuf, int scanline_w, int chan) -{ - int i; - for (i=0; i < scanline_w; i++) - rect[i*4 + chan] = cbuf[i]; -} - static void scanline_separate_16bit(float *rectf, unsigned short *sbuf, int scanline_w, int chan) { int i; @@ -356,40 +338,6 @@ static void scanline_separate_32bit(float *rectf, float *fbuf, int scanline_w, i } -#if 0 -/* - * Use the libTIFF RGBAImage API to read a TIFF image. - * This function uses the "RGBA Image" support from libtiff, which enables - * it to load most commonly-encountered TIFF formats. libtiff handles format - * conversion, color depth conversion, etc. - */ -static int imb_read_tiff_pixels_rgba(ImBuf *ibuf, TIFF *image, int premul) -{ - ImBuf *tmpibuf; - int success; - - tmpibuf= IMB_allocImBuf(ibuf->x, ibuf->y, 32, IB_rect, 0); - success= TIFFReadRGBAImage(image, ibuf->x, ibuf->y, tmpibuf->rect, 0); - - if(ENDIAN_ORDER == B_ENDIAN) - IMB_convert_rgba_to_abgr(tmpibuf); - if(premul) { - IMB_premultiply_alpha(tmpibuf); - ibuf->flags |= IB_premul; - } - - /* assign rect last */ - ibuf->rect= tmpibuf->rect; - ibuf->mall |= IB_rect; - ibuf->flags |= IB_rect; - - tmpibuf->mall &= ~IB_rect; - IMB_freeImBuf(tmpibuf); - - return success; -} -#endif - /* * Use the libTIFF scanline API to read a TIFF image. * This method is most flexible and can handle multiple different bit depths @@ -398,13 +346,12 @@ static int imb_read_tiff_pixels_rgba(ImBuf *ibuf, TIFF *image, int premul) static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul) { ImBuf *tmpibuf; - int success; + int success= 0; short bitspersample, spp, config; size_t scanline; int ib_flag=0, row, chan; float *fbuf=NULL; unsigned short *sbuf=NULL; - unsigned char *cbuf=NULL; TIFFGetField(image, TIFFTAG_BITSPERSAMPLE, &bitspersample); TIFFGetField(image, TIFFTAG_SAMPLESPERPIXEL, &spp); /* number of 'channels' */ @@ -417,30 +364,28 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul) } else if (bitspersample == 16) { ib_flag = IB_rectfloat; sbuf = (unsigned short *)_TIFFmalloc(scanline); - } else if (bitspersample == 8) { + } else { ib_flag = IB_rect; - cbuf = (unsigned char *)_TIFFmalloc(scanline); } tmpibuf= IMB_allocImBuf(ibuf->x, ibuf->y, ibuf->depth, ib_flag, 0); + /* simple RGBA image */ + if (!(bitspersample == 32 || bitspersample == 16)) { + success |= TIFFReadRGBAImage(image, ibuf->x, ibuf->y, tmpibuf->rect, 0); + } /* contiguous channels: RGBRGBRGB */ - if (config == PLANARCONFIG_CONTIG) { + else if (config == PLANARCONFIG_CONTIG) { for (row = 0; row < ibuf->y; row++) { int ib_offset = ibuf->x*ibuf->y*4 - ibuf->x*4 * (row+1); if (bitspersample == 32) { - success = TIFFReadScanline(image, fbuf, row, 0); + success |= TIFFReadScanline(image, fbuf, row, 0); scanline_contig_32bit(tmpibuf->rect_float+ib_offset, fbuf, ibuf->x, spp); } else if (bitspersample == 16) { - success = TIFFReadScanline(image, sbuf, row, 0); + success |= TIFFReadScanline(image, sbuf, row, 0); scanline_contig_16bit(tmpibuf->rect_float+ib_offset, sbuf, ibuf->x, spp); - - } else if (bitspersample == 8) { - unsigned char *crect = (unsigned char*)tmpibuf->rect; - success = TIFFReadScanline(image, cbuf, row, 0); - scanline_contig_8bit(crect+ib_offset, cbuf, ibuf->x, spp); } } /* separate channels: RRRGGGBBB */ @@ -456,53 +401,47 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul) if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */ memset(fbuf, 1.0, sizeof(fbuf)); else - success = TIFFReadScanline(image, fbuf, row, chan); + success |= TIFFReadScanline(image, fbuf, row, chan); scanline_separate_32bit(tmpibuf->rect_float+ib_offset, fbuf, ibuf->x, chan); } else if (bitspersample == 16) { if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */ memset(sbuf, 65535, sizeof(sbuf)); else - success = TIFFReadScanline(image, sbuf, row, chan); + success |= TIFFReadScanline(image, sbuf, row, chan); scanline_separate_16bit(tmpibuf->rect_float+ib_offset, sbuf, ibuf->x, chan); - } else if (bitspersample == 8) { - unsigned char *crect = (unsigned char*)tmpibuf->rect; - if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */ - memset(cbuf, 255, sizeof(cbuf)); - else - success = TIFFReadScanline(image, cbuf, row, chan); - scanline_separate_8bit(crect+ib_offset, cbuf, ibuf->x, chan); } } } } - ibuf->profile = (bitspersample==32)?IB_PROFILE_LINEAR_RGB:IB_PROFILE_SRGB; - if (bitspersample == 32) _TIFFfree(fbuf); else if (bitspersample == 16) _TIFFfree(sbuf); - else if (bitspersample == 8) - _TIFFfree(cbuf); + + if(success) { + ibuf->profile = (bitspersample==32)?IB_PROFILE_LINEAR_RGB:IB_PROFILE_SRGB; + + if(ENDIAN_ORDER == B_ENDIAN) + IMB_convert_rgba_to_abgr(tmpibuf); + if(premul) { + IMB_premultiply_alpha(tmpibuf); + ibuf->flags |= IB_premul; + } - if(ENDIAN_ORDER == B_ENDIAN) - IMB_convert_rgba_to_abgr(tmpibuf); - if(premul) { - IMB_premultiply_alpha(tmpibuf); - ibuf->flags |= IB_premul; + /* assign rect last */ + if (tmpibuf->rect_float) + ibuf->rect_float= tmpibuf->rect_float; + else + ibuf->rect= tmpibuf->rect; + ibuf->mall |= ib_flag; + ibuf->flags |= ib_flag; + + tmpibuf->mall &= ~ib_flag; } - - /* assign rect last */ - if (tmpibuf->rect_float) - ibuf->rect_float= tmpibuf->rect_float; - else - ibuf->rect= tmpibuf->rect; - ibuf->mall |= ib_flag; - ibuf->flags |= ib_flag; - - tmpibuf->mall &= ~ib_flag; + IMB_freeImBuf(tmpibuf); return success; @@ -847,4 +786,4 @@ int imb_savetiff(ImBuf *ibuf, char *name, int flags) return (1); } -#endif /* WITH_TIFF */ \ No newline at end of file +#endif /* WITH_TIFF */ -- cgit v1.2.3 From 0972d05b4b065213e95e79e9ad7ac4bf63e500e3 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Fri, 30 Jul 2010 15:44:26 +0000 Subject: Logic Editor: *Removed the old header menu code, replacing with Python menus. --- source/blender/editors/space_logic/logic_header.c | 120 ---------------------- source/blender/editors/space_logic/logic_intern.h | 3 - source/blender/editors/space_logic/space_logic.c | 12 +-- 3 files changed, 1 insertion(+), 134 deletions(-) delete mode 100644 source/blender/editors/space_logic/logic_header.c (limited to 'source/blender') diff --git a/source/blender/editors/space_logic/logic_header.c b/source/blender/editors/space_logic/logic_header.c deleted file mode 100644 index 3e38eb815fb..00000000000 --- a/source/blender/editors/space_logic/logic_header.c +++ /dev/null @@ -1,120 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2009 Blender Foundation. - * All rights reserved. - * - * - * Contributor(s): Blender Foundation - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include -#include - - -#include "MEM_guardedalloc.h" - -#include "BLI_blenlib.h" - -#include "BKE_context.h" -#include "BKE_screen.h" -#include "BKE_main.h" - -#include "ED_screen.h" -#include "ED_types.h" -#include "ED_util.h" - - -#include "BIF_gl.h" -#include "BIF_glutil.h" - -#include "UI_interface.h" -#include "UI_resources.h" -#include "UI_view2d.h" - -#include "logic_intern.h" - -/* ************************ header area region *********************** */ - - -static void do_logic_buttons(bContext *C, void *arg, int event) -{ -// SpaceLogic *slogic= CTX_wm_space_logic(C); -} - -static uiBlock *logic_addmenu(bContext *C, ARegion *ar, void *arg_unused) -{ -// SpaceLogic *slogic= CTX_wm_space_logic(C); - uiBlock *block; - short yco= 0, menuwidth=120; - - block= uiBeginBlock(C, ar, "logic_addmenu", UI_EMBOSSP); -// uiBlockSetButmFunc(block, do_logic_addmenu, NULL); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); - - uiTextBoundsBlock(block, 50); - uiBlockSetDirection(block, UI_TOP); - uiEndBlock(C, block); - - return block; -} - -void logic_header_buttons(const bContext *C, ARegion *ar) -{ - ScrArea *sa= CTX_wm_area(C); -// SpaceLogic *slogic= CTX_wm_space_logic(C); - uiBlock *block; - short xco, yco= 3; - - block= uiBeginBlock(C, ar, "header logic", UI_EMBOSS); - uiBlockSetHandleFunc(block, do_logic_buttons, NULL); - - xco= ED_area_header_standardbuttons(C, block, yco); - - if((sa->flag & HEADER_NO_PULLDOWN)==0) { - int xmax; - - xmax= GetButStringLength("View"); - uiDefPulldownBut(block, logic_addmenu, NULL, - "View", xco, yco, xmax-3, 20, ""); - xco+= xmax; - - xmax= GetButStringLength("Select"); - uiDefPulldownBut(block, logic_addmenu, NULL, - "Select", xco, yco, xmax-3, 20, ""); - xco+= xmax; - - xmax= GetButStringLength("Add"); - uiDefPulldownBut(block, logic_addmenu, NULL, - "Add", xco, yco, xmax-3, 20, ""); - xco+= xmax; - } - - uiBlockSetEmboss(block, UI_EMBOSS); - - UI_view2d_totRect_set(&ar->v2d, xco+XIC+100, (int)(ar->v2d.tot.ymax-ar->v2d.tot.ymin)); - - uiEndBlock(C, block); - uiDrawBlock(C, block); -} - - diff --git a/source/blender/editors/space_logic/logic_intern.h b/source/blender/editors/space_logic/logic_intern.h index 3b2b6497cdc..0c30aa711f1 100644 --- a/source/blender/editors/space_logic/logic_intern.h +++ b/source/blender/editors/space_logic/logic_intern.h @@ -42,9 +42,6 @@ struct Scene; /* space_logic.c */ struct ARegion *logic_has_buttons_region(struct ScrArea *sa); -/* logic_header.c */ -void logic_header_buttons(const struct bContext *C, struct ARegion *ar); - /* logic_ops.c */ /* logic_buttons.c */ diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c index ed3d956ce01..3f11c3e6bae 100644 --- a/source/blender/editors/space_logic/space_logic.c +++ b/source/blender/editors/space_logic/space_logic.c @@ -296,17 +296,7 @@ static void logic_header_area_init(wmWindowManager *wm, ARegion *ar) static void logic_header_area_draw(const bContext *C, ARegion *ar) { - /* clear */ - UI_ThemeClearColor(ED_screen_area_active(C)?TH_HEADER:TH_HEADERDESEL); - glClear(GL_COLOR_BUFFER_BIT); - - /* set view2d view matrix for scrolling (without scrollers) */ - UI_view2d_view_ortho(C, &ar->v2d); - - logic_header_buttons(C, ar); - - /* restore view matrix? */ - UI_view2d_view_restore(C); + ED_region_header(C, ar); } /**************************** spacetype *****************************/ -- cgit v1.2.3 From e4a16c8010f8bdf4bed4e2661929cd0858649d25 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Fri, 30 Jul 2010 16:15:56 +0000 Subject: Properties Window: * Deleted space_buttons.py file as I doubt that these buttons will be done in python. File was not used anyway. * Deleted some ifdef checks from space_buttons.c for the py header. --- source/blender/editors/space_buttons/space_buttons.c | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index b002bec2443..a775a0b6e6a 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -191,24 +191,14 @@ void buttons_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "BUTTONS_OT_toolbox", RIGHTMOUSE, KM_PRESS, 0, 0); } -//#define PY_HEADER /* add handlers, stuff you only do once or on area/region changes */ static void buttons_header_area_init(wmWindowManager *wm, ARegion *ar) { -#ifdef PY_HEADER - ED_region_header_init(ar); -#else UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy); -#endif } static void buttons_header_area_draw(const bContext *C, ARegion *ar) { -#ifdef PY_HEADER - ED_region_header(C, ar); -#else - - /* clear */ UI_ThemeClearColor(ED_screen_area_active(C)?TH_HEADER:TH_HEADERDESEL); glClear(GL_COLOR_BUFFER_BIT); @@ -217,7 +207,6 @@ static void buttons_header_area_draw(const bContext *C, ARegion *ar) UI_view2d_view_ortho(C, &ar->v2d); buttons_header_buttons(C, ar); -#endif /* restore view matrix? */ UI_view2d_view_restore(C); -- cgit v1.2.3 From a53a928773cfe15375febacaf49832aab47d9de1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 30 Jul 2010 23:32:49 +0000 Subject: Change compositor color balance to match the sequencer exactly, for this to work linear/srgb conversions need to be done which that nice since it has to convert from/to the color spaces each time, after quite a lot of testing I think its the best way to go. The problem was that typical lift values (0.5 - 1.5, in our case ) would over saturate shadows so that even minor adjustments would give unusable results. tweaking the input lift to compensate for this helped with the shadows but would loose the color adjustments for the mid-tones. --- .../nodes/intern/CMP_nodes/CMP_colorbalance.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'source/blender') diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c index efd49172f95..843daa49a5b 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c @@ -56,13 +56,17 @@ DO_INLINE float colorbalance_cdl(float in, float offset, float power, float slop /* note: lift_lgg is just 2-lift */ DO_INLINE float colorbalance_lgg(float in, float lift_lgg, float gamma, float gain) -{ - float x= (((in - 1.0f) * lift_lgg) + 1.0f) * gain; +{ + /* 1:1 match with the sequencer with linear/srgb conversions, the conversion isnt pretty + * but best keep it this way, sice testing for durian shows a similar calculation + * without lin/srgb conversions gives bad results (over-saturated shadows) with colors + * slightly below 1.0. some correction can be done but it ends up looking bad for shadows or lighter tones - campbell */ + float x= (((linearrgb_to_srgb(in) - 1.0f) * lift_lgg) + 1.0f) * gain; /* prevent NaN */ if (x < 0.f) x = 0.f; - - return powf(x, (1.f/gamma)); + + return powf(srgb_to_linearrgb(x), gamma); } static void do_colorbalance_cdl(bNode *node, float* out, float *in) @@ -125,15 +129,8 @@ static void node_composit_exec_colorbalance(void *data, bNode *node, bNodeStack NodeColorBalance *n= (NodeColorBalance *)node->storage; int c; - copy_v3_v3(n->lift_lgg, n->lift); - for (c = 0; c < 3; c++) { - /* tweak to give more subtle results - * values above 1.0 are scaled */ - if(n->lift_lgg[c] > 1.0f) - n->lift_lgg[c] = pow(n->lift_lgg[c] - 1.0f, 2.0f) + 1.0f; - - n->lift_lgg[c] = 2.0f - n->lift_lgg[c]; + n->lift_lgg[c] = 2.0f - n->lift[c]; } } -- cgit v1.2.3 From 1280b6f9024de7c7a3d67cd2dfb80820164bc802 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 31 Jul 2010 01:06:08 +0000 Subject: - add back prefix for ID lists (LF) for linked and fake user for search fields. - remove debug print for left/right name flipping & commented test from the sequencer. --- source/blender/blenkernel/BKE_library.h | 1 + source/blender/blenkernel/intern/deform.c | 1 - source/blender/blenkernel/intern/library.c | 9 ++++++++ source/blender/blenkernel/intern/sequencer.c | 6 ------ .../blender/editors/interface/interface_layout.c | 24 ++++++++++++++-------- .../editors/interface/interface_templates.c | 5 ++++- 6 files changed, 29 insertions(+), 17 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index fcf7ae85738..debccaa02f9 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -65,6 +65,7 @@ void tag_main(struct Main *mainvar, int tag); int splitIDname(char *name, char *left, int *nr); void rename_id(struct ID *id, char *name); +void name_uiprefix_id(char *name, struct ID *id); void test_idbutton(char *name); void text_idbutton(struct ID *id, char *text); void all_local(struct Library *lib, int untagged_only); diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 5f262c526c3..ccb6ebe1f1e 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -471,7 +471,6 @@ void flip_side_name (char *name, const char *from_name, int strip_number) #undef IS_SEPARATOR sprintf (name, "%s%s%s%s", prefix, replace, suffix, number); - printf("'%s' --> '%s'\n", from_name, name); } float defvert_find_weight(const struct MDeformVert *dvert, int group_num) diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 716a0b7d41b..6852a487afa 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1394,3 +1394,12 @@ void rename_id(ID *id, char *name) new_id(lb, id, name); } + +void name_uiprefix_id(char *name, ID *id) +{ + name[0] = id->lib ? 'L':' '; + name[1] = id->flag & LIB_FAKEUSER ? 'F':' '; + name[2] = ' '; + + strcpy(name+3, id->name+2); +} diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 4f3ad50e294..df185732d22 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1876,12 +1876,6 @@ static ImBuf * seq_render_scene_strip_impl( addzbuffloatImBuf(ibuf); memcpy(ibuf->zbuf_float, rres.rectz, sizeof(float)*rres.rectx*rres.recty); } - - /* { - ImBuf *imb= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rectfloat, 0); - IMB_saveiff(imb, "/tmp/foo.image", IB_rect | IB_metadata); - IMB_freeImBuf(imb); - } */ /* float buffers in the sequencer are not linear */ ibuf->profile= IB_PROFILE_LINEAR_RGB; diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index c2bcc673c1e..b6f4dcc0356 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1111,13 +1111,19 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, char *str, ui if(itemptr.data == but->rnapoin.id.data) continue; - if(itemptr.type && RNA_struct_is_ID(itemptr.type)) - iconid= ui_id_icon_get((bContext*)C, itemptr.data, 1); - else + if(itemptr.type && RNA_struct_is_ID(itemptr.type)) { + ID *id= itemptr.data; + char name_ui[32]; + + name_uiprefix_id(name_ui, id); + name= BLI_strdup(name_ui); + iconid= ui_id_icon_get((bContext*)C, id, 1); + } + else { + name= RNA_struct_name_get_alloc(&itemptr, NULL, 0); iconid = 0; - - name= RNA_struct_name_get_alloc(&itemptr, NULL, 0); - + } + if(name) { if(BLI_strcasestr(name, str)) { cis = MEM_callocN(sizeof(CollItemSearch), "CollectionItemSearch"); @@ -1126,9 +1132,9 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, char *str, ui cis->iconid = iconid; BLI_addtail(items_list, cis); } - MEM_freeN(name); - } - + MEM_freeN(name); + } + i++; } RNA_PROP_END; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 488258d2a06..1b600a26001 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -218,9 +218,12 @@ static void id_search_cb(const bContext *C, void *arg_template, char *str, uiSea continue; if(BLI_strcasestr(id->name+2, str)) { + char name_ui[32]; + name_uiprefix_id(name_ui, id); + iconid= ui_id_icon_get((bContext*)C, id, 1); - if(!uiSearchItemAdd(items, id->name+2, id, iconid)) + if(!uiSearchItemAdd(items, name_ui, id, iconid)) break; } } -- cgit v1.2.3 From 667a2cafbe91d93f1c5d409da58cf5d83a0ab15b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 31 Jul 2010 10:03:08 +0000 Subject: recent commit to make color balance work like the sequencer, I forgot that the gamma was inverted. fixed. --- source/blender/makesdna/DNA_node_types.h | 1 + .../blender/nodes/intern/CMP_nodes/CMP_colorbalance.c | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'source/blender') diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 872d69f3148..e3ac90bf881 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -314,6 +314,7 @@ typedef struct NodeColorBalance { /* temp storage for inverted lift */ float lift_lgg[3]; + float gamma_inv[3]; } NodeColorBalance; typedef struct NodeColorspill { diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c index 843daa49a5b..43c6c6d791e 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c @@ -54,8 +54,8 @@ DO_INLINE float colorbalance_cdl(float in, float offset, float power, float slop return powf(x, 1.f/power); } -/* note: lift_lgg is just 2-lift */ -DO_INLINE float colorbalance_lgg(float in, float lift_lgg, float gamma, float gain) +/* note: lift_lgg is just 2-lift, gamma_inv is 1.0/gamma */ +DO_INLINE float colorbalance_lgg(float in, float lift_lgg, float gamma_inv, float gain) { /* 1:1 match with the sequencer with linear/srgb conversions, the conversion isnt pretty * but best keep it this way, sice testing for durian shows a similar calculation @@ -66,7 +66,7 @@ DO_INLINE float colorbalance_lgg(float in, float lift_lgg, float gamma, float ga /* prevent NaN */ if (x < 0.f) x = 0.f; - return powf(srgb_to_linearrgb(x), gamma); + return powf(srgb_to_linearrgb(x), gamma_inv); } static void do_colorbalance_cdl(bNode *node, float* out, float *in) @@ -94,9 +94,9 @@ static void do_colorbalance_lgg(bNode *node, float* out, float *in) { NodeColorBalance *n= (NodeColorBalance *)node->storage; - out[0] = colorbalance_lgg(in[0], n->lift_lgg[0], n->gamma[0], n->gain[0]); - out[1] = colorbalance_lgg(in[1], n->lift_lgg[1], n->gamma[1], n->gain[1]); - out[2] = colorbalance_lgg(in[2], n->lift_lgg[2], n->gamma[2], n->gain[2]); + out[0] = colorbalance_lgg(in[0], n->lift_lgg[0], n->gamma_inv[0], n->gain[0]); + out[1] = colorbalance_lgg(in[1], n->lift_lgg[1], n->gamma_inv[1], n->gain[1]); + out[2] = colorbalance_lgg(in[2], n->lift_lgg[2], n->gamma_inv[2], n->gain[2]); out[3] = in[3]; } @@ -105,9 +105,9 @@ static void do_colorbalance_lgg_fac(bNode *node, float* out, float *in, float *f NodeColorBalance *n= (NodeColorBalance *)node->storage; const float mfac= 1.0f - *fac; - out[0] = mfac*in[0] + *fac * colorbalance_lgg(in[0], n->lift_lgg[0], n->gamma[0], n->gain[0]); - out[1] = mfac*in[1] + *fac * colorbalance_lgg(in[1], n->lift_lgg[1], n->gamma[1], n->gain[1]); - out[2] = mfac*in[2] + *fac * colorbalance_lgg(in[2], n->lift_lgg[2], n->gamma[2], n->gain[2]); + out[0] = mfac*in[0] + *fac * colorbalance_lgg(in[0], n->lift_lgg[0], n->gamma_inv[0], n->gain[0]); + out[1] = mfac*in[1] + *fac * colorbalance_lgg(in[1], n->lift_lgg[1], n->gamma_inv[1], n->gain[1]); + out[2] = mfac*in[2] + *fac * colorbalance_lgg(in[2], n->lift_lgg[2], n->gamma_inv[2], n->gain[2]); out[3] = in[3]; } @@ -131,6 +131,7 @@ static void node_composit_exec_colorbalance(void *data, bNode *node, bNodeStack for (c = 0; c < 3; c++) { n->lift_lgg[c] = 2.0f - n->lift[c]; + n->gamma_inv[c] = (n->gamma[c] != 0.0f) ? 1.0f/n->gamma[c] : 1000000.0f; } } -- cgit v1.2.3 From cc673669c749d56f4b3078cd831c2a0dd88bf6c0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 31 Jul 2010 10:58:10 +0000 Subject: use more BLI math funcs (no functional changes) --- source/blender/blenloader/intern/readfile.c | 4 +- source/blender/editors/armature/editarmature.c | 16 +++---- source/blender/editors/object/object_transform.c | 53 +++++++-------------- source/blender/editors/space_view3d/drawobject.c | 56 ++++++++--------------- source/blender/editors/space_view3d/view3d_snap.c | 17 ++----- source/blender/editors/transform/transform.c | 12 ++--- source/blender/modifiers/intern/MOD_meshdeform.c | 4 +- 7 files changed, 56 insertions(+), 106 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index c050f25256a..943bf2c6f39 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -12406,9 +12406,7 @@ static void append_do_cursor(Scene *scene, Library *curlib, short flag) return; /* move from the center of the appended objects to cursor */ - centerloc[0]= (min[0]+max[0])/2; - centerloc[1]= (min[1]+max[1])/2; - centerloc[2]= (min[2]+max[2])/2; + mid_v3_v3v3(centerloc, min, max); curs = scene->cursor; VECSUB(centerloc,curs,centerloc); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 7db20fea6eb..989c5bdc0ba 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -428,7 +428,6 @@ void docenter_armature (Scene *scene, View3D *v3d, Object *ob, int centermode) bArmature *arm= ob->data; float cent[3] = {0.0f, 0.0f, 0.0f}; float min[3], max[3]; - float omat[3][3]; /* Put the armature into editmode */ if(ob!=obedit) @@ -437,7 +436,7 @@ void docenter_armature (Scene *scene, View3D *v3d, Object *ob, int centermode) /* Find the centerpoint */ if (centermode == 2) { float *fp= give_cursor(scene, v3d); - VECCOPY(cent, fp); + copy_v3_v3(cent, fp); invert_m4_m4(ob->imat, ob->obmat); mul_m4_v3(ob->imat, cent); } @@ -448,10 +447,8 @@ void docenter_armature (Scene *scene, View3D *v3d, Object *ob, int centermode) DO_MINMAX(ebone->head, min, max); DO_MINMAX(ebone->tail, min, max); } - - cent[0]= (min[0] + max[0]) / 2.0f; - cent[1]= (min[1] + max[1]) / 2.0f; - cent[2]= (min[2] + max[2]) / 2.0f; + + mid_v3_v3v3(cent, min, max); } /* Do the adjustments */ @@ -465,13 +462,12 @@ void docenter_armature (Scene *scene, View3D *v3d, Object *ob, int centermode) /* Adjust object location for new centerpoint */ if(centermode && obedit==NULL) { - copy_m3_m4(omat, ob->obmat); - - mul_m3_v3(omat, cent); + mul_mat3_m4_v3(ob->obmat, cent); /* ommit translation part */ add_v3_v3(ob->loc, cent); } - else + else { ED_armature_edit_free(ob); + } } /* ---------------------- */ diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index cd66b9ab2ba..bc8a2a2fc60 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -182,7 +182,7 @@ static int object_rotation_clear_exec(bContext *C, wmOperator *op) axis_angle_to_eulO( oldeul, EULER_ORDER_DEFAULT,ob->rotAxis, ob->rotAngle); } else { - VECCOPY(oldeul, ob->rot); + copy_v3_v3(oldeul, ob->rot); } eul[0]= eul[1]= eul[2]= 0.0f; @@ -706,8 +706,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); - ScrArea *sa= CTX_wm_area(C); - View3D *v3d= sa->spacedata.first; + View3D *v3d= CTX_wm_view3d(C); Object *obedit= CTX_data_edit_object(C); Object *tob; Mesh *me, *tme; @@ -716,7 +715,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) BPoint *bp; */ Nurb *nu, *nu1; EditVert *eve; - float cent[3], centn[3], min[3], max[3], omat[3][3]; + float cent[3], centn[3], min[3], max[3]; int a, total= 0; int centermode = RNA_enum_get(op->ptr, "type"); @@ -731,8 +730,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) if (obedit && centermode > 0) { BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in EditMode"); return OPERATOR_CANCELLED; - } - cent[0]= cent[1]= cent[2]= 0.0; + } + zero_v3(cent); if(obedit) { @@ -745,7 +744,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) for(eve= em->verts.first; eve; eve= eve->next) { if(v3d->around==V3D_CENTROID) { total++; - VECADD(cent, cent, eve->co); + add_v3_v3(cent, eve->co); } else { DO_MINMAX(eve->co, min, max); @@ -756,9 +755,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) mul_v3_fl(cent, 1.0f/(float)total); } else { - cent[0]= (min[0]+max[0])/2.0f; - cent[1]= (min[1]+max[1])/2.0f; - cent[2]= (min[2]+max[2])/2.0f; + mid_v3_v3v3(cent, min, max); } for(eve= em->verts.first; eve; eve= eve->next) { @@ -792,7 +789,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) tot_lib_error++; } else { if(centermode==2) { - VECCOPY(cent, give_cursor(scene, v3d)); + copy_v3_v3(cent, give_cursor(scene, v3d)); invert_m4_m4(ob->imat, ob->obmat); mul_m4_v3(ob->imat, cent); } else { @@ -801,10 +798,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) for(a=0; atotvert; a++, mvert++) { DO_MINMAX(mvert->co, min, max); } - - cent[0]= (min[0]+max[0])/2.0f; - cent[1]= (min[1]+max[1])/2.0f; - cent[2]= (min[2]+max[2])/2.0f; + + mid_v3_v3v3(cent, min, max); } mvert= me->mvert; @@ -827,13 +822,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) me->id.flag |= LIB_DOIT; if(centermode) { - copy_m3_m4(omat, ob->obmat); - copy_v3_v3(centn, cent); - mul_m3_v3(omat, centn); - ob->loc[0]+= centn[0]; - ob->loc[1]+= centn[1]; - ob->loc[2]+= centn[2]; + mul_mat3_m4_v3(ob->obmat, centn); /* ommit translation part */ + add_v3_v3(ob->loc, centn); where_is_object(scene, ob); ignore_parent_tx(bmain, scene, ob); @@ -848,12 +839,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) ob_other->flag |= OB_DONE; ob_other->recalc= OB_RECALC_OB|OB_RECALC_DATA; - copy_m3_m4(omat, ob_other->obmat); copy_v3_v3(centn, cent); - mul_m3_v3(omat, centn); - ob_other->loc[0]+= centn[0]; - ob_other->loc[1]+= centn[1]; - ob_other->loc[2]+= centn[2]; + mul_mat3_m4_v3(ob_other->obmat, centn); /* ommit translation part */ + add_v3_v3(ob_other->loc, centn); where_is_object(scene, ob_other); ignore_parent_tx(bmain, scene, ob_other); @@ -920,9 +908,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) nu= nu->next; } - cent[0]= (min[0]+max[0])/2.0f; - cent[1]= (min[1]+max[1])/2.0f; - cent[2]= (min[2]+max[2])/2.0f; + mid_v3_v3v3(cent, min, max); } nu= nu1; @@ -944,13 +930,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) } if(centermode && obedit==NULL) { - copy_m3_m4(omat, ob->obmat); - - mul_m3_v3(omat, cent); - ob->loc[0]+= cent[0]; - ob->loc[1]+= cent[1]; - ob->loc[2]+= cent[2]; - + mul_mat3_m4_v3(ob->obmat, cent); /* ommit translation part */ + add_v3_v3(ob->loc, cent); where_is_object(scene, ob); ignore_parent_tx(bmain, scene, ob); } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 5bb1ea2cc9f..02a8709a1ac 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -446,11 +446,11 @@ void drawaxes(float size, int flag, char drawtype) for (axis=0; axis<4; axis++) { if (axis % 2 == 1) { - v2[0] *= -1; - v3[1] *= -1; + v2[0] = -v2[0]; + v3[1] = -v3[1]; } else { - v2[1] *= -1; - v3[0] *= -1; + v2[1] = -v2[1]; + v3[0] = -v3[0]; } glVertex3fv(v1); @@ -513,12 +513,10 @@ void drawcircball(int mode, float *cent, float rad, float tmat[][4]) { float vec[3], vx[3], vy[3]; int a, tot=32; - - VECCOPY(vx, tmat[0]); - VECCOPY(vy, tmat[1]); - mul_v3_fl(vx, rad); - mul_v3_fl(vy, rad); - + + mul_v3_v3fl(vx, tmat[0], rad); + mul_v3_v3fl(vy, tmat[1], rad); + glBegin(mode); for(a=0; aclipsta*lavec[0]; - sta[1]= mat[3][1]+ la->clipsta*lavec[1]; - sta[2]= mat[3][2]+ la->clipsta*lavec[2]; - - end[0]= mat[3][0]+ la->clipend*lavec[0]; - end[1]= mat[3][1]+ la->clipend*lavec[1]; - end[2]= mat[3][2]+ la->clipend*lavec[2]; - + madd_v3_v3v3fl(sta, mat[3], lavec, la->clipsta); + madd_v3_v3v3fl(end, mat[3], lavec, la->clipend); glBegin(GL_LINE_STRIP); glVertex3fv(sta); @@ -820,10 +812,7 @@ static void spotvolume(float *lvec, float *vvec, float inp) quat_to_mat3(mat1,q); /* rotate lamp vector now over acos(inp) degrees */ - - vvec[0] = lvec[0] ; - vvec[1] = lvec[1] ; - vvec[2] = lvec[2] ; + copy_v3_v3(vvec, lvec); unit_m3(mat2); co = inp; @@ -948,7 +937,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, } /* Inner Circle */ - VECCOPY(vec, ob->obmat[3]); + copy_v3_v3(vec, ob->obmat[3]); glEnable(GL_BLEND); drawcircball(GL_LINE_LOOP, vec, lampsize, imat); glDisable(GL_BLEND); @@ -987,10 +976,8 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, vec_rot_to_mat3( mat,imat[2], M_PI/4.0f); /* vectors */ - VECCOPY(v1, imat[0]); - mul_v3_fl(v1, circrad*1.2f); - VECCOPY(v2, imat[0]); - mul_v3_fl(v2, circrad*2.5f); + mul_v3_v3fl(v1, imat[0], circrad * 1.2f); + mul_v3_v3fl(v2, imat[0], circrad * 2.5f); /* center */ glTranslatef(vec[0], vec[1], vec[2]); @@ -1018,7 +1005,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, } glPopMatrix(); /* back in object space */ - vec[0]= vec[1]= vec[2]= 0.0f; + zero_v3(vec); if ((la->type==LA_SPOT) || (la->type==LA_YF_PHOTON)) { lvec[0]=lvec[1]= 0.0; @@ -1110,7 +1097,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, /* draw the hemisphere curves */ short axis, steps, dir; float outdist, zdist, mul; - vec[0]=vec[1]=vec[2]= 0.0; + zero_v3(vec); outdist = 0.14; mul = 1.4; dir = 1; setlinestyle(4); @@ -5246,8 +5233,8 @@ void get_local_bounds(Object *ob, float *center, float *size) BoundBox *bb= object_get_boundbox(ob); if(bb==NULL) { - center[0]= center[1]= center[2]= 0.0; - VECCOPY(size, ob->size); + zero_v3(center); + copy_v3_v3(size, ob->size); } else { size[0]= 0.5*fabs(bb->vec[0][0] - bb->vec[4][0]); @@ -5506,9 +5493,7 @@ void drawRBpivot(bRigidBodyJointConstraint *data) dir[axis] = 1.f; glBegin(GL_LINES); mul_m4_v3(mat,dir); - v[0] += dir[0]; - v[1] += dir[1]; - v[2] += dir[2]; + add_v3_v3(v, dir); glVertex3fv(v1); glVertex3fv(v); glEnd(); @@ -6154,9 +6139,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(dtflag2 & V3D_RENDER_OVERRIDE)==0) { if((ob->gameflag & OB_DYNAMIC) || ((ob->gameflag & OB_BOUNDS) && (ob->boundtype == OB_BOUND_SPHERE))) { - float imat[4][4], vec[3]; + float imat[4][4], vec[3]= {0.0f, 0.0f, 0.0f}; - vec[0]= vec[1]= vec[2]= 0.0; invert_m4_m4(imat, rv3d->viewmatob); setlinestyle(2); diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 160306ef300..9928ba1983e 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -365,7 +365,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode) while(ml) { if(ml->flag & SELECT) { tv->loc= &ml->x; - VECCOPY(tv->oldloc, tv->loc); + copy_v3_v3(tv->oldloc, tv->loc); tv->val= &(ml->rad); tv->oldval= ml->rad; tv->flag= 1; @@ -387,7 +387,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode) while(a--) { if((mode & 1) || (bp->f1 & SELECT)) { if(bp->hide==0) { - VECCOPY(tv->oldloc, bp->vec); + copy_v3_v3(tv->oldloc, bp->vec); tv->loc= bp->vec; tv->flag= bp->f1 & SELECT; tv++; @@ -403,23 +403,16 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode) total= 0.0; for(a=0; aflag & SELECT) { - centroid[0]+= tv->oldloc[0]; - centroid[1]+= tv->oldloc[1]; - centroid[2]+= tv->oldloc[2]; + add_v3_v3(centroid, tv->oldloc); total+= 1.0; DO_MINMAX(tv->oldloc, min, max); } } if(total!=0.0) { - centroid[0]/= total; - centroid[1]/= total; - centroid[2]/= total; + mul_v3_fl(centroid, 1.0f/total); } - center[0]= (min[0]+max[0])/2.0; - center[1]= (min[1]+max[1])/2.0; - center[2]= (min[2]+max[2])/2.0; - + mid_v3_v3v3(center, min, max); } /* *********************** operators ******************** */ diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 86fdb81e0d9..9743a4ef0f5 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -2171,21 +2171,19 @@ void initWarp(TransInfo *t) /* we need min/max in view space */ for(i = 0; i < t->total; i++) { float center[3]; - VECCOPY(center, t->data[i].center); + copy_v3_v3(center, t->data[i].center); mul_m3_v3(t->data[i].mtx, center); mul_m4_v3(t->viewmat, center); sub_v3_v3(center, t->viewmat[3]); if (i) minmax_v3_v3v3(min, max, center); else { - VECCOPY(max, center); - VECCOPY(min, center); + copy_v3_v3(max, center); + copy_v3_v3(min, center); } } - - t->center[0]= (min[0]+max[0])/2.0f; - t->center[1]= (min[1]+max[1])/2.0f; - t->center[2]= (min[2]+max[2])/2.0f; + + mid_v3_v3v3(t->center, min, max); if (max[0] == min[0]) max[0] += 0.1; /* not optimal, but flipping is better than invalid garbage (i.e. division by zero!) */ t->val= (max[0]-min[0])/2.0f; /* t->val is X dimension projected boundbox */ diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index 9ae86ac4ec0..9f102fe6c21 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -126,7 +126,7 @@ static float meshdeform_dynamic_bind(MeshDeformModifierData *mmd, float (*dco)[3 float weight, cageweight, totweight, *cageco; int i, j, a, x, y, z, size; - co[0]= co[1]= co[2]= 0.0f; + zero_v3(co); totweight= 0.0f; size= mmd->dyngridsize; @@ -312,7 +312,7 @@ static void meshdeformModifier_do( } else { totweight= 0.0f; - co[0]= co[1]= co[2]= 0.0f; + zero_v3(co); for(a=offsets[b]; a Date: Sat, 31 Jul 2010 19:26:21 +0000 Subject: Separate proportional edit setting between edit and object mode. They are now used and toggled independently. --- source/blender/editors/curve/curve_ops.c | 2 +- source/blender/editors/include/ED_object.h | 8 ++++- source/blender/editors/mesh/mesh_ops.c | 2 +- source/blender/editors/object/object_ops.c | 34 +++++++++++++++------- source/blender/editors/physics/physics_ops.c | 2 +- source/blender/editors/transform/transform.c | 13 +++++---- .../blender/editors/transform/transform_generics.c | 21 +++++++++---- source/blender/editors/uvedit/uvedit_ops.c | 2 +- source/blender/makesdna/DNA_scene_types.h | 6 ++-- source/blender/makesrna/intern/rna_scene.c | 6 ++++ 10 files changed, 67 insertions(+), 29 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index d650cecdc3e..47b1fee3cf6 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -233,6 +233,6 @@ void ED_keymap_curve(wmKeyConfig *keyconf) /* menus */ WM_keymap_add_menu(keymap, "VIEW3D_MT_hook", HKEY, KM_PRESS, KM_CTRL, 0); - ED_object_generic_keymap(keyconf, keymap, 2); + ED_object_generic_keymap(keyconf, keymap, 3); } diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index a03cd135f1c..efa5d6c5dad 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -55,7 +55,13 @@ void ED_operatortypes_object(void); void ED_operatormacros_object(void); void ED_keymap_object(struct wmKeyConfig *keyconf); -/* generic editmode keys like pet */ +/* generic editmode keys like pet + * do_pet + * 0: No + * 1: Object + * 2: Edit + * 3: Edit with connected + * */ void ED_object_generic_keymap(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap, int do_pet); /* send your own notifier for select! */ diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index e143e4859f5..9eac347c893 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -314,6 +314,6 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) WM_keymap_add_menu(keymap, "VIEW3D_MT_uv_map", UKEY, KM_PRESS, 0, 0); WM_keymap_add_menu(keymap, "VIEW3D_MT_vertex_group", GKEY, KM_PRESS, KM_CTRL, 0); - ED_object_generic_keymap(keyconf, keymap, 2); + ED_object_generic_keymap(keyconf, keymap, 3); } diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index e1ea7924916..610a82d964c 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -364,7 +364,10 @@ void ED_keymap_object(wmKeyConfig *keyconf) RNA_int_set(kmi->ptr, "level", i); } - /* Lattice -------------------------------------------------------------------- */ + /* ############################################################################ */ + /* ################################ LATTICE ################################### */ + /* ############################################################################ */ + keymap= WM_keymap_find(keyconf, "Lattice", 0, 0); keymap->poll= ED_operator_editlattice; @@ -375,7 +378,7 @@ void ED_keymap_object(wmKeyConfig *keyconf) /* menus */ WM_keymap_add_menu(keymap, "VIEW3D_MT_hook", HKEY, KM_PRESS, KM_CTRL, 0); - ED_object_generic_keymap(keyconf, keymap, 1); + ED_object_generic_keymap(keyconf, keymap, 2); } void ED_object_generic_keymap(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap, int do_pet) @@ -383,22 +386,31 @@ void ED_object_generic_keymap(struct wmKeyConfig *keyconf, struct wmKeyMap *keym wmKeyMapItem *kmi; /* used by mesh, curve & lattice only */ - if(do_pet > 0) { + if(do_pet) { /* context ops */ kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_enum", OKEY, KM_PRESS, KM_SHIFT, 0); RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_editing_falloff"); - kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", OKEY, KM_PRESS, 0, 0); - RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_editing"); - RNA_string_set(kmi->ptr, "value_1", "DISABLED"); - RNA_string_set(kmi->ptr, "value_2", "ENABLED"); + // Object mode + if (do_pet == 1) { + + kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", OKEY, KM_PRESS, 0, 0); + RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_editing_objects"); + + } else { // Edit mode - /* for modes/object types that allow 'conencted' mode, add the Alt O key */ - if (do_pet > 1) { - kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", OKEY, KM_PRESS, KM_ALT, 0); + kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", OKEY, KM_PRESS, 0, 0); RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_editing"); RNA_string_set(kmi->ptr, "value_1", "DISABLED"); - RNA_string_set(kmi->ptr, "value_2", "CONNECTED"); + RNA_string_set(kmi->ptr, "value_2", "ENABLED"); + + /* for modes/object types that allow 'connected' mode, add the Alt O key */ + if (do_pet == 3) { + kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", OKEY, KM_PRESS, KM_ALT, 0); + RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_editing"); + RNA_string_set(kmi->ptr, "value_1", "DISABLED"); + RNA_string_set(kmi->ptr, "value_2", "CONNECTED"); + } } } } diff --git a/source/blender/editors/physics/physics_ops.c b/source/blender/editors/physics/physics_ops.c index 5a51c36cd09..2b7f8e9d5a2 100644 --- a/source/blender/editors/physics/physics_ops.c +++ b/source/blender/editors/physics/physics_ops.c @@ -114,7 +114,7 @@ static void keymap_particle(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "PARTICLE_OT_weight_set", KKEY, KM_PRESS, KM_SHIFT, 0); - ED_object_generic_keymap(keyconf, keymap, 1); + ED_object_generic_keymap(keyconf, keymap, 2); } /******************************* boids *************************************/ diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 9743a4ef0f5..926d8ffd007 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1367,17 +1367,17 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) } } - /* XXX convert stupid flag to enum */ + /* convert flag to enum */ switch(t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) { case (T_PROP_EDIT|T_PROP_CONNECTED): - proportional = 2; + proportional = PROP_EDIT_CONNECTED; break; case T_PROP_EDIT: - proportional = 1; + proportional = PROP_EDIT_ON; break; default: - proportional = 0; + proportional = PROP_EDIT_OFF; } // If modal, save settings back in scene if not set as operator argument @@ -1385,7 +1385,10 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) /* save settings if not set in operator */ if (RNA_struct_find_property(op->ptr, "proportional") && !RNA_property_is_set(op->ptr, "proportional")) { - ts->proportional = proportional; + if (t->obedit) + ts->proportional = proportional; + else + ts->proportional_objects = (proportional != PROP_EDIT_OFF); } if (RNA_struct_find_property(op->ptr, "proportional_size") && !RNA_property_is_set(op->ptr, "proportional_size")) { diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 8d98255d3d9..920c5c12ea1 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -38,6 +38,7 @@ #include "DNA_armature_types.h" #include "DNA_lattice_types.h" #include "DNA_screen_types.h" +#include "DNA_scene_types.h" #include "DNA_space_types.h" #include "DNA_view3d_types.h" @@ -1033,9 +1034,9 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) { switch(RNA_enum_get(op->ptr, "proportional")) { - case 2: /* XXX connected constant */ + case PROP_EDIT_CONNECTED: t->flag |= T_PROP_CONNECTED; - case 1: /* XXX prop on constant */ + case PROP_EDIT_ON: t->flag |= T_PROP_EDIT; break; } @@ -1045,11 +1046,19 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) /* use settings from scene only if modal */ if (t->flag & T_MODAL) { - if ((t->options & CTX_NO_PET) == 0 && (ts->proportional != PROP_EDIT_OFF)) { - t->flag |= T_PROP_EDIT; + if ((t->options & CTX_NO_PET) == 0) + { + if (t->obedit && ts->proportional != PROP_EDIT_OFF) + { + t->flag |= T_PROP_EDIT; - if(ts->proportional == PROP_EDIT_CONNECTED) - t->flag |= T_PROP_CONNECTED; + if(ts->proportional == PROP_EDIT_CONNECTED) + t->flag |= T_PROP_CONNECTED; + } + else if (t->obedit == NULL && ts->proportional_objects) + { + t->flag |= T_PROP_EDIT; + } } } } diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index bae8d4b7fcf..cbc0eb41f84 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -3241,7 +3241,7 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf) /* menus */ WM_keymap_add_menu(keymap, "IMAGE_MT_uvs_snap", SKEY, KM_PRESS, KM_SHIFT, 0); - ED_object_generic_keymap(keyconf, keymap, 1); + ED_object_generic_keymap(keyconf, keymap, 2); transform_keymap_for_space(keyconf, keymap, SPACE_IMAGE); } diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index f4b022bd56b..984aa5a6705 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -724,11 +724,13 @@ typedef struct ToolSettings { /* Transform */ short snap_mode, snap_flag, snap_target; short proportional, prop_mode; + char proportional_objects; /* proportional edit, object mode */ + char pad[3]; - int auto_normalize, intpad; /*auto normalizing mode in wpaint*/ + int auto_normalize; /*auto normalizing mode in wpaint*/ short sculpt_paint_settings; /* user preferences for sculpt and paint */ - short pad; + short pad1; int sculpt_paint_unified_size; /* unified radius of brush in pixels */ float sculpt_paint_unified_unprojected_radius;/* unified radius of brush in Blender units */ float sculpt_paint_unified_alpha; /* unified strength of brush */ diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index a08e9e4252f..966e7696ede 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1009,6 +1009,12 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Proportional Editing", "Proportional editing mode"); RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */ + prop= RNA_def_property(srna, "proportional_editing_objects", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "proportional_objects", 0); + RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing object mode"); + RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1); + RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */ + prop= RNA_def_property(srna, "proportional_editing_falloff", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "prop_mode"); RNA_def_property_enum_items(prop, proportional_falloff_items); -- cgit v1.2.3 From ea6730cdd1f3ad77d6cd9ba511b1c632ef225542 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 1 Aug 2010 09:56:00 +0000 Subject: - font object x/yoffset was making text box's wrap text incorrectly. - draw text boxes with the offset applied. (abologies for making font.c even more confusing) --- source/blender/blenkernel/intern/font.c | 4 ++-- source/blender/editors/space_view3d/drawobject.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 7ebd0c3f457..46f67adeb4b 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -814,7 +814,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) twidth = char_width(cu, che, info); // Calculate positions - if((tb->w != 0.0) && (ct->dobreak==0) && ((xof-(tb->x/cu->fsize)+twidth)*cu->fsize) > tb->w) { + if((tb->w != 0.0) && (ct->dobreak==0) && ((xof-(tb->x/cu->fsize)+twidth)*cu->fsize) > tb->w + cu->xof*cu->fsize) { // fprintf(stderr, "linewidth exceeded: %c%c%c...\n", mem[i], mem[i+1], mem[i+2]); for (j=i; j && (mem[j] != '\n') && (mem[j] != '\r') && (chartransdata[j].dobreak==0); j--) { if (mem[j]==' ' || mem[j]=='-') { @@ -855,7 +855,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) linedata4[lnr]= wsnr; if ( (tb->h != 0.0) && - ((-(yof-(tb->y/cu->fsize))) > ((tb->h/cu->fsize)-(linedist*cu->fsize))) && + ((-(yof-(tb->y/cu->fsize))) > ((tb->h/cu->fsize)-(linedist*cu->fsize)) - cu->yof) && (cu->totbox > (curbox+1)) ) { maxlen= 0; tb++; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 02a8709a1ac..9d0c5bcd898 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -5802,8 +5802,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) UI_ThemeColor(TH_ACTIVE); else UI_ThemeColor(TH_WIRE); - vec1[0] = cu->tb[i].x; - vec1[1] = cu->tb[i].y + cu->fsize; + vec1[0] = (cu->xof * cu->fsize) + cu->tb[i].x; + vec1[1] = (cu->yof * cu->fsize) + cu->tb[i].y + cu->fsize; vec1[2] = 0.001; glBegin(GL_LINE_STRIP); glVertex3fv(vec1); -- cgit v1.2.3 From e56913fe3961e9ab34b15e5317d83e9110e20857 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 1 Aug 2010 10:36:02 +0000 Subject: fix for un-initialized layer (only bits between 1 and 20 were initialized) --- source/blender/editors/object/object_add.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender') diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index e08661b1795..50851b57a65 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -241,7 +241,7 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, floa if(RNA_property_is_set(op->ptr, "layer")) { RNA_boolean_get_array(op->ptr, "layer", layer_values); - + *layer= 0; for(a=0; a<20; a++) { if(layer_values[a]) *layer |= (1 << a); -- cgit v1.2.3 From d25747ee751096de2e417a7da1316bf5bf81c25a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 1 Aug 2010 11:00:36 +0000 Subject: bugfix's [#23108] bpy.ops.object.origin_set(type='GEOMETRY_ORIGIN') dosen't work in console [#23115] Crash when moving armature origin - setting the armature in editmode would leave editdata in some cases. - transforming selected linked objects to account for the movement of the obdata was only done for meshes, now do for curves and text3d. - added utility functions for getting curve & mesh bounds. - text3d moving center wasn't working at all. - changed drawobject.c to use BLI_math funcs in more places. - remove some unused code from operator object.origin_set. --- source/blender/blenkernel/BKE_curve.h | 4 + source/blender/blenkernel/BKE_mesh.h | 5 + source/blender/blenkernel/intern/curve.c | 117 ++++++- source/blender/blenkernel/intern/mesh.c | 86 ++++-- source/blender/editors/armature/editarmature.c | 48 +-- source/blender/editors/include/ED_armature.h | 2 +- source/blender/editors/object/object_transform.c | 373 ++++++++++------------- source/blender/editors/space_view3d/drawobject.c | 149 +++++---- 8 files changed, 437 insertions(+), 347 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index e83ea4b809c..bcc92b477a7 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -107,5 +107,9 @@ int clamp_nurb_order_v( struct Nurb *nu); ListBase *BKE_curve_nurbs(struct Curve *cu); +int curve_bounds(struct Curve *cu, float min[3], float max[3]); +int curve_center_median(struct Curve *cu, float cent[3]); +int curve_center_bounds(struct Curve *cu, float cent[3]); +void curve_translate(struct Curve *cu, float offset[3], int do_keys); #endif diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 3b6cf8803d8..8c5979222f0 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -140,7 +140,12 @@ int mesh_layers_menu_charlen(struct CustomData *data, int type); /* use this to void mesh_layers_menu_concat(struct CustomData *data, int type, char *str); int mesh_layers_menu(struct CustomData *data, int type); +/* vertex level transformations & checks (no derived mesh) */ +int mesh_bounds(struct Mesh *me, float min[3], float max[3]); +int mesh_center_median(struct Mesh *me, float cent[3]); +int mesh_center_bounds(struct Mesh *me, float cent[3]); +void mesh_translate(struct Mesh *me, float offset[3], int do_keys); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 4142ad7128f..1a30e85c5c4 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -276,7 +276,7 @@ void tex_space_curve(Curve *cu) { DispList *dl; BoundBox *bb; - float *fp, min[3], max[3], loc[3], size[3]; + float *fp, min[3], max[3]; int tot, doit= 0; if(cu->bb==NULL) cu->bb= MEM_callocN(sizeof(BoundBox), "boundbox"); @@ -303,20 +303,15 @@ void tex_space_curve(Curve *cu) min[0] = min[1] = min[2] = -1.0f; max[0] = max[1] = max[2] = 1.0f; } - - loc[0]= (min[0]+max[0])/2.0f; - loc[1]= (min[1]+max[1])/2.0f; - loc[2]= (min[2]+max[2])/2.0f; - - size[0]= (max[0]-min[0])/2.0f; - size[1]= (max[1]-min[1])/2.0f; - size[2]= (max[2]-min[2])/2.0f; boundbox_set_from_min_max(bb, min, max); if(cu->texflag & CU_AUTOSPACE) { - VECCOPY(cu->loc, loc); - VECCOPY(cu->size, size); + mid_v3_v3v3(cu->loc, min, max); + cu->size[0]= (max[0]-min[0])/2.0f; + cu->size[1]= (max[1]-min[1])/2.0f; + cu->size[2]= (max[2]-min[2])/2.0f; + cu->rot[0]= cu->rot[1]= cu->rot[2]= 0.0; if(cu->size[0]==0.0) cu->size[0]= 1.0; @@ -3107,3 +3102,103 @@ ListBase *BKE_curve_nurbs(Curve *cu) return &cu->nurb; } + + +/* basic vertex data functions */ +int curve_bounds(Curve *cu, float min[3], float max[3]) +{ + ListBase *nurb_lb= BKE_curve_nurbs(cu); + Nurb *nu; + + INIT_MINMAX(min, max); + + for(nu= nurb_lb->first; nu; nu= nu->next) + minmaxNurb(nu, min, max); + + return (nurb_lb->first != NULL); +} + +int curve_center_median(Curve *cu, float cent[3]) +{ + ListBase *nurb_lb= BKE_curve_nurbs(cu); + Nurb *nu; + int total= 0; + + zero_v3(cent); + + for(nu= nurb_lb->first; nu; nu= nu->next) { + int i; + + if(nu->type == CU_BEZIER) { + BezTriple *bezt; + i= nu->pntsu; + total += i * 3; + for(bezt= nu->bezt; i--; bezt++) { + add_v3_v3(cent, bezt->vec[0]); + add_v3_v3(cent, bezt->vec[1]); + add_v3_v3(cent, bezt->vec[2]); + } + } + else { + BPoint *bp; + i= nu->pntsu*nu->pntsv; + total += i; + for(bp= nu->bp; i--; bp++) { + add_v3_v3(cent, bp->vec); + } + } + } + + mul_v3_fl(cent, 1.0f/(float)total); + + return (total != 0); +} + +int curve_center_bounds(Curve *cu, float cent[3]) +{ + float min[3], max[3]; + + if(curve_bounds(cu, min, max)) { + mid_v3_v3v3(cent, min, max); + return 1; + } + + return 0; +} + +void curve_translate(Curve *cu, float offset[3], int do_keys) +{ + ListBase *nurb_lb= BKE_curve_nurbs(cu); + Nurb *nu; + int i; + + for(nu= nurb_lb->first; nu; nu= nu->next) { + BezTriple *bezt; + BPoint *bp; + + if(nu->type == CU_BEZIER) { + i= nu->pntsu; + for(bezt= nu->bezt; i--; bezt++) { + add_v3_v3(bezt->vec[0], offset); + add_v3_v3(bezt->vec[1], offset); + add_v3_v3(bezt->vec[2], offset); + } + } + else { + i= nu->pntsu*nu->pntsv; + for(bp= nu->bp; i--; bp++) { + add_v3_v3(bp->vec, offset); + } + } + } + + if (do_keys && cu->key) { + KeyBlock *kb; + for (kb=cu->key->block.first; kb; kb=kb->next) { + float *fp= kb->data; + for (i= kb->totelem; i--; fp+=3) { + add_v3_v3(fp, offset); + } + } + } +} diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 66e8c10206c..ab7b0694836 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -320,33 +320,22 @@ void make_local_mesh(Mesh *me) void boundbox_mesh(Mesh *me, float *loc, float *size) { - MVert *mvert; BoundBox *bb; float min[3], max[3]; float mloc[3], msize[3]; - int a; if(me->bb==0) me->bb= MEM_callocN(sizeof(BoundBox), "boundbox"); bb= me->bb; - - INIT_MINMAX(min, max); if (!loc) loc= mloc; if (!size) size= msize; - mvert= me->mvert; - for(a=0; atotvert; a++, mvert++) { - DO_MINMAX(mvert->co, min, max); - } - - if(!me->totvert) { + if(!mesh_bounds(me, min, max)) { min[0] = min[1] = min[2] = -1.0f; max[0] = max[1] = max[2] = 1.0f; } - loc[0]= (min[0]+max[0])/2.0f; - loc[1]= (min[1]+max[1])/2.0f; - loc[2]= (min[2]+max[2])/2.0f; + mid_v3_v3v3(loc, min, max); size[0]= (max[0]-min[0])/2.0f; size[1]= (max[1]-min[1])/2.0f; @@ -369,9 +358,9 @@ void tex_space_mesh(Mesh *me) else if(size[a]<0.0 && size[a]> -0.00001) size[a]= -0.00001; } - VECCOPY(me->loc, loc); - VECCOPY(me->size, size); - me->rot[0]= me->rot[1]= me->rot[2]= 0.0; + copy_v3_v3(me->loc, loc); + copy_v3_v3(me->size, size); + zero_v3(me->rot); } } @@ -413,9 +402,7 @@ float *get_mesh_orco_verts(Object *ob) totvert = MIN2(tme->totvert, me->totvert); for(a=0; aco[0]; - vcos[a][1]= mvert->co[1]; - vcos[a][2]= mvert->co[2]; + copy_v3_v3(vcos[a], mvert->co); } return (float*)vcos; @@ -431,9 +418,7 @@ void transform_mesh_orco_verts(Mesh *me, float (*orco)[3], int totvert, int inve if(invert) { for(a=0; apv= NULL; } } + +/* basic vertex data functions */ +int mesh_bounds(Mesh *me, float min[3], float max[3]) +{ + int i= me->totvert; + MVert *mvert; + INIT_MINMAX(min, max); + for(mvert= me->mvert; i--; mvert++) { + DO_MINMAX(mvert->co, min, max); + } + + return (me->totvert != 0); +} + +int mesh_center_median(Mesh *me, float cent[3]) +{ + int i= me->totvert; + MVert *mvert; + zero_v3(cent); + for(mvert= me->mvert; i--; mvert++) { + add_v3_v3(cent, mvert->co); + } + mul_v3_fl(cent, 1.0f/(float)me->totvert); + + return (me->totvert != 0); +} + +int mesh_center_bounds(Mesh *me, float cent[3]) +{ + float min[3], max[3]; + + if(mesh_bounds(me, min, max)) { + mid_v3_v3v3(cent, min, max); + return 1; + } + + return 0; +} + +void mesh_translate(Mesh *me, float offset[3], int do_keys) +{ + int i= me->totvert; + MVert *mvert; + for(mvert= me->mvert; i--; mvert++) { + add_v3_v3(mvert->co, offset); + } + + if (do_keys && me->key) { + KeyBlock *kb; + for (kb=me->key->block.first; kb; kb=kb->next) { + float *fp= kb->data; + for (i= kb->totelem; i--; fp+=3) { + add_v3_v3(fp, offset); + } + } + } +} diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 989c5bdc0ba..480bade1dc3 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -421,34 +421,45 @@ void ED_armature_apply_transform(Object *ob, float mat[4][4]) /* exported for use in editors/object/ */ /* 0 == do center, 1 == center new, 2 == center cursor */ -void docenter_armature (Scene *scene, View3D *v3d, Object *ob, int centermode) +void docenter_armature (Scene *scene, Object *ob, float cursor[3], int centermode, int around) { Object *obedit= scene->obedit; // XXX get from context EditBone *ebone; bArmature *arm= ob->data; - float cent[3] = {0.0f, 0.0f, 0.0f}; - float min[3], max[3]; + float cent[3]; /* Put the armature into editmode */ - if(ob!=obedit) + if(ob != obedit) { ED_armature_to_edit(ob); + obedit= NULL; /* we cant use this so behave as if there is no obedit */ + } /* Find the centerpoint */ if (centermode == 2) { - float *fp= give_cursor(scene, v3d); - copy_v3_v3(cent, fp); + copy_v3_v3(cent, cursor); invert_m4_m4(ob->imat, ob->obmat); mul_m4_v3(ob->imat, cent); } else { - INIT_MINMAX(min, max); - - for (ebone= arm->edbo->first; ebone; ebone=ebone->next) { - DO_MINMAX(ebone->head, min, max); - DO_MINMAX(ebone->tail, min, max); + if(around==V3D_CENTROID) { + int total= 0; + zero_v3(cent); + for (ebone= arm->edbo->first; ebone; ebone=ebone->next) { + total+=2; + add_v3_v3(cent, ebone->head); + add_v3_v3(cent, ebone->tail); + } + mul_v3_fl(cent, 1.0f/(float)total); + } + else { + float min[3], max[3]; + INIT_MINMAX(min, max); + for (ebone= arm->edbo->first; ebone; ebone=ebone->next) { + DO_MINMAX(ebone->head, min, max); + DO_MINMAX(ebone->tail, min, max); + } + mid_v3_v3v3(cent, min, max); } - - mid_v3_v3v3(cent, min, max); } /* Do the adjustments */ @@ -458,16 +469,16 @@ void docenter_armature (Scene *scene, View3D *v3d, Object *ob, int centermode) } /* Turn the list into an armature */ - ED_armature_from_edit(ob); - + if(obedit==NULL) { + ED_armature_from_edit(ob); + ED_armature_edit_free(ob); + } + /* Adjust object location for new centerpoint */ if(centermode && obedit==NULL) { mul_mat3_m4_v3(ob->obmat, cent); /* ommit translation part */ add_v3_v3(ob->loc, cent); } - else { - ED_armature_edit_free(ob); - } } /* ---------------------- */ @@ -2018,7 +2029,6 @@ void ED_armature_edit_free(struct Object *ob) BLI_freelistN(arm->edbo); } - MEM_freeN(arm->edbo); arm->edbo= NULL; } diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index d2d1e2a1d69..52db36e188d 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -120,7 +120,7 @@ void ED_armature_edit_bone_remove(struct bArmature *arm, EditBone *exBone); void transform_armature_mirror_update(struct Object *obedit); void clear_armature(struct Scene *scene, struct Object *ob, char mode); -void docenter_armature (struct Scene *scene, struct View3D *v3d, struct Object *ob, int centermode); +void docenter_armature (struct Scene *scene, struct Object *ob, float cursor[3], int centermode, int around); void ED_armature_apply_transform(struct Object *ob, float mat[4][4]); diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index bc8a2a2fc60..bd23d3a4b67 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -694,81 +694,73 @@ void texspace_edit(Scene *scene, View3D *v3d) /********************* Set Object Center ************************/ -static EnumPropertyItem prop_set_center_types[] = { - {0, "GEOMETRY_ORIGIN", 0, "Geometry to Origin", "Move object geometry to object origin"}, - {1, "ORIGIN_GEOMETRY", 0, "Origin to Geometry", "Move object origin to center of object geometry"}, - {2, "ORIGIN_CURSOR", 0, "Origin to 3D Cursor", "Move object origin to position of the 3d cursor"}, - {0, NULL, 0, NULL, NULL} +enum { + GEOMETRY_TO_ORIGIN=0, + ORIGIN_TO_GEOMETRY, + ORIGIN_TO_CURSOR }; -/* 0 == do center, 1 == center new, 2 == center cursor */ static int object_origin_set_exec(bContext *C, wmOperator *op) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); - View3D *v3d= CTX_wm_view3d(C); Object *obedit= CTX_data_edit_object(C); Object *tob; - Mesh *me, *tme; - Curve *cu; -/* BezTriple *bezt; - BPoint *bp; */ - Nurb *nu, *nu1; - EditVert *eve; - float cent[3], centn[3], min[3], max[3]; - int a, total= 0; + float cursor[3], cent[3], cent_neg[3], centn[3], min[3], max[3]; int centermode = RNA_enum_get(op->ptr, "type"); - + int around = RNA_enum_get(op->ptr, "center"); /* initialized from v3d->around */ + /* keep track of what is changed */ int tot_change=0, tot_lib_error=0, tot_multiuser_arm_error=0; - MVert *mvert; - if(scene->id.lib || v3d==NULL){ - BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed on Lib data"); - return OPERATOR_CANCELLED; - } - if (obedit && centermode > 0) { + if (obedit && centermode != GEOMETRY_TO_ORIGIN) { BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in EditMode"); return OPERATOR_CANCELLED; } + else { + /* get the view settings if 'around' isnt set and the view is available */ + View3D *v3d= CTX_wm_view3d(C); + copy_v3_v3(cursor, give_cursor(scene, v3d)); + if(v3d && !RNA_property_is_set(op->ptr, "around")) + around= v3d->around; + } + zero_v3(cent); - - if(obedit) { + if(obedit) { INIT_MINMAX(min, max); - + if(obedit->type==OB_MESH) { Mesh *me= obedit->data; EditMesh *em = BKE_mesh_get_editmesh(me); + EditVert *eve; - for(eve= em->verts.first; eve; eve= eve->next) { - if(v3d->around==V3D_CENTROID) { + if(around==V3D_CENTROID) { + int total= 0; + for(eve= em->verts.first; eve; eve= eve->next) { total++; add_v3_v3(cent, eve->co); } - else { - DO_MINMAX(eve->co, min, max); - } - } - - if(v3d->around==V3D_CENTROID) { mul_v3_fl(cent, 1.0f/(float)total); } else { + for(eve= em->verts.first; eve; eve= eve->next) { + DO_MINMAX(eve->co, min, max); + } mid_v3_v3v3(cent, min, max); } - + for(eve= em->verts.first; eve; eve= eve->next) { - sub_v3_v3(eve->co, cent); + sub_v3_v3(eve->co, cent); } - + recalc_editnormals(em); tot_change++; DAG_id_flush_update(&obedit->id, OB_RECALC_DATA); BKE_mesh_end_editmesh(me, em); } } - + /* reset flags */ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { ob->flag &= ~OB_DONE; @@ -779,190 +771,93 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) if(tob->data) ((ID *)tob->data)->flag &= ~LIB_DOIT; } - + CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { if((ob->flag & OB_DONE)==0) { ob->flag |= OB_DONE; - - if(obedit==NULL && (me=get_mesh(ob)) ) { - if (me->id.lib) { - tot_lib_error++; - } else { - if(centermode==2) { - copy_v3_v3(cent, give_cursor(scene, v3d)); - invert_m4_m4(ob->imat, ob->obmat); - mul_m4_v3(ob->imat, cent); - } else { - INIT_MINMAX(min, max); - mvert= me->mvert; - for(a=0; atotvert; a++, mvert++) { - DO_MINMAX(mvert->co, min, max); - } - - mid_v3_v3v3(cent, min, max); - } - mvert= me->mvert; - for(a=0; atotvert; a++, mvert++) { - sub_v3_v3(mvert->co, cent); - } - - if (me->key) { - KeyBlock *kb; - for (kb=me->key->block.first; kb; kb=kb->next) { - float *fp= kb->data; - - for (a=0; atotelem; a++, fp+=3) { - sub_v3_v3(fp, cent); - } - } - } + if(ob->data == NULL) { + /* pass */ + } + else if (((ID *)ob->data)->lib) { + tot_lib_error++; + } - tot_change++; - me->id.flag |= LIB_DOIT; - - if(centermode) { - copy_v3_v3(centn, cent); - mul_mat3_m4_v3(ob->obmat, centn); /* ommit translation part */ - add_v3_v3(ob->loc, centn); - - where_is_object(scene, ob); - ignore_parent_tx(bmain, scene, ob); - - /* other users? */ - CTX_DATA_BEGIN(C, Object*, ob_other, selected_editable_objects) { - if((ob_other->flag & OB_DONE)==0) { - tme= get_mesh(ob_other); - - if(tme==me) { - - ob_other->flag |= OB_DONE; - ob_other->recalc= OB_RECALC_OB|OB_RECALC_DATA; - - copy_v3_v3(centn, cent); - mul_mat3_m4_v3(ob_other->obmat, centn); /* ommit translation part */ - add_v3_v3(ob_other->loc, centn); - - where_is_object(scene, ob_other); - ignore_parent_tx(bmain, scene, ob_other); - - if(!(tme->id.flag & LIB_DOIT)) { - mvert= tme->mvert; - for(a=0; atotvert; a++, mvert++) { - sub_v3_v3(mvert->co, cent); - } - - if (tme->key) { - KeyBlock *kb; - for (kb=tme->key->block.first; kb; kb=kb->next) { - float *fp= kb->data; - - for (a=0; atotelem; a++, fp+=3) { - sub_v3_v3(fp, cent); - } - } - } - - tot_change++; - tme->id.flag |= LIB_DOIT; - } - } - } - } - CTX_DATA_END; - } + if(obedit==NULL && ob->type==OB_MESH) { + Mesh *me= ob->data; + + if(centermode == ORIGIN_TO_CURSOR) { + copy_v3_v3(cent, cursor); + invert_m4_m4(ob->imat, ob->obmat); + mul_m4_v3(ob->imat, cent); + } else { + if(around==V3D_CENTROID) + mesh_center_median(me, cent); + else + mesh_center_bounds(me, cent); } + + negate_v3_v3(cent_neg, cent); + mesh_translate(me, cent_neg, 1); + + tot_change++; + me->id.flag |= LIB_DOIT; } else if (ELEM(ob->type, OB_CURVE, OB_SURF)) { - - /* weak code here... (ton) */ - if(obedit==ob) { - ListBase *editnurb= curve_get_editcurve(obedit); + Curve *cu= ob->data; - nu1= editnurb->first; - cu= obedit->data; + if(centermode == ORIGIN_TO_CURSOR) { + copy_v3_v3(cent, cursor); + invert_m4_m4(ob->imat, ob->obmat); + mul_m4_v3(ob->imat, cent); } else { - cu= ob->data; - nu1= cu->nurb.first; + if(around==V3D_CENTROID) + curve_center_median(cu, cent); + else + curve_center_bounds(cu, cent); } - - if (cu->id.lib) { - tot_lib_error++; - } else { - if(centermode==2) { - copy_v3_v3(cent, give_cursor(scene, v3d)); - invert_m4_m4(ob->imat, ob->obmat); - mul_m4_v3(ob->imat, cent); - /* don't allow Z change if curve is 2D */ - if( !( cu->flag & CU_3D ) ) - cent[2] = 0.0; - } - else { - INIT_MINMAX(min, max); - - nu= nu1; - while(nu) { - minmaxNurb(nu, min, max); - nu= nu->next; - } - - mid_v3_v3v3(cent, min, max); - } - - nu= nu1; - while(nu) { - if(nu->type == CU_BEZIER) { - a= nu->pntsu; - while (a--) { - sub_v3_v3(nu->bezt[a].vec[0], cent); - sub_v3_v3(nu->bezt[a].vec[1], cent); - sub_v3_v3(nu->bezt[a].vec[2], cent); - } - } - else { - a= nu->pntsu*nu->pntsv; - while (a--) - sub_v3_v3(nu->bp[a].vec, cent); - } - nu= nu->next; - } - - if(centermode && obedit==NULL) { - mul_mat3_m4_v3(ob->obmat, cent); /* ommit translation part */ - add_v3_v3(ob->loc, cent); - where_is_object(scene, ob); - ignore_parent_tx(bmain, scene, ob); - } - - tot_change++; - cu->id.flag |= LIB_DOIT; + /* don't allow Z change if curve is 2D */ + if( !( cu->flag & CU_3D ) ) + cent[2] = 0.0; - if(obedit) { - if (centermode==0) { - DAG_id_flush_update(&obedit->id, OB_RECALC_DATA); - } - break; + negate_v3_v3(cent_neg, cent); + curve_translate(cu, cent_neg, 1); + + tot_change++; + cu->id.flag |= LIB_DOIT; + + if(obedit) { + if (centermode == GEOMETRY_TO_ORIGIN) { + DAG_id_flush_update(&obedit->id, OB_RECALC_DATA); } + break; } } else if(ob->type==OB_FONT) { /* get from bb */ - - cu= ob->data; - - if(cu->bb==NULL) { + + Curve *cu= ob->data; + + if(cu->bb==NULL && (centermode != ORIGIN_TO_CURSOR)) { /* do nothing*/ - } else if (cu->id.lib) { - tot_lib_error++; - } else { - cu->xof= -0.5f*( cu->bb->vec[4][0] - cu->bb->vec[0][0]); - cu->yof= -0.5f -0.5f*( cu->bb->vec[0][1] - cu->bb->vec[2][1]); /* extra 0.5 is the height o above line */ - - /* not really ok, do this better once! */ - cu->xof /= cu->fsize; - cu->yof /= cu->fsize; + } + else { + if(centermode == ORIGIN_TO_CURSOR) { + copy_v3_v3(cent, cursor); + invert_m4_m4(ob->imat, ob->obmat); + mul_m4_v3(ob->imat, cent); + } + else { + cent[0]= 0.5f * ( cu->bb->vec[4][0] + cu->bb->vec[0][0]); + cent[1]= 0.5f * ( cu->bb->vec[0][1] + cu->bb->vec[2][1]) - 0.5f; /* extra 0.5 is the height o above line */ + } + + cent[2]= 0.0f; + + cu->xof= cu->xof - (cent[0] / cu->fsize); + cu->yof= cu->yof - (cent[1] / cu->fsize); tot_change++; cu->id.flag |= LIB_DOIT; @@ -970,29 +865,58 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) } else if(ob->type==OB_ARMATURE) { bArmature *arm = ob->data; - - if (arm->id.lib) { - tot_lib_error++; - } else if(ID_REAL_USERS(arm) > 1) { + + if(ID_REAL_USERS(arm) > 1) { /*BKE_report(op->reports, RPT_ERROR, "Can't apply to a multi user armature"); return;*/ tot_multiuser_arm_error++; - } else { - /* Function to recenter armatures in editarmature.c + } + else { + /* Function to recenter armatures in editarmature.c * Bone + object locations are handled there. */ - docenter_armature(scene, v3d, ob, centermode); + docenter_armature(scene, ob, cursor, centermode, around); tot_change++; - cu->id.flag |= LIB_DOIT; - + arm->id.flag |= LIB_DOIT; + where_is_object(scene, ob); ignore_parent_tx(bmain, scene, ob); - - if(obedit) + + if(obedit) break; } } + + /* offset other selected objects */ + if(centermode != GEOMETRY_TO_ORIGIN) { + /* was the object data modified + * note: the functions above must set 'cent' */ + if(ob->data && (((ID *)ob->data)->flag && LIB_DOIT) && ob->type != OB_ARMATURE) { + copy_v3_v3(centn, cent); + mul_mat3_m4_v3(ob->obmat, centn); /* ommit translation part */ + add_v3_v3(ob->loc, centn); + + where_is_object(scene, ob); + ignore_parent_tx(bmain, scene, ob); + + /* other users? */ + CTX_DATA_BEGIN(C, Object*, ob_other, selected_editable_objects) { + if((ob_other->flag & OB_DONE)==0 && (ob_other->data == ob->data)) { + ob_other->flag |= OB_DONE; + ob_other->recalc= OB_RECALC_OB|OB_RECALC_DATA; + + copy_v3_v3(centn, cent); + mul_mat3_m4_v3(ob_other->obmat, centn); /* ommit translation part */ + add_v3_v3(ob_other->loc, centn); + + where_is_object(scene, ob_other); + ignore_parent_tx(bmain, scene, ob_other); + } + } + CTX_DATA_END; + } + } } } CTX_DATA_END; @@ -1002,26 +926,39 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) tob->recalc= OB_RECALC_OB|OB_RECALC_DATA; } } - + if (tot_change) { DAG_ids_flush_update(0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); } - + /* Warn if any errors occurred */ if (tot_lib_error+tot_multiuser_arm_error) { - BKE_reportf(op->reports, RPT_WARNING, "%i Object(s) Not Centered, %i Changed:",tot_lib_error+tot_multiuser_arm_error, tot_change); + BKE_reportf(op->reports, RPT_WARNING, "%i Object(s) Not Centered, %i Changed:",tot_lib_error+tot_multiuser_arm_error, tot_change); if (tot_lib_error) BKE_reportf(op->reports, RPT_WARNING, "|%i linked library objects",tot_lib_error); if (tot_multiuser_arm_error) BKE_reportf(op->reports, RPT_WARNING, "|%i multiuser armature object(s)",tot_multiuser_arm_error); } - + return OPERATOR_FINISHED; } void OBJECT_OT_origin_set(wmOperatorType *ot) { + static EnumPropertyItem prop_set_center_types[] = { + {GEOMETRY_TO_ORIGIN, "GEOMETRY_ORIGIN", 0, "Geometry to Origin", "Move object geometry to object origin"}, + {ORIGIN_TO_GEOMETRY, "ORIGIN_GEOMETRY", 0, "Origin to Geometry", "Move object origin to center of object geometry"}, + {ORIGIN_TO_CURSOR, "ORIGIN_CURSOR", 0, "Origin to 3D Cursor", "Move object origin to position of the 3d cursor"}, + {0, NULL, 0, NULL, NULL} + }; + + static EnumPropertyItem prop_set_bounds_types[] = { + {V3D_CENTROID, "MEDIAN", 0, "Median Center", ""}, + {V3D_CENTER, "BOUNDS", 0, "Bounds Center", ""}, + {0, NULL, 0, NULL, NULL} + }; + /* identifiers */ ot->name= "Set Origin"; ot->description = "Set the object's origin, by either moving the data, or set to center of data, or use 3d cursor"; @@ -1031,12 +968,12 @@ void OBJECT_OT_origin_set(wmOperatorType *ot) ot->invoke= WM_menu_invoke; ot->exec= object_origin_set_exec; - ot->poll= ED_operator_view3d_active; + ot->poll= ED_operator_scene_editable; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; ot->prop= RNA_def_enum(ot->srna, "type", prop_set_center_types, 0, "Type", ""); - + RNA_def_enum(ot->srna, "center", prop_set_bounds_types, V3D_CENTROID, "Center", ""); } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 9d0c5bcd898..54775affe3f 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -146,7 +146,7 @@ static void view3d_project_short_clip(ARegion *ar, float *vec, short *adr, int l return; } - VECCOPY(vec4, vec); + copy_v3_v3(vec4, vec); vec4[3]= 1.0; mul_m4_v4(rv3d->persmatob, vec4); @@ -175,7 +175,7 @@ static void view3d_project_short_noclip(ARegion *ar, float *vec, short *adr) adr[0]= IS_CLIPPED; - VECCOPY(vec4, vec); + copy_v3_v3(vec4, vec); vec4[3]= 1.0; mul_m4_v4(rv3d->persmatob, vec4); @@ -1146,7 +1146,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, /* and back to viewspace */ glLoadMatrixf(rv3d->viewmat); - VECCOPY(vec, ob->obmat[3]); + copy_v3_v3(vec, ob->obmat[3]); setlinestyle(0); @@ -3257,7 +3257,7 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix case PART_DRAW_DOT: { if(vd) { - VECCOPY(vd,state->co) pdd->vd+=3; + copy_v3_v3(vd,state->co); pdd->vd+=3; } if(cd) { cd[0]=ma_r; @@ -3282,7 +3282,7 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix cd[14]=cd[17]=1.0; pdd->cd+=18; - VECCOPY(vec2,state->co); + copy_v3_v3(vec2,state->co); } else { if(cd) { @@ -3291,47 +3291,47 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix cd[2]=cd[5]=cd[8]=cd[11]=cd[14]=cd[17]=ma_b; pdd->cd+=18; } - VECSUB(vec2,state->co,vec); + sub_v3_v3v3(vec2, state->co, vec); } - VECADD(vec,state->co,vec); - VECCOPY(pdd->vd,vec); pdd->vd+=3; - VECCOPY(pdd->vd,vec2); pdd->vd+=3; + add_v3_v3(vec, state->co); + copy_v3_v3(pdd->vd,vec); pdd->vd+=3; + copy_v3_v3(pdd->vd,vec2); pdd->vd+=3; vec[1]=2.0f*pixsize; vec[0]=vec[2]=0.0; mul_qt_v3(state->rot,vec); if(draw_as==PART_DRAW_AXIS){ - VECCOPY(vec2,state->co); + copy_v3_v3(vec2,state->co); } - else VECSUB(vec2,state->co,vec); + else sub_v3_v3v3(vec2, state->co, vec); - VECADD(vec,state->co,vec); - VECCOPY(pdd->vd,vec); pdd->vd+=3; - VECCOPY(pdd->vd,vec2); pdd->vd+=3; + add_v3_v3(vec, state->co); + copy_v3_v3(pdd->vd,vec); pdd->vd+=3; + copy_v3_v3(pdd->vd,vec2); pdd->vd+=3; vec[2]=2.0f*pixsize; vec[0]=vec[1]=0.0; mul_qt_v3(state->rot,vec); if(draw_as==PART_DRAW_AXIS){ - VECCOPY(vec2,state->co); + copy_v3_v3(vec2,state->co); } - else VECSUB(vec2,state->co,vec); + else sub_v3_v3v3(vec2, state->co, vec); - VECADD(vec,state->co,vec); + add_v3_v3(vec, state->co); - VECCOPY(pdd->vd,vec); pdd->vd+=3; - VECCOPY(pdd->vd,vec2); pdd->vd+=3; + copy_v3_v3(pdd->vd,vec); pdd->vd+=3; + copy_v3_v3(pdd->vd,vec2); pdd->vd+=3; break; } case PART_DRAW_LINE: { - VECCOPY(vec,state->vel); + copy_v3_v3(vec,state->vel); normalize_v3(vec); if(draw & PART_DRAW_VEL_LENGTH) mul_v3_fl(vec,len_v3(state->vel)); - VECADDFAC(pdd->vd,state->co,vec,-draw_line[0]); pdd->vd+=3; - VECADDFAC(pdd->vd,state->co,vec,draw_line[1]); pdd->vd+=3; + madd_v3_v3v3fl(pdd->vd, state->co, vec, -draw_line[0]); pdd->vd+=3; + madd_v3_v3v3fl(pdd->vd, state->co, vec, draw_line[1]); pdd->vd+=3; if(cd) { cd[0]=cd[3]=ma_r; cd[1]=cd[4]=ma_g; @@ -3358,27 +3358,27 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix } - VECCOPY(bb->vec, state->co); - VECCOPY(bb->vel, state->vel); + copy_v3_v3(bb->vec, state->co); + copy_v3_v3(bb->vel, state->vel); psys_make_billboard(bb, xvec, yvec, zvec, bb_center); - VECADD(pdd->vd,bb_center,xvec); - VECADD(pdd->vd,pdd->vd,yvec); pdd->vd+=3; + add_v3_v3v3(pdd->vd, bb_center, xvec); + add_v3_v3(pdd->vd, yvec); pdd->vd+=3; - VECSUB(pdd->vd,bb_center,xvec); - VECADD(pdd->vd,pdd->vd,yvec); pdd->vd+=3; + sub_v3_v3v3(pdd->vd, bb_center, vec); + add_v3_v3(pdd->vd, yvec); pdd->vd+=3; - VECSUB(pdd->vd,bb_center,xvec); - VECSUB(pdd->vd,pdd->vd,yvec); pdd->vd+=3; + sub_v3_v3v3(pdd->vd, bb_center, xvec); + sub_v3_v3v3(pdd->vd, pdd->vd,yvec); pdd->vd+=3; - VECADD(pdd->vd,bb_center,xvec); - VECSUB(pdd->vd,pdd->vd,yvec); pdd->vd+=3; + add_v3_v3v3(pdd->vd, bb_center, xvec); + sub_v3_v3v3(pdd->vd, pdd->vd, yvec); pdd->vd+=3; - VECCOPY(pdd->nd, zvec); pdd->nd+=3; - VECCOPY(pdd->nd, zvec); pdd->nd+=3; - VECCOPY(pdd->nd, zvec); pdd->nd+=3; - VECCOPY(pdd->nd, zvec); pdd->nd+=3; + copy_v3_v3(pdd->nd, zvec); pdd->nd+=3; + copy_v3_v3(pdd->nd, zvec); pdd->nd+=3; + copy_v3_v3(pdd->nd, zvec); pdd->nd+=3; + copy_v3_v3(pdd->nd, zvec); pdd->nd+=3; break; } } @@ -3787,11 +3787,10 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv /* additional things to draw for each particle */ /* (velocity, size and number) */ if((part->draw & PART_DRAW_VEL) && pdd->vedata){ - VECCOPY(pdd->ved,state.co); - pdd->ved+=3; - VECCOPY(vel,state.vel); - mul_v3_fl(vel,timestep); - VECADD(pdd->ved,state.co,vel); + copy_v3_v3(pdd->ved,state.co); + pdd->ved += 3; + mul_v3_v3fl(vel, state.vel, timestep); + add_v3_v3v3(pdd->ved, state.co, vel); pdd->ved+=3; totve++; @@ -4069,7 +4068,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Obj if(timed) { for(k=0, pcol=pathcol, pkey=path; kcol); + copy_v3_v3(pcol, pkey->col); pcol[3] = 1.0f - fabs((float)CFRA - pkey->time)/(float)pset->fade_frames; } @@ -4107,15 +4106,15 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Obj for(k=0, key=point->keys; ktotkey; k++, key++){ if(pd) { - VECCOPY(pd, key->co); + copy_v3_v3(pd, key->co); pd += 3; } if(key->flag&PEK_SELECT){ - VECCOPY(cd,sel_col); + copy_v3_v3(cd,sel_col); } else{ - VECCOPY(cd,nosel_col); + copy_v3_v3(cd,nosel_col); } if(timed) @@ -4189,12 +4188,12 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[1] = root[2] = 0.0f; root[0] = -drw_size; mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); tip[1] = tip[2] = 0.0f; tip[0] = drw_size; mul_m3_v3(tr,tip); - VECADD(tip,tip,com); + add_v3_v3(tip, com); glVertex3fv(tip); glEnd(); @@ -4202,7 +4201,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[0] = th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4211,7 +4210,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[0] = th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4220,7 +4219,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[0] =th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4229,7 +4228,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[0] = th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4240,12 +4239,12 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[0] = root[2] = 0.0f; root[1] = -drw_size; mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); tip[0] = tip[2] = 0.0f; tip[1] = drw_size; mul_m3_v3(tr,tip); - VECADD(tip,tip,com); + add_v3_v3(tip, com); glVertex3fv(tip); glEnd(); @@ -4253,7 +4252,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[1] = th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4262,7 +4261,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[1] = th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4271,7 +4270,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[1] =th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4280,7 +4279,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[1] = th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4290,12 +4289,12 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[0] = root[1] = 0.0f; root[2] = -drw_size; mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); tip[0] = tip[1] = 0.0f; tip[2] = drw_size; mul_m3_v3(tr,tip); - VECADD(tip,tip,com); + add_v3_v3(tip, com); glVertex3fv(tip); glEnd(); @@ -4303,7 +4302,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[2] = th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4312,7 +4311,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[2] = th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4321,7 +4320,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[2] = th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4330,7 +4329,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[2] = th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4869,12 +4868,10 @@ static void drawspiral(float *cent, float rad, float tmat[][4], int start) start *= -1; } - VECCOPY(vx, tmat[0]); - VECCOPY(vy, tmat[1]); - mul_v3_fl(vx, rad); - mul_v3_fl(vy, rad); + mul_v3_v3fl(vx, tmat[0], rad); + mul_v3_v3fl(vy, tmat[1], rad); - VECCOPY(vec, cent); + copy_v3_v3(vec, cent); if (inverse==0) { for(a=0; atype, OB_CURVE, OB_SURF, OB_FONT) { Curve *cu= ob->data; - VECCOPY(size, cu->size); - VECCOPY(loc, cu->loc); + copy_v3_v3(size, cu->size); + copy_v3_v3(loc, cu->loc); } else if(ob->type==OB_MBALL) { MetaBall *mb= ob->data; - VECCOPY(size, mb->size); - VECCOPY(loc, mb->loc); + copy_v3_v3(size, mb->size); + copy_v3_v3(loc, mb->loc); } else return; @@ -5781,8 +5778,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if (cu->linewidth != 0.0) { cpack(0xff44ff); UI_ThemeColor(TH_WIRE); - VECCOPY(vec1, ob->orig); - VECCOPY(vec2, ob->orig); + copy_v3_v3(vec1, ob->orig); + copy_v3_v3(vec2, ob->orig); vec1[0] += cu->linewidth; vec2[0] += cu->linewidth; vec1[1] += cu->linedist * cu->fsize; @@ -6071,7 +6068,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(density[index] > FLT_EPSILON) { float color[3]; - VECCOPY(tmp, smd->domain->p0); + copy_v3_v3(tmp, smd->domain->p0); tmp[0] += smd->domain->dx * x + smd->domain->dx * 0.5; tmp[1] += smd->domain->dx * y + smd->domain->dx * 0.5; tmp[2] += smd->domain->dx * z + smd->domain->dx * 0.5; -- cgit v1.2.3 From 8fd1d8f02ab765038d798a4df33bbda821f8d7a0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 1 Aug 2010 11:20:51 +0000 Subject: mistake in recent commit allowd bpy.types.Scene() which would then crash blender (thanks for spotting Luca). --- source/blender/python/intern/bpy_rna.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender') diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 2a708c82697..8be9cc4cdae 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -3088,7 +3088,7 @@ static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject BPy_StructRNA *base; - if (!PyArg_ParseTuple(args, "|O!:bpy_struct.__new__", &pyrna_struct_Type, &base)) + if (!PyArg_ParseTuple(args, "O!:bpy_struct.__new__", &pyrna_struct_Type, &base)) return NULL; if (type == Py_TYPE(base)) { -- cgit v1.2.3 From c34f831757e0985b7523b6e5bbfadd7dd6a2c161 Mon Sep 17 00:00:00 2001 From: Daniel Genrich Date: Sun, 1 Aug 2010 12:16:32 +0000 Subject: Smoke: - Bugfix for display problems in shaded view: Reverting to wire display mode for domain. --- source/blender/blenkernel/intern/smoke.c | 3 --- source/blender/makesrna/intern/rna_modifier.c | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 2664a20bd18..15c7d3b4678 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -935,7 +935,6 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd) // Add emitter density to temp emission map temp_emission_map[index] = sfs->density; - // Uses particle velocity as initial velocity for smoke if(sfs->flags & MOD_SMOKE_FLOW_INITVELOCITY && (psys->part->phystype != PART_PHYS_NO)) { @@ -943,8 +942,6 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd) velocity_y[index] = pa->state.vel[1]*sfs->vel_multi; velocity_z[index] = pa->state.vel[2]*sfs->vel_multi; } - - } else if(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW) // outflow { diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 4ace614640c..18b0f1ca61a 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -234,7 +234,7 @@ static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr) switch (smd->type) { case MOD_SMOKE_TYPE_DOMAIN: - ob->dt = OB_BOUNDBOX; + ob->dt = OB_WIRE; break; case MOD_SMOKE_TYPE_FLOW: for(psys=ob->particlesystem.first; psys; psys=psys->next) -- cgit v1.2.3 From 5fa7d1c1b4e7bde1d173caa60af0e273c86b6f0b Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 1 Aug 2010 12:47:49 +0000 Subject: 2.5: code changes to reduce the usage of G.main and pass it along or get it from the context instead. --- source/blender/blenkernel/BKE_depsgraph.h | 12 +- source/blender/blenkernel/BKE_material.h | 5 +- source/blender/blenkernel/BKE_pointcache.h | 16 ++- source/blender/blenkernel/BKE_scene.h | 4 +- source/blender/blenkernel/intern/anim.c | 6 +- source/blender/blenkernel/intern/blender.c | 2 +- source/blender/blenkernel/intern/depsgraph.c | 42 +++--- source/blender/blenkernel/intern/material.c | 10 +- source/blender/blenkernel/intern/particle.c | 4 +- source/blender/blenkernel/intern/pointcache.c | 10 +- source/blender/blenkernel/intern/scene.c | 24 ++-- source/blender/blenkernel/intern/sequencer.c | 4 +- source/blender/blenloader/intern/readfile.c | 2 +- source/blender/editors/animation/drivers.c | 4 +- source/blender/editors/animation/keyframing.c | 16 ++- source/blender/editors/animation/keyingsets.c | 6 +- source/blender/editors/armature/editarmature.c | 8 +- source/blender/editors/curve/editcurve.c | 8 +- source/blender/editors/include/ED_object.h | 35 ++--- .../editors/interface/interface_templates.c | 3 +- source/blender/editors/interface/resources.c | 53 +++---- source/blender/editors/mesh/editmesh.c | 19 +-- source/blender/editors/mesh/meshtools.c | 9 +- source/blender/editors/object/object_add.c | 71 +++++---- source/blender/editors/object/object_constraint.c | 25 ++-- source/blender/editors/object/object_edit.c | 160 ++------------------- source/blender/editors/object/object_group.c | 16 ++- source/blender/editors/object/object_hook.c | 11 +- source/blender/editors/object/object_modifier.c | 26 ++-- source/blender/editors/object/object_relations.c | 82 ++++++----- source/blender/editors/object/object_transform.c | 18 ++- source/blender/editors/physics/particle_boids.c | 7 +- source/blender/editors/physics/particle_object.c | 8 +- source/blender/editors/render/render_internal.c | 16 ++- source/blender/editors/render/render_opengl.c | 8 +- source/blender/editors/render/render_preview.c | 4 +- source/blender/editors/screen/screen_edit.c | 3 +- source/blender/editors/screen/screen_ops.c | 4 +- source/blender/editors/space_graph/graph_buttons.c | 5 +- source/blender/editors/space_logic/logic_window.c | 47 +++--- source/blender/editors/space_node/drawnode.c | 12 +- source/blender/editors/space_node/node_edit.c | 3 +- source/blender/editors/space_outliner/outliner.c | 7 +- source/blender/editors/space_text/text_ops.c | 3 +- .../blender/editors/space_view3d/view3d_buttons.c | 4 +- .../blender/editors/space_view3d/view3d_header.c | 3 +- source/blender/editors/space_view3d/view3d_snap.c | 9 +- source/blender/editors/space_view3d/view3d_view.c | 12 +- .../editors/transform/transform_conversions.c | 4 +- source/blender/editors/util/ed_util.c | 3 +- source/blender/makesrna/intern/rna_boid.c | 2 +- source/blender/makesrna/intern/rna_constraint.c | 2 +- source/blender/makesrna/intern/rna_curve.c | 2 +- source/blender/makesrna/intern/rna_fcurve.c | 2 +- source/blender/makesrna/intern/rna_modifier.c | 2 +- source/blender/makesrna/intern/rna_object.c | 14 +- source/blender/makesrna/intern/rna_object_force.c | 12 +- source/blender/makesrna/intern/rna_particle.c | 4 +- source/blender/makesrna/intern/rna_pose.c | 2 +- source/blender/makesrna/intern/rna_scene.c | 8 +- source/blender/makesrna/intern/rna_scene_api.c | 14 +- source/blender/makesrna/intern/rna_smoke.c | 2 +- source/blender/render/extern/include/RE_pipeline.h | 7 +- .../blender/render/intern/include/render_types.h | 4 +- source/blender/render/intern/include/texture.h | 2 +- .../blender/render/intern/source/convertblender.c | 18 +-- source/blender/render/intern/source/envmap.c | 3 +- source/blender/render/intern/source/pipeline.c | 23 +-- source/blender/render/intern/source/pointdensity.c | 4 +- source/blender/render/intern/source/sss.c | 3 +- source/blender/render/intern/source/texture.c | 6 +- source/blender/render/intern/source/voxeldata.c | 3 +- .../blender/windowmanager/intern/wm_event_system.c | 2 +- source/blender/windowmanager/intern/wm_files.c | 4 +- source/blender/windowmanager/intern/wm_operators.c | 10 +- 75 files changed, 497 insertions(+), 531 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h index 6a44051806e..0b78a1206fe 100644 --- a/source/blender/blenkernel/BKE_depsgraph.h +++ b/source/blender/blenkernel/BKE_depsgraph.h @@ -70,7 +70,7 @@ int queue_count(struct DagNodeQueue *queue); void queue_delete(struct DagNodeQueue *queue); // queries -struct DagForest *build_dag(struct Scene *sce, short mask); +struct DagForest *build_dag(struct Main *bmain, struct Scene *sce, short mask); void free_forest(struct DagForest *Dag); // note : @@ -97,14 +97,14 @@ void draw_all_deps(void); /* Note that the DAG never executes changes in Objects, only sets flags in Objects */ /* (re)-create dependency graph for scene */ -void DAG_scene_sort(struct Scene *sce); +void DAG_scene_sort(struct Main *bmain, struct Scene *sce); /* flag all objects that need recalc because they're animated */ -void DAG_scene_update_flags(struct Scene *sce, unsigned int lay); +void DAG_scene_update_flags(struct Main *bmain, struct Scene *sce, unsigned int lay); /* flushes all recalc flags in objects down the dependency tree */ -void DAG_scene_flush_update(struct Scene *sce, unsigned int lay, int time); +void DAG_scene_flush_update(struct Main *bmain, struct Scene *sce, unsigned int lay, int time); /* tag objects for update on file load */ -void DAG_on_load_update(void); +void DAG_on_load_update(struct Main *bmain); /* flag all IDs that need recalc because they're animated, influencing this ID only. only for objects currently */ @@ -113,7 +113,7 @@ void DAG_id_update_flags(struct ID *id); but note the DAG only supports objects and object data currently */ void DAG_id_flush_update(struct ID *id, short flag); /* when setting manual RECALC flags, call this afterwards */ -void DAG_ids_flush_update(int time); +void DAG_ids_flush_update(struct Main *bmain, int time); /* (re)-create dependency graph for armature pose */ void DAG_pose_sort(struct Object *ob); diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h index 07ca5a1c0ee..a220153523e 100644 --- a/source/blender/blenkernel/BKE_material.h +++ b/source/blender/blenkernel/BKE_material.h @@ -35,6 +35,7 @@ extern "C" { #endif +struct Main; struct Material; struct ID; struct Object; @@ -69,9 +70,9 @@ int object_remove_material_slot(struct Object *ob); /* rendering */ void init_render_material(struct Material *, int, float *); -void init_render_materials(int, float *); +void init_render_materials(struct Main *, int, float *); void end_render_material(struct Material *); -void end_render_materials(void); +void end_render_materials(struct Main *); int material_in_material(struct Material *parmat, struct Material *mat); diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h index 03a86b6566a..63f36a5f103 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -70,15 +70,16 @@ #define PTCACHE_READ_OLD 3 /* Structs */ +struct ClothModifierData; +struct ListBase; +struct Main; struct Object; -struct Scene; -struct SoftBody; -struct ParticleSystem; struct ParticleKey; -struct ClothModifierData; -struct SmokeModifierData; +struct ParticleSystem; struct PointCache; -struct ListBase; +struct Scene; +struct SmokeModifierData; +struct SoftBody; /* temp structure for read/write */ typedef struct PTCacheData { @@ -143,6 +144,7 @@ typedef struct PTCacheID { } PTCacheID; typedef struct PTCacheBaker { + struct Main *main; struct Scene *scene; int bake; int render; @@ -286,7 +288,7 @@ struct PointCache *BKE_ptcache_copy_list(struct ListBase *ptcaches_new, struct L /********************** Baking *********************/ /* Bakes cache with cache_step sized jumps in time, not accurate but very fast. */ -void BKE_ptcache_quick_cache_all(struct Scene *scene); +void BKE_ptcache_quick_cache_all(struct Main *bmain, struct Scene *scene); /* Bake cache or simulate to current frame with settings defined in the baker. */ void BKE_ptcache_make_cache(struct PTCacheBaker* baker); diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index f0fb2a65673..878fca81378 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -82,8 +82,8 @@ int scene_check_setscene(struct Scene *sce); float BKE_curframe(struct Scene *scene); -void scene_update_tagged(struct Scene *sce); -void scene_update_for_newframe(struct Scene *sce, unsigned int lay); +void scene_update_tagged(struct Main *bmain, struct Scene *sce); +void scene_update_for_newframe(struct Main *bmain, struct Scene *sce, unsigned int lay); void scene_add_render_layer(struct Scene *sce); diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 412084f7cd1..c24ec78dc1c 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -289,7 +289,7 @@ static void motionpaths_calc_optimise_depsgraph(Scene *scene, ListBase *targets) } /* "brew me a list that's sorted a bit faster now depsy" */ - DAG_scene_sort(scene); + DAG_scene_sort(G.main, scene); } /* update scene for current frame */ @@ -299,7 +299,7 @@ static void motionpaths_calc_update_scene(Scene *scene) Base *base, *last=NULL; /* only stuff that moves or needs display still */ - DAG_scene_update_flags(scene, scene->lay); + DAG_scene_update_flags(G.main, scene, scene->lay); /* find the last object with the tag * - all those afterwards are assumed to not be relevant for our calculations @@ -327,7 +327,7 @@ static void motionpaths_calc_update_scene(Scene *scene) * that doesn't force complete update, but for now, this is the * most accurate way! */ - scene_update_for_newframe(scene, scene->lay); // XXX this is the best way we can get anything moving + scene_update_for_newframe(G.main, scene, scene->lay); // XXX this is the best way we can get anything moving #endif } diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 9a624017a16..64d07db024b 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -478,7 +478,7 @@ static int read_undosave(bContext *C, UndoElem *uel) G.fileflags= fileflags; if(success) - DAG_on_load_update(); + DAG_on_load_update(G.main); return success; } diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 142f80a350e..1f8360324d5 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -658,7 +658,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O dag_add_relation(dag,scenenode,node,DAG_RL_SCENE, "Scene Relation"); } -struct DagForest *build_dag(struct Scene *sce, short mask) +struct DagForest *build_dag(Main *bmain, Scene *sce, short mask) { Base *base; Object *ob; @@ -695,7 +695,7 @@ struct DagForest *build_dag(struct Scene *sce, short mask) } /* add groups used in current scene objects */ - for(group= G.main->group.first; group; group= group->id.next) { + for(group= bmain->group.first; group; group= group->id.next) { if(group->id.flag & LIB_DOIT) { for(go= group->gobject.first; go; go= go->next) { build_dag_object(dag, scenenode, sce, go->ob, mask); @@ -1605,7 +1605,7 @@ static void dag_editors_update(Main *bmain, ID *id) } /* groups with objects in this scene need to be put in the right order as well */ -static void scene_sort_groups(Scene *sce) +static void scene_sort_groups(Main *bmain, Scene *sce) { Base *base; Group *group; @@ -1613,14 +1613,14 @@ static void scene_sort_groups(Scene *sce) Object *ob; /* test; are group objects all in this scene? */ - for(ob= G.main->object.first; ob; ob= ob->id.next) { + for(ob= bmain->object.first; ob; ob= ob->id.next) { ob->id.flag &= ~LIB_DOIT; ob->id.newid= NULL; /* newid abuse for GroupObject */ } for(base = sce->base.first; base; base= base->next) base->object->id.flag |= LIB_DOIT; - for(group= G.main->group.first; group; group= group->id.next) { + for(group= bmain->group.first; group; group= group->id.next) { for(go= group->gobject.first; go; go= go->next) { if((go->ob->id.flag & LIB_DOIT)==0) break; @@ -1649,7 +1649,7 @@ static void scene_sort_groups(Scene *sce) } /* sort the base list on dependency order */ -void DAG_scene_sort(struct Scene *sce) +void DAG_scene_sort(Main *bmain, Scene *sce) { DagNode *node; DagNodeQueue *nqueue; @@ -1661,7 +1661,7 @@ void DAG_scene_sort(struct Scene *sce) tempbase.first= tempbase.last= NULL; - build_dag(sce, DAG_RL_ALL_BUT_DATA); + build_dag(bmain, sce, DAG_RL_ALL_BUT_DATA); dag_check_cycle(sce->theDag); @@ -1731,7 +1731,7 @@ void DAG_scene_sort(struct Scene *sce) queue_delete(nqueue); /* all groups with objects in this scene gets resorted too */ - scene_sort_groups(sce); + scene_sort_groups(bmain, sce); if(G.f & G_DEBUG) { printf("\nordered\n"); @@ -1926,7 +1926,7 @@ static void dag_scene_flush_layers(Scene *sce, int lay) } /* flushes all recalc flags in objects down the dependency tree */ -void DAG_scene_flush_update(Scene *sce, unsigned int lay, int time) +void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, int time) { DagNode *firstnode; DagAdjList *itA; @@ -1935,7 +1935,7 @@ void DAG_scene_flush_update(Scene *sce, unsigned int lay, int time) if(sce->theDag==NULL) { printf("DAG zero... not allowed to happen!\n"); - DAG_scene_sort(sce); + DAG_scene_sort(bmain, sce); } firstnode= sce->theDag->DagNode.first; // always scene node @@ -2135,7 +2135,7 @@ static void dag_object_time_update_flags(Object *ob) } } /* flag all objects that need recalc, for changes in time for example */ -void DAG_scene_update_flags(Scene *scene, unsigned int lay) +void DAG_scene_update_flags(Main *bmain, Scene *scene, unsigned int lay) { Base *base; Object *ob; @@ -2157,7 +2157,7 @@ void DAG_scene_update_flags(Scene *scene, unsigned int lay) } /* we do groups each once */ - for(group= G.main->group.first; group; group= group->id.next) { + for(group= bmain->group.first; group; group= group->id.next) { if(group->id.flag & LIB_DOIT) { for(go= group->gobject.first; go; go= go->next) { dag_object_time_update_flags(go->ob); @@ -2166,7 +2166,7 @@ void DAG_scene_update_flags(Scene *scene, unsigned int lay) } for(sce= scene; sce; sce= sce->set) - DAG_scene_flush_update(sce, lay, 1); + DAG_scene_flush_update(bmain, sce, lay, 1); /* test: set time flag, to disable baked systems to update */ for(SETLOOPER(scene, base)) { @@ -2223,21 +2223,19 @@ static void dag_current_scene_layers(Main *bmain, Scene **sce, unsigned int *lay } } -void DAG_ids_flush_update(int time) +void DAG_ids_flush_update(Main *bmain, int time) { - Main *bmain= G.main; Scene *sce; unsigned int lay; dag_current_scene_layers(bmain, &sce, &lay); if(sce) - DAG_scene_flush_update(sce, lay, time); + DAG_scene_flush_update(bmain, sce, lay, time); } -void DAG_on_load_update(void) +void DAG_on_load_update(Main *bmain) { - Main *bmain= G.main; Scene *scene, *sce; Base *base; Object *ob; @@ -2268,7 +2266,7 @@ void DAG_on_load_update(void) } } - for(group= G.main->group.first; group; group= group->id.next) { + for(group= bmain->group.first; group; group= group->id.next) { if(group->id.flag & LIB_DOIT) { for(go= group->gobject.first; go; go= go->next) { if(ELEM5(go->ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL)) @@ -2282,7 +2280,7 @@ void DAG_on_load_update(void) } /* now tag update flags, to ensure deformers get calculated on redraw */ - DAG_scene_update_flags(scene, lay); + DAG_scene_update_flags(bmain, scene, lay); } } @@ -2394,7 +2392,7 @@ void DAG_id_flush_update(ID *id, short flag) } /* flush to other objects that depend on this one */ - DAG_scene_flush_update(sce, lay, 0); + DAG_scene_flush_update(bmain, sce, lay, 0); } /* recursively descends tree, each node only checked once */ @@ -2477,7 +2475,7 @@ void DAG_id_update_flags(ID *id) } /* set recalcs and flushes */ - DAG_scene_update_flags(sce, lay); + DAG_scene_update_flags(bmain, sce, lay); /* now we clear recalcs, unless color is set */ for(node = sce->theDag->DagNode.first; node; node= node->next) { diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 11c96e9a347..6b79a7b4d62 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -783,14 +783,14 @@ void init_render_material(Material *mat, int r_mode, float *amb) } } -void init_render_materials(int r_mode, float *amb) +void init_render_materials(Main *bmain, int r_mode, float *amb) { Material *ma; /* clear these flags before going over materials, to make sure they * are cleared only once, otherwise node materials contained in other * node materials can go wrong */ - for(ma= G.main->mat.first; ma; ma= ma->id.next) { + for(ma= bmain->mat.first; ma; ma= ma->id.next) { if(ma->id.us) { ma->texco= 0; ma->mapto= 0; @@ -798,7 +798,7 @@ void init_render_materials(int r_mode, float *amb) } /* two steps, first initialize, then or the flags for layers */ - for(ma= G.main->mat.first; ma; ma= ma->id.next) { + for(ma= bmain->mat.first; ma; ma= ma->id.next) { /* is_used flag comes back in convertblender.c */ ma->flag &= ~MA_IS_USED; if(ma->id.us) @@ -815,10 +815,10 @@ void end_render_material(Material *mat) ntreeEndExecTree(mat->nodetree); /* has internal flag to detect it only does it once */ } -void end_render_materials(void) +void end_render_materials(Main *bmain) { Material *ma; - for(ma= G.main->mat.first; ma; ma= ma->id.next) + for(ma= bmain->mat.first; ma; ma= ma->id.next) if(ma->id.us) end_render_material(ma); } diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index ed63f011342..52ee0180f43 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3395,7 +3395,7 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, char *name) psys->flag = PSYS_ENABLED|PSYS_CURRENT; psys->cfra=bsystem_time(scene,ob,scene->r.cfra+1,0.0); - DAG_scene_sort(scene); + DAG_scene_sort(G.main, scene); DAG_id_flush_update(&ob->id, OB_RECALC_DATA); return md; @@ -3432,7 +3432,7 @@ void object_remove_particle_system(Scene *scene, Object *ob) else ob->mode &= ~OB_MODE_PARTICLE_EDIT; - DAG_scene_sort(scene); + DAG_scene_sort(G.main, scene); DAG_id_flush_update(&ob->id, OB_RECALC_DATA); } static void default_particle_settings(ParticleSettings *part) diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index ced5d116ad0..d44221d2cd3 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -2335,7 +2335,7 @@ PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, ListBase *ptcaches_old /* Baking */ -void BKE_ptcache_quick_cache_all(Scene *scene) +void BKE_ptcache_quick_cache_all(Main *bmain, Scene *scene) { PTCacheBaker baker; @@ -2348,6 +2348,7 @@ void BKE_ptcache_quick_cache_all(Scene *scene) baker.progresscontext=NULL; baker.render=0; baker.anim_init = 0; + baker.main=bmain; baker.scene=scene; baker.quick_step=scene->physics_settings.quick_cache_step; @@ -2362,6 +2363,7 @@ typedef struct { int endframe; int step; int *cfra_ptr; + Main *main; Scene *scene; } ptcache_make_cache_data; @@ -2369,7 +2371,7 @@ static void *ptcache_make_cache_thread(void *ptr) { ptcache_make_cache_data *data = (ptcache_make_cache_data*)ptr; for(; (*data->cfra_ptr <= data->endframe) && !data->break_operation; *data->cfra_ptr+=data->step) { - scene_update_for_newframe(data->scene, data->scene->lay); + scene_update_for_newframe(data->main, data->scene, data->scene->lay); if(G.background) { printf("bake: frame %d :: %d\n", (int)*data->cfra_ptr, data->endframe); } @@ -2382,6 +2384,7 @@ static void *ptcache_make_cache_thread(void *ptr) { /* if bake is not given run simulations to current frame */ void BKE_ptcache_make_cache(PTCacheBaker* baker) { + Main *bmain = baker->main; Scene *scene = baker->scene; Scene *sce; /* SETLOOPER macro only */ Base *base; @@ -2401,6 +2404,7 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker) thread_data.step = baker->quick_step; thread_data.cfra_ptr = &CFRA; thread_data.scene = baker->scene; + thread_data.main = baker->main; G.afbreek = 0; @@ -2570,7 +2574,7 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker) CFRA = cfrao; if(bake) /* already on cfra unless baking */ - scene_update_for_newframe(scene, scene->lay); + scene_update_for_newframe(bmain, scene, scene->lay); if (thread_data.break_operation) WM_cursor_wait(0); diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 3c7f6e13445..811f8a81b06 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -531,12 +531,12 @@ void set_scene_bg(Scene *scene) } /* sort baselist */ - DAG_scene_sort(scene); + DAG_scene_sort(G.main, scene); /* ensure dags are built for sets */ for(sce= scene->set; sce; sce= sce->set) if(sce->theDag==NULL) - DAG_scene_sort(sce); + DAG_scene_sort(G.main, sce); /* copy layers and flags from bases to objects */ for(base= scene->base.first; base; base= base->next) { @@ -907,14 +907,14 @@ float BKE_curframe(Scene *scene) return ctime; } -static void scene_update_tagged_recursive(Scene *scene, Scene *scene_parent) +static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scene_parent) { Base *base; /* sets first, we allow per definition current scene to have dependencies on sets, but not the other way around. */ if(scene->set) - scene_update_tagged_recursive(scene->set, scene_parent); + scene_update_tagged_recursive(bmain, scene->set, scene_parent); for(base= scene->base.first; base; base= base->next) { Object *ob= base->object; @@ -930,14 +930,14 @@ static void scene_update_tagged_recursive(Scene *scene, Scene *scene_parent) } /* this is called in main loop, doing tagged updates before redraw */ -void scene_update_tagged(Scene *scene) +void scene_update_tagged(Main *bmain, Scene *scene) { scene->physics_settings.quick_cache_step= 0; /* update all objects: drivers, matrices, displists, etc. flags set by depgraph or manual, no layer check here, gets correct flushed */ - scene_update_tagged_recursive(scene, scene); + scene_update_tagged_recursive(bmain, scene, scene); /* recalc scene animation data here (for sequencer) */ { @@ -949,14 +949,14 @@ void scene_update_tagged(Scene *scene) } if(scene->physics_settings.quick_cache_step) - BKE_ptcache_quick_cache_all(scene); + BKE_ptcache_quick_cache_all(bmain, scene); /* in the future this should handle updates for all datablocks, not only objects and scenes. - brecht */ } /* applies changes right away, does all sets too */ -void scene_update_for_newframe(Scene *sce, unsigned int lay) +void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) { float ctime = BKE_curframe(sce); Scene *sce_iter; @@ -966,13 +966,13 @@ void scene_update_for_newframe(Scene *sce, unsigned int lay) for(sce_iter= sce; sce_iter; sce_iter= sce_iter->set) { if(sce_iter->theDag==NULL) - DAG_scene_sort(sce_iter); + DAG_scene_sort(bmain, sce_iter); } /* Following 2 functions are recursive * so dont call within 'scene_update_tagged_recursive' */ - DAG_scene_update_flags(sce, lay); // only stuff that moves or needs display still + DAG_scene_update_flags(bmain, sce, lay); // only stuff that moves or needs display still /* All 'standard' (i.e. without any dependencies) animation is handled here, * with an 'local' to 'macro' order of evaluation. This should ensure that @@ -980,11 +980,11 @@ void scene_update_for_newframe(Scene *sce, unsigned int lay) * can be overridden by settings from Scene, which owns the Texture through a hierarchy * such as Scene->World->MTex/Texture) can still get correctly overridden. */ - BKE_animsys_evaluate_all_animation(G.main, ctime); + BKE_animsys_evaluate_all_animation(bmain, ctime); /*...done with recusrive funcs */ /* object_handle_update() on all objects, groups and sets */ - scene_update_tagged_recursive(sce, sce); + scene_update_tagged_recursive(bmain, sce, sce); } /* return default layer, also used to patch old files */ diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index df185732d22..aab4e1226b2 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1852,7 +1852,7 @@ static ImBuf * seq_render_scene_strip_impl( if(sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (seq->scene == scene || have_seq==0) && seq->scene->camera) { /* opengl offscreen render */ - scene_update_for_newframe(seq->scene, seq->scene->lay); + scene_update_for_newframe(G.main, seq->scene, seq->scene->lay); ibuf= sequencer_view3d_cb(seq->scene, seqrectx, seqrecty, scene->r.seq_prev_type); } @@ -1865,7 +1865,7 @@ static ImBuf * seq_render_scene_strip_impl( else re= RE_NewRender(sce->id.name); - RE_BlenderFrame(re, sce, NULL, sce->lay, frame); + RE_BlenderFrame(re, G.main, sce, NULL, sce->lay, frame); RE_AcquireResultImage(re, &rres); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 943bf2c6f39..1fab3d894fd 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -12509,7 +12509,7 @@ void BLO_script_library_append(BlendHandle **bh, char *dir, char *name, /* do we need to do this? */ if(scene) - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); *bh= (BlendHandle*)fd; } diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index 3fc228e1c15..9edcf637cdc 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -389,7 +389,7 @@ static int add_driver_button_exec (bContext *C, wmOperator *op) if (success) { /* send updates */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(CTX_data_main(C), 0); WM_event_add_notifier(C, NC_ANIMATION|ND_FCURVES_ORDER, NULL); // XXX } @@ -440,7 +440,7 @@ static int remove_driver_button_exec (bContext *C, wmOperator *op) if (success) { /* send updates */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(CTX_data_main(C), 0); WM_event_add_notifier(C, NC_ANIMATION|ND_FCURVES_ORDER, NULL); // XXX } diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index f60181d7f6c..ea20a5c2c88 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -51,6 +51,7 @@ #include "BKE_constraint.h" #include "BKE_depsgraph.h" #include "BKE_fcurve.h" +#include "BKE_main.h" #include "BKE_nla.h" #include "BKE_global.h" #include "BKE_utildefines.h" @@ -1060,6 +1061,7 @@ static int modify_key_op_poll(bContext *C) static int insert_key_exec (bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); KeyingSet *ks= NULL; int type= RNA_int_get(op->ptr, "type"); @@ -1106,7 +1108,7 @@ static int insert_key_exec (bContext *C, wmOperator *op) BKE_report(op->reports, RPT_WARNING, "Keying Set failed to insert any keyframes"); /* send updates */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); return OPERATOR_FINISHED; } @@ -1202,6 +1204,7 @@ void ANIM_OT_keyframe_insert_menu (wmOperatorType *ot) static int delete_key_exec (bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); KeyingSet *ks= NULL; int type= RNA_int_get(op->ptr, "type"); @@ -1248,7 +1251,7 @@ static int delete_key_exec (bContext *C, wmOperator *op) BKE_report(op->reports, RPT_WARNING, "Keying Set failed to remove any keyframes"); /* send updates */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); return OPERATOR_FINISHED; } @@ -1287,6 +1290,7 @@ void ANIM_OT_keyframe_delete (wmOperatorType *ot) static int delete_key_v3d_exec (bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); float cfra= (float)CFRA; // XXX for now, don't bother about all the yucky offset crap @@ -1315,7 +1319,7 @@ static int delete_key_v3d_exec (bContext *C, wmOperator *op) CTX_DATA_END; /* send updates */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, NULL); @@ -1343,6 +1347,7 @@ void ANIM_OT_keyframe_delete_v3d (wmOperatorType *ot) static int insert_key_button_exec (bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); PointerRNA ptr; PropertyRNA *prop= NULL; @@ -1400,7 +1405,7 @@ static int insert_key_button_exec (bContext *C, wmOperator *op) if (success) { /* send updates */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); /* send notifiers that keyframes have been changed */ WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); @@ -1430,6 +1435,7 @@ void ANIM_OT_keyframe_insert_button (wmOperatorType *ot) static int delete_key_button_exec (bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); PointerRNA ptr; PropertyRNA *prop= NULL; @@ -1470,7 +1476,7 @@ static int delete_key_button_exec (bContext *C, wmOperator *op) if (success) { /* send updates */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); /* send notifiers that keyframes have been changed */ WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 301111d22fd..033c4713e01 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -289,6 +289,7 @@ void ANIM_OT_keying_set_path_remove (wmOperatorType *ot) static int add_keyingset_button_exec (bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); KeyingSet *ks = NULL; PropertyRNA *prop= NULL; @@ -359,7 +360,7 @@ static int add_keyingset_button_exec (bContext *C, wmOperator *op) if (success) { /* send updates */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); /* for now, only send ND_KEYS for KeyingSets */ WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL); @@ -389,6 +390,7 @@ void ANIM_OT_keyingset_button_add (wmOperatorType *ot) static int remove_keyingset_button_exec (bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); KeyingSet *ks = NULL; PropertyRNA *prop= NULL; @@ -441,7 +443,7 @@ static int remove_keyingset_button_exec (bContext *C, wmOperator *op) if (success) { /* send updates */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); /* for now, only send ND_KEYS for KeyingSets */ WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 480bade1dc3..3b5c07a8001 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -809,6 +809,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann /* join armature exec is exported for use in object->join objects operator... */ int join_armature_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); bArmature *arm= (ob)? ob->data: NULL; @@ -901,12 +902,12 @@ int join_armature_exec(bContext *C, wmOperator *op) free_pose_channels_hash(pose); } - ED_base_object_free_and_unlink(scene, base); + ED_base_object_free_and_unlink(bmain, scene, base); } } CTX_DATA_END; - DAG_scene_sort(scene); // because we removed object(s) + DAG_scene_sort(bmain, scene); // because we removed object(s) ED_armature_from_edit(ob); ED_armature_edit_free(ob); @@ -1118,6 +1119,7 @@ static void separate_armature_bones (Scene *scene, Object *ob, short sel) /* separate selected bones into their armature */ static int separate_armature_exec (bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); Object *oldob, *newob; @@ -1158,7 +1160,7 @@ static int separate_armature_exec (bContext *C, wmOperator *op) ED_armature_edit_free(obedit); /* 2) duplicate base */ - newbase= ED_object_add_duplicate(scene, oldbase, USER_DUP_ARM); /* only duplicate linked armature */ + newbase= ED_object_add_duplicate(bmain, scene, oldbase, USER_DUP_ARM); /* only duplicate linked armature */ newob= newbase->object; newbase->flag &= ~SELECT; diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index d38c91da5c5..16204e9f199 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -1119,6 +1119,7 @@ void CU_select_swap(Object *obedit) static int separate_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Nurb *nu, *nu1; Object *oldob, *newob; @@ -1139,7 +1140,7 @@ static int separate_exec(bContext *C, wmOperator *op) WM_cursor_wait(1); /* 1. duplicate the object and data */ - newbase= ED_object_add_duplicate(scene, oldbase, 0); /* 0 = fully linked */ + newbase= ED_object_add_duplicate(bmain, scene, oldbase, 0); /* 0 = fully linked */ ED_base_object_select(newbase, BA_DESELECT); newob= newbase->object; @@ -5543,6 +5544,7 @@ void CURVE_OT_shade_flat(wmOperatorType *ot) int join_curve_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); Curve *cu; @@ -5594,7 +5596,7 @@ int join_curve_exec(bContext *C, wmOperator *op) } } - ED_base_object_free_and_unlink(scene, base); + ED_base_object_free_and_unlink(bmain, scene, base); } } } @@ -5603,7 +5605,7 @@ int join_curve_exec(bContext *C, wmOperator *op) cu= ob->data; addlisttolist(&cu->nurb, &tempbase); - DAG_scene_sort(scene); // because we removed object(s), call before editmode! + DAG_scene_sort(bmain, scene); // because we removed object(s), call before editmode! ED_object_enter_editmode(C, EM_WAITCURSOR); ED_object_exit_editmode(C, EM_FREEDATA|EM_WAITCURSOR|EM_DO_UNDO); diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index efa5d6c5dad..f243b4cc497 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -28,24 +28,25 @@ #ifndef ED_OBJECT_H #define ED_OBJECT_H -struct wmKeyConfig; -struct wmKeyMap; -struct Scene; -struct Object; -struct bContext; struct Base; -struct View3D; struct bConstraint; +struct bContext; struct bPoseChannel; +struct Curve; struct KeyBlock; struct Lattice; +struct Main; struct Mesh; -struct Curve; -struct ReportList; struct ModifierData; -struct wmOperatorType; -struct wmOperator; +struct Object; +struct ReportList; +struct Scene; +struct View3D; struct wmEvent; +struct wmKeyConfig; +struct wmKeyMap; +struct wmOperator; +struct wmOperatorType; /* object_edit.c */ struct Object *ED_object_active_context(struct bContext *C); @@ -69,10 +70,10 @@ void ED_base_object_select(struct Base *base, short mode); /* includes notifier */ void ED_base_object_activate(struct bContext *C, struct Base *base); -void ED_base_object_free_and_unlink(struct Scene *scene, struct Base *base); +void ED_base_object_free_and_unlink(struct Main *bmain, struct Scene *scene, struct Base *base); /* single object duplicate, if dupflag==0, fully linked, else it uses the flags given */ -struct Base *ED_object_add_duplicate(struct Scene *scene, struct Base *base, int dupflag); +struct Base *ED_object_add_duplicate(struct Main *bmain, struct Scene *scene, struct Base *base, int dupflag); void ED_object_parent(struct Object *ob, struct Object *parent, int type, const char *substr); @@ -97,7 +98,7 @@ int ED_object_add_generic_invoke(struct bContext *C, struct wmOperator *op, stru int ED_object_add_generic_get_opts(struct bContext *C, struct wmOperator *op, float *loc, float *rot, int *enter_editmode, unsigned int *layer); struct Object *ED_object_add_type(struct bContext *C, int type, float *loc, float *rot, int enter_editmode, unsigned int layer); -void ED_object_single_users(struct Scene *scene, int full); +void ED_object_single_users(struct Main *bmain, struct Scene *scene, int full); /* cleanup */ int object_is_libdata(struct Object *ob); @@ -116,7 +117,7 @@ void object_test_constraints(struct Object *ob); void ED_object_constraint_set_active(struct Object *ob, struct bConstraint *con); void ED_object_constraint_update(struct Object *ob); -void ED_object_constraint_dependency_update(struct Scene *scene, struct Object *ob); +void ED_object_constraint_dependency_update(struct Main *bmain, struct Scene *scene, struct Object *ob); /* object_lattice.c */ int mouse_lattice(struct bContext *C, short mval[2], int extend); @@ -132,11 +133,11 @@ enum { MODIFIER_APPLY_SHAPE, } eModifier_Apply_Mode; -struct ModifierData *ED_object_modifier_add(struct ReportList *reports, struct Scene *scene, struct Object *ob, char *name, int type); -int ED_object_modifier_remove(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct ModifierData *md); +struct ModifierData *ED_object_modifier_add(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, char *name, int type); +int ED_object_modifier_remove(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, struct ModifierData *md); int ED_object_modifier_move_down(struct ReportList *reports, struct Object *ob, struct ModifierData *md); int ED_object_modifier_move_up(struct ReportList *reports, struct Object *ob, struct ModifierData *md); -int ED_object_modifier_convert(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct ModifierData *md); +int ED_object_modifier_convert(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, struct ModifierData *md); int ED_object_modifier_apply(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct ModifierData *md, int mode); int ED_object_modifier_copy(struct ReportList *reports, struct Object *ob, struct ModifierData *md); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 1b600a26001..3d32030326f 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -961,6 +961,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr, int void do_constraint_panels(bContext *C, void *arg, int event) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); @@ -972,7 +973,7 @@ void do_constraint_panels(bContext *C, void *arg, int event) break; // no handling case B_CONSTRAINT_CHANGETARGET: if (ob->pose) ob->pose->flag |= POSE_RECALC; // checks & sorts pose channels - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); break; default: break; diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 3f943f7b1b0..4b02e4b1e65 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -979,6 +979,7 @@ void UI_make_axis_color(char *src_col, char *dst_col, char axis) /* patching UserDef struct and Themes */ void init_userdef_do_versions(void) { + Main *bmain= G.main; // countall(); /* the UserDef struct is not corrected with do_versions() .... ugh! */ @@ -1013,18 +1014,18 @@ void init_userdef_do_versions(void) if(U.flag & USER_CUSTOM_RANGE) vDM_ColorBand_store(&U.coba_weight); /* signal for derivedmesh to use colorband */ - if (G.main->versionfile <= 191) { + if (bmain->versionfile <= 191) { strcpy(U.plugtexdir, U.textudir); strcpy(U.sounddir, "/"); } /* patch to set Dupli Armature */ - if (G.main->versionfile < 220) { + if (bmain->versionfile < 220) { U.dupflag |= USER_DUP_ARM; } /* added seam, normal color, undo */ - if (G.main->versionfile <= 234) { + if (bmain->versionfile <= 234) { bTheme *btheme; U.uiflag |= USER_GLOBALUNDO; @@ -1047,12 +1048,12 @@ void init_userdef_do_versions(void) } } } - if (G.main->versionfile <= 235) { + if (bmain->versionfile <= 235) { /* illegal combo... */ if (U.flag & USER_LMOUSESELECT) U.flag &= ~USER_TWOBUTTONMOUSE; } - if (G.main->versionfile <= 236) { + if (bmain->versionfile <= 236) { bTheme *btheme; /* new space type */ for(btheme= U.themes.first; btheme; btheme= btheme->next) { @@ -1069,7 +1070,7 @@ void init_userdef_do_versions(void) } } } - if (G.main->versionfile <= 237) { + if (bmain->versionfile <= 237) { bTheme *btheme; /* bone colors */ for(btheme= U.themes.first; btheme; btheme= btheme->next) { @@ -1080,7 +1081,7 @@ void init_userdef_do_versions(void) } } } - if (G.main->versionfile <= 238) { + if (bmain->versionfile <= 238) { bTheme *btheme; /* bone colors */ for(btheme= U.themes.first; btheme; btheme= btheme->next) { @@ -1091,7 +1092,7 @@ void init_userdef_do_versions(void) } } } - if (G.main->versionfile <= 239) { + if (bmain->versionfile <= 239) { bTheme *btheme; for(btheme= U.themes.first; btheme; btheme= btheme->next) { @@ -1105,7 +1106,7 @@ void init_userdef_do_versions(void) } if(U.obcenter_dia==0) U.obcenter_dia= 6; } - if (G.main->versionfile <= 241) { + if (bmain->versionfile <= 241) { bTheme *btheme; for(btheme= U.themes.first; btheme; btheme= btheme->next) { /* Node editor theme, check for alpha==0 is safe, then color was never set */ @@ -1146,7 +1147,7 @@ void init_userdef_do_versions(void) } } - if (G.main->versionfile <= 242) { + if (bmain->versionfile <= 242) { bTheme *btheme; for(btheme= U.themes.first; btheme; btheme= btheme->next) { @@ -1164,11 +1165,11 @@ void init_userdef_do_versions(void) } } } - if (G.main->versionfile <= 243) { + if (bmain->versionfile <= 243) { /* set default number of recently-used files (if not set) */ if (U.recent_files == 0) U.recent_files = 10; } - if (G.main->versionfile < 245 || (G.main->versionfile == 245 && G.main->subversionfile < 3)) { + if (bmain->versionfile < 245 || (bmain->versionfile == 245 && bmain->subversionfile < 3)) { bTheme *btheme; for(btheme= U.themes.first; btheme; btheme= btheme->next) { SETCOL(btheme->tv3d.editmesh_active, 255, 255, 255, 128); @@ -1176,7 +1177,7 @@ void init_userdef_do_versions(void) if(U.coba_weight.tot==0) init_colorband(&U.coba_weight, 1); } - if ((G.main->versionfile < 245) || (G.main->versionfile == 245 && G.main->subversionfile < 11)) { + if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 11)) { bTheme *btheme; for (btheme= U.themes.first; btheme; btheme= btheme->next) { /* these should all use the same colour */ @@ -1189,7 +1190,7 @@ void init_userdef_do_versions(void) SETCOL(btheme->ttime.cframe, 0x60, 0xc0, 0x40, 255); } } - if ((G.main->versionfile < 245) || (G.main->versionfile == 245 && G.main->subversionfile < 13)) { + if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 13)) { bTheme *btheme; for (btheme= U.themes.first; btheme; btheme= btheme->next) { /* action channel groups (recolor anyway) */ @@ -1262,10 +1263,10 @@ void init_userdef_do_versions(void) } } } - if ((G.main->versionfile < 245) || (G.main->versionfile == 245 && G.main->subversionfile < 16)) { + if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 16)) { U.flag |= USER_ADD_VIEWALIGNED|USER_ADD_EDITMODE; } - if ((G.main->versionfile < 247) || (G.main->versionfile == 247 && G.main->subversionfile <= 2)) { + if ((bmain->versionfile < 247) || (bmain->versionfile == 247 && bmain->subversionfile <= 2)) { bTheme *btheme; /* adjust themes */ @@ -1287,7 +1288,7 @@ void init_userdef_do_versions(void) SETCOL(btheme->tseq.vertex_select, col[0], col[1], col[2], 255); } } - if (G.main->versionfile < 250) { + if (bmain->versionfile < 250) { bTheme *btheme; for(btheme= U.themes.first; btheme; btheme= btheme->next) { @@ -1328,7 +1329,7 @@ void init_userdef_do_versions(void) U.ipo_new= BEZT_IPO_BEZ; } - if (G.main->versionfile < 250 || (G.main->versionfile == 250 && G.main->subversionfile < 1)) { + if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 1)) { bTheme *btheme; for(btheme= U.themes.first; btheme; btheme= btheme->next) { @@ -1351,7 +1352,7 @@ void init_userdef_do_versions(void) } } - if (G.main->versionfile < 250 || (G.main->versionfile == 250 && G.main->subversionfile < 3)) { + if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 3)) { /* new audio system */ if(U.audiochannels == 0) U.audiochannels = 2; @@ -1369,10 +1370,10 @@ void init_userdef_do_versions(void) U.audiorate = 44100; } - if (G.main->versionfile < 250 || (G.main->versionfile == 250 && G.main->subversionfile < 5)) + if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 5)) U.gameflags |= USER_DISABLE_VBO; - if (G.main->versionfile < 250 || (G.main->versionfile == 250 && G.main->subversionfile < 8)) { + if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 8)) { wmKeyMap *km; for(km=U.keymaps.first; km; km=km->next) { @@ -1412,16 +1413,16 @@ void init_userdef_do_versions(void) strcpy(km->idname, "Property Editor"); } } - if (G.main->versionfile < 250 || (G.main->versionfile == 250 && G.main->subversionfile < 16)) { + if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 16)) { if(U.wmdrawmethod == USER_DRAW_TRIPLE) U.wmdrawmethod = USER_DRAW_AUTOMATIC; } - if (G.main->versionfile < 252 || (G.main->versionfile == 252 && G.main->subversionfile < 3)) { + if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 3)) { if (U.flag & USER_LMOUSESELECT) U.flag &= ~USER_TWOBUTTONMOUSE; } - if (G.main->versionfile < 252 || (G.main->versionfile == 252 && G.main->subversionfile < 4)) { + if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 4)) { bTheme *btheme; /* default new handle type is auto handles */ @@ -1454,7 +1455,7 @@ void init_userdef_do_versions(void) SETCOLF(btheme->tv3d.edge_crease, 0.8, 0, 0.6, 1.0); } } - if (G.main->versionfile <= 252) { + if (bmain->versionfile <= 252) { bTheme *btheme; /* init new curve colors */ @@ -1463,7 +1464,7 @@ void init_userdef_do_versions(void) SETCOL(btheme->tv3d.lastsel_point, 0xff, 0xff, 0xff, 255); } } - if (G.main->versionfile < 252 || (G.main->versionfile == 252 && G.main->subversionfile < 5)) { + if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 5)) { bTheme *btheme; /* interface_widgets.c */ diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c index cdcbb5cb461..a63f4995acc 100644 --- a/source/blender/editors/mesh/editmesh.c +++ b/source/blender/editors/mesh/editmesh.c @@ -1330,7 +1330,7 @@ static EnumPropertyItem prop_separate_types[] = { }; /* return 1: success */ -static int mesh_separate_selected(Scene *scene, Base *editbase) +static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase) { EditMesh *em, *emnew; EditVert *eve, *v1; @@ -1372,7 +1372,7 @@ static int mesh_separate_selected(Scene *scene, Base *editbase) */ /* 1 */ - basenew= ED_object_add_duplicate(scene, editbase, 0); /* 0 = fully linked */ + basenew= ED_object_add_duplicate(bmain, scene, editbase, 0); /* 0 = fully linked */ ED_base_object_select(basenew, BA_DESELECT); /* 2 */ @@ -1441,7 +1441,7 @@ static int mesh_separate_selected(Scene *scene, Base *editbase) } /* return 1: success */ -static int mesh_separate_material(Scene *scene, Base *editbase) +static int mesh_separate_material(Main *bmain, Scene *scene, Base *editbase) { Mesh *me= editbase->object->data; EditMesh *em= BKE_mesh_get_editmesh(me); @@ -1453,7 +1453,7 @@ static int mesh_separate_material(Scene *scene, Base *editbase) /* select the material */ EM_select_by_material(em, curr_mat); /* and now separate */ - if(0==mesh_separate_selected(scene, editbase)) { + if(0==mesh_separate_selected(bmain, scene, editbase)) { BKE_mesh_end_editmesh(me, em); return 0; } @@ -1464,7 +1464,7 @@ static int mesh_separate_material(Scene *scene, Base *editbase) } /* return 1: success */ -static int mesh_separate_loose(Scene *scene, Base *editbase) +static int mesh_separate_loose(Main *bmain, Scene *scene, Base *editbase) { Mesh *me; EditMesh *em; @@ -1504,7 +1504,7 @@ static int mesh_separate_loose(Scene *scene, Base *editbase) tot= BLI_countlist(&em->verts); /* and now separate */ - doit= mesh_separate_selected(scene, editbase); + doit= mesh_separate_selected(bmain, scene, editbase); /* with hidden verts this can happen */ if(tot == BLI_countlist(&em->verts)) @@ -1518,16 +1518,17 @@ static int mesh_separate_loose(Scene *scene, Base *editbase) static int mesh_separate_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Base *base= CTX_data_active_base(C); int retval= 0, type= RNA_enum_get(op->ptr, "type"); if(type == 0) - retval= mesh_separate_selected(scene, base); + retval= mesh_separate_selected(bmain, scene, base); else if(type == 1) - retval= mesh_separate_material (scene, base); + retval= mesh_separate_material(bmain, scene, base); else if(type == 2) - retval= mesh_separate_loose(scene, base); + retval= mesh_separate_loose(bmain, scene, base); if(retval) { WM_event_add_notifier(C, NC_GEOM|ND_DATA, base->object->data); diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 87b5c886b4a..47b7b89ff7a 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -92,6 +92,7 @@ return 0 if no join is made (error) and 1 of the join is done */ int join_mesh_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); Material **matar, *ma; @@ -443,7 +444,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) /* free base, now that data is merged */ if(base->object != ob) - ED_base_object_free_and_unlink(scene, base); + ED_base_object_free_and_unlink(bmain, scene, base); } } CTX_DATA_END; @@ -503,17 +504,17 @@ int join_mesh_exec(bContext *C, wmOperator *op) /* free it's ipo too - both are not actually freed from memory yet as ID-blocks */ if(nkey->ipo) { free_ipo(nkey->ipo); - BLI_remlink(&G.main->ipo, nkey->ipo); + BLI_remlink(&bmain->ipo, nkey->ipo); MEM_freeN(nkey->ipo); } #endif free_key(nkey); - BLI_remlink(&G.main->key, nkey); + BLI_remlink(&bmain->key, nkey); MEM_freeN(nkey); } - DAG_scene_sort(scene); // removed objects, need to rebuild dag before editmode call + DAG_scene_sort(bmain, scene); // removed objects, need to rebuild dag before editmode call ED_object_enter_editmode(C, EM_WAITCURSOR); ED_object_exit_editmode(C, EM_FREEDATA|EM_WAITCURSOR|EM_DO_UNDO); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 50851b57a65..67cae8d4155 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -284,6 +284,7 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, floa /* for object add primitive operators */ Object *ED_object_add_type(bContext *C, int type, float *loc, float *rot, int enter_editmode, unsigned int layer) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob; @@ -300,8 +301,8 @@ Object *ED_object_add_type(bContext *C, int type, float *loc, float *rot, int en /* more editor stuff */ ED_object_base_init_transform(C, BASACT, loc, rot); - DAG_scene_sort(scene); - ED_render_id_flush_update(G.main, ob->data); + DAG_scene_sort(bmain, scene); + ED_render_id_flush_update(bmain, ob->data); if(enter_editmode) ED_object_enter_editmode(C, EM_IGNORE_LAYER); @@ -750,6 +751,8 @@ static int group_instance_add_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; if(group) { + Main *bmain= CTX_data_main(C); + Scene *scene= CTX_data_scene(C); Object *ob= ED_object_add_type(C, OB_EMPTY, loc, rot, FALSE, layer); rename_id(&ob->id, group->id.name+2); ob->dup_group= group; @@ -757,7 +760,7 @@ static int group_instance_add_exec(bContext *C, wmOperator *op) id_lib_extern(&group->id); /* works without this except if you try render right after, see: 22027 */ - DAG_scene_sort(CTX_data_scene(C)); + DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, CTX_data_scene(C)); @@ -797,16 +800,17 @@ void OBJECT_OT_group_instance_add(wmOperatorType *ot) /* remove base from a specific scene */ /* note: now unlinks constraints as well */ -void ED_base_object_free_and_unlink(Scene *scene, Base *base) +void ED_base_object_free_and_unlink(Main *bmain, Scene *scene, Base *base) { BLI_remlink(&scene->base, base); - free_libblock_us(&G.main->object, base->object); + free_libblock_us(&bmain->object, base->object); if(scene->basact==base) scene->basact= NULL; MEM_freeN(base); } static int object_delete_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); int islamp= 0; @@ -817,14 +821,14 @@ static int object_delete_exec(bContext *C, wmOperator *op) if(base->object->type==OB_LAMP) islamp= 1; /* remove from current scene only */ - ED_base_object_free_and_unlink(scene, base); + ED_base_object_free_and_unlink(bmain, scene, base); } CTX_DATA_END; if(islamp) reshadeall_displist(scene); /* only frees displist */ - DAG_scene_sort(scene); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, scene); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, CTX_data_scene(C)); @@ -859,6 +863,7 @@ static void copy_object__forwardModifierLinks(void *userData, Object *ob, /* after copying objects, copied data should get new pointers */ static void copy_object_set_idnew(bContext *C, int dupflag) { + Main *bmain= CTX_data_main(C); Material *ma, *mao; ID *id; int a; @@ -881,7 +886,7 @@ static void copy_object_set_idnew(bContext *C, int dupflag) /* materials */ if( dupflag & USER_DUP_MAT) { - mao= G.main->mat.first; + mao= bmain->mat.first; while(mao) { if(mao->id.newid) { @@ -915,7 +920,7 @@ static void copy_object_set_idnew(bContext *C, int dupflag) #if 0 // XXX old animation system /* lamps */ if( dupflag & USER_DUP_IPO) { - Lamp *la= G.main->lamp.first; + Lamp *la= bmain->lamp.first; while(la) { if(la->id.newid) { Lamp *lan= (Lamp *)la->id.newid; @@ -931,7 +936,7 @@ static void copy_object_set_idnew(bContext *C, int dupflag) } /* ipos */ - ipo= G.main->ipo.first; + ipo= bmain->ipo.first; while(ipo) { if(ipo->id.lib==NULL && ipo->id.newid) { Ipo *ipon= (Ipo *)ipo->id.newid; @@ -1000,6 +1005,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base) static int object_duplicates_make_real_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); clear_id_newpoins(); @@ -1009,8 +1015,8 @@ static int object_duplicates_make_real_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(scene); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, scene); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SCENE, scene); WM_main_add_notifier(NC_OBJECT|ND_DRAW, NULL); @@ -1089,6 +1095,7 @@ static Base *duplibase_for_convert(Scene *scene, Base *base, Object *ob) static int convert_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Base *basen=NULL, *basact=NULL, *basedel=NULL; Object *ob, *ob1, *newob, *obact= CTX_data_active_object(C); @@ -1214,7 +1221,7 @@ static int convert_exec(bContext *C, wmOperator *op) if (!keep_original) { /* other users */ if(cu->id.us>1) { - for(ob1= G.main->object.first; ob1; ob1=ob1->id.next) { + for(ob1= bmain->object.first; ob1; ob1=ob1->id.next) { if(ob1->data==ob->data) { ob1->type= OB_CURVE; ob1->recalc |= OB_RECALC_ALL; @@ -1321,7 +1328,7 @@ static int convert_exec(bContext *C, wmOperator *op) /* delete original if needed */ if(basedel) { if(!keep_original) - ED_base_object_free_and_unlink(scene, basedel); + ED_base_object_free_and_unlink(bmain, scene, basedel); basedel = NULL; } @@ -1337,13 +1344,13 @@ static int convert_exec(bContext *C, wmOperator *op) base= base->next; if (ob->type == OB_MBALL) { - ED_base_object_free_and_unlink(scene, tmpbase); + ED_base_object_free_and_unlink(bmain, scene, tmpbase); } } } /* delete object should renew depsgraph */ - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } // XXX ED_object_enter_editmode(C, 0); @@ -1357,7 +1364,7 @@ static int convert_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER|ND_DATA, BASACT->object); } - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_SCENE|NC_OBJECT|ND_DRAW, scene); /* is NC_SCENE needed ? */ return OPERATOR_FINISHED; @@ -1394,7 +1401,7 @@ void OBJECT_OT_convert(wmOperatorType *ot) /* used below, assumes id.new is correct */ /* leaves selection of base/object unaltered */ -static Base *object_add_duplicate_internal(Scene *scene, Base *base, int dupflag) +static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base, int dupflag) { Base *basen= NULL; Material ***matarar; @@ -1417,7 +1424,7 @@ static Base *object_add_duplicate_internal(Scene *scene, Base *base, int dupflag if(basen->flag & OB_FROMGROUP) { Group *group; - for(group= G.main->group.first; group; group= group->id.next) { + for(group= bmain->group.first; group; group= group->id.next) { if(object_in_group(ob, group)) add_to_group(group, obn, scene, basen); } @@ -1596,7 +1603,7 @@ static Base *object_add_duplicate_internal(Scene *scene, Base *base, int dupflag /* single object duplicate, if dupflag==0, fully linked, else it uses the flags given */ /* leaves selection of base/object unaltered */ -Base *ED_object_add_duplicate(Scene *scene, Base *base, int dupflag) +Base *ED_object_add_duplicate(Main *bmain, Scene *scene, Base *base, int dupflag) { Base *basen; Object *ob; @@ -1604,15 +1611,15 @@ Base *ED_object_add_duplicate(Scene *scene, Base *base, int dupflag) clear_id_newpoins(); clear_sca_new_poins(); /* sensor/contr/act */ - basen= object_add_duplicate_internal(scene, base, dupflag); + basen= object_add_duplicate_internal(bmain, scene, base, dupflag); if (basen == NULL) { return NULL; } ob= basen->object; - DAG_scene_sort(scene); - ED_render_id_flush_update(G.main, ob->data); + DAG_scene_sort(bmain, scene); + ED_render_id_flush_update(bmain, ob->data); return basen; } @@ -1620,6 +1627,7 @@ Base *ED_object_add_duplicate(Scene *scene, Base *base, int dupflag) /* contextual operator dupli */ static int duplicate_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); int linked= RNA_boolean_get(op->ptr, "linked"); int dupflag= (linked)? 0: U.dupflag; @@ -1628,7 +1636,7 @@ static int duplicate_exec(bContext *C, wmOperator *op) clear_sca_new_poins(); /* sensor/contr/act */ CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { - Base *basen= object_add_duplicate_internal(scene, base, dupflag); + Base *basen= object_add_duplicate_internal(bmain, scene, base, dupflag); /* note that this is safe to do with this context iterator, the list is made in advance */ @@ -1642,14 +1650,14 @@ static int duplicate_exec(bContext *C, wmOperator *op) if(BASACT==base) ED_base_object_activate(C, basen); - ED_render_id_flush_update(G.main, basen->object->data); + ED_render_id_flush_update(bmain, basen->object->data); } CTX_DATA_END; copy_object_set_idnew(C, dupflag); - DAG_scene_sort(scene); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, scene); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); @@ -1697,6 +1705,7 @@ static int add_named_poll(bContext *C) static int add_named_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Base *basen, *base; Object *ob; @@ -1718,7 +1727,7 @@ static int add_named_exec(bContext *C, wmOperator *op) clear_id_newpoins(); clear_sca_new_poins(); /* sensor/contr/act */ - basen= object_add_duplicate_internal(scene, base, dupflag); + basen= object_add_duplicate_internal(bmain, scene, base, dupflag); if (basen == NULL) { MEM_freeN(base); @@ -1732,8 +1741,8 @@ static int add_named_exec(bContext *C, wmOperator *op) copy_object_set_idnew(C, dupflag); - DAG_scene_sort(scene); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, scene); + DAG_ids_flush_update(bmain, 0); MEM_freeN(base); diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index b1dc41531ef..8f83a412c96 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -779,12 +779,12 @@ void ED_object_constraint_update(Object *ob) else DAG_id_flush_update(&ob->id, OB_RECALC_OB); } -void ED_object_constraint_dependency_update(Scene *scene, Object *ob) +void ED_object_constraint_dependency_update(Main *bmain, Scene *scene, Object *ob) { ED_object_constraint_update(ob); if(ob->pose) ob->pose->flag |= POSE_RECALC; // checks & sorts pose channels - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } static int constraint_poll(bContext *C) @@ -931,8 +931,9 @@ void CONSTRAINT_OT_move_up (wmOperatorType *ot) static int pose_constraints_clear_exec(bContext *C, wmOperator *op) { - Object *ob= CTX_data_active_object(C); + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); + Object *ob= CTX_data_active_object(C); /* free constraints for all selected bones */ CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones) @@ -943,7 +944,7 @@ static int pose_constraints_clear_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* force depsgraph to get recalculated since relationships removed */ - DAG_scene_sort(scene); /* sort order of objects */ + DAG_scene_sort(bmain, scene); /* sort order of objects */ /* do updates */ DAG_id_flush_update(&ob->id, OB_RECALC_DATA); @@ -967,6 +968,7 @@ void POSE_OT_constraints_clear(wmOperatorType *ot) static int object_constraints_clear_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); /* do freeing */ @@ -978,7 +980,7 @@ static int object_constraints_clear_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* force depsgraph to get recalculated since relationships removed */ - DAG_scene_sort(scene); /* sort order of objects */ + DAG_scene_sort(bmain, scene); /* sort order of objects */ /* do updates */ WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, NULL); @@ -1002,8 +1004,9 @@ void OBJECT_OT_constraints_clear(wmOperatorType *ot) static int pose_constraint_copy_exec(bContext *C, wmOperator *op) { - bPoseChannel *pchan = CTX_data_active_pose_bone(C); + Main *bmain= CTX_data_main(C); Scene *scene = CTX_data_scene(C); + bPoseChannel *pchan = CTX_data_active_pose_bone(C); /* don't do anything if bone doesn't exist or doesn't have any constraints */ if (ELEM(NULL, pchan, pchan->constraints.first)) { @@ -1021,7 +1024,7 @@ static int pose_constraint_copy_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* force depsgraph to get recalculated since new relationships added */ - DAG_scene_sort(scene); /* sort order of objects/bones */ + DAG_scene_sort(bmain, scene); /* sort order of objects/bones */ return OPERATOR_FINISHED; } @@ -1043,8 +1046,9 @@ void POSE_OT_constraints_copy(wmOperatorType *ot) static int object_constraint_copy_exec(bContext *C, wmOperator *op) { - Object *obact = ED_object_active_context(C); + Main *bmain= CTX_data_main(C); Scene *scene = CTX_data_scene(C); + Object *obact = ED_object_active_context(C); /* copy all constraints from active object to all selected objects */ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) @@ -1056,7 +1060,7 @@ static int object_constraint_copy_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* force depsgraph to get recalculated since new relationships added */ - DAG_scene_sort(scene); /* sort order of objects */ + DAG_scene_sort(bmain, scene); /* sort order of objects */ return OPERATOR_FINISHED; } @@ -1219,6 +1223,7 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o /* used by add constraint operators to add the constraint required */ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase *list, int type, short setTarget) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); bPoseChannel *pchan; bConstraint *con; @@ -1316,7 +1321,7 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase /* force depsgraph to get recalculated since new relationships added */ - DAG_scene_sort(scene); /* sort order of objects */ + DAG_scene_sort(bmain, scene); /* sort order of objects */ if ((ob->type==OB_ARMATURE) && (pchan)) { ob->pose->flag |= POSE_RECALC; /* sort pose channels */ diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 0d3ebc7f669..18da264336e 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -137,6 +137,7 @@ Object *ED_object_active_context(bContext *C) /* ********* clear/set restrict view *********/ static int object_hide_view_clear_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); ScrArea *sa= CTX_wm_area(C); View3D *v3d= sa->spacedata.first; Scene *scene= CTX_data_scene(C); @@ -153,7 +154,7 @@ static int object_hide_view_clear_exec(bContext *C, wmOperator *op) } } if (changed) { - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); } @@ -178,6 +179,7 @@ void OBJECT_OT_hide_view_clear(wmOperatorType *ot) static int object_hide_view_set_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); short changed = 0; int unselected= RNA_boolean_get(op->ptr, "unselected"); @@ -204,7 +206,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op) CTX_DATA_END; if (changed) { - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C)); @@ -965,144 +967,6 @@ void special_editmenu(Scene *scene, View3D *v3d) } -/* Change subdivision or particle properties of mesh object ob, if level==-1 - * then toggle subsurf, else set to level set allows to toggle multiple - * selections */ - -static void object_has_subdivision_particles(Object *ob, int *havesubdiv, int *havepart, int depth) -{ - if(ob->type==OB_MESH) { - if(modifiers_findByType(ob, eModifierType_Subsurf)) - *havesubdiv= 1; - if(modifiers_findByType(ob, eModifierType_ParticleSystem)) - *havepart= 1; - } - - if(ob->dup_group && depth <= 4) { - GroupObject *go; - - for(go= ob->dup_group->gobject.first; go; go= go->next) - object_has_subdivision_particles(go->ob, havesubdiv, havepart, depth+1); - } -} - -static void object_flip_subdivison_particles(Scene *scene, Object *ob, int *set, int level, int mode, int particles, int depth) -{ - ModifierData *md; - - if(ob->type==OB_MESH) { - if(particles) { - for(md=ob->modifiers.first; md; md=md->next) { - if(md->type == eModifierType_ParticleSystem) { - ParticleSystemModifierData *psmd = (ParticleSystemModifierData*)md; - - if(*set == -1) - *set= psmd->modifier.mode&(mode); - - if (*set) - psmd->modifier.mode &= ~(mode); - else - psmd->modifier.mode |= (mode); - } - } - } - else { - md = modifiers_findByType(ob, eModifierType_Subsurf); - - if (md) { - SubsurfModifierData *smd = (SubsurfModifierData*) md; - - if (level == -1) { - if(*set == -1) - *set= smd->modifier.mode&(mode); - - if (*set) - smd->modifier.mode &= ~(mode); - else - smd->modifier.mode |= (mode); - } else { - smd->levels = level; - } - } - else if(depth == 0 && *set != 0) { - SubsurfModifierData *smd = (SubsurfModifierData*) modifier_new(eModifierType_Subsurf); - - BLI_addtail(&ob->modifiers, smd); - modifier_unique_name(&ob->modifiers, (ModifierData*)smd); - - if (level!=-1) { - smd->levels = level; - } - - if(*set == -1) - *set= 1; - } - } - - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); - } - - if(ob->dup_group && depth<=4) { - GroupObject *go; - - for(go= ob->dup_group->gobject.first; go; go= go->next) - object_flip_subdivison_particles(scene, go->ob, set, level, mode, particles, depth+1); - } -} - -/* Change subdivision properties of mesh object ob, if -* level==-1 then toggle subsurf, else set to level. -*/ - -void flip_subdivison(Scene *scene, View3D *v3d, int level) -{ - Base *base; - int set= -1; - int mode, pupmode, particles= 0, havesubdiv= 0, havepart= 0; - int alt= 0; // XXX - - if(alt) - mode= eModifierMode_Realtime; - else - mode= eModifierMode_Render|eModifierMode_Realtime; - - if(level == -1) { - if (scene->obedit) { // XXX get from context - object_has_subdivision_particles(scene->obedit, &havesubdiv, &havepart, 0); - } else { - for(base= scene->base.first; base; base= base->next) { - if(((level==-1) && (TESTBASE(v3d, base))) || (TESTBASELIB(v3d, base))) { - object_has_subdivision_particles(base->object, &havesubdiv, &havepart, 0); - } - } - } - } - else - havesubdiv= 1; - - if(havesubdiv && havepart) { - pupmode= pupmenu("Switch%t|Subsurf %x1|Particle Systems %x2"); - if(pupmode <= 0) - return; - else if(pupmode == 2) - particles= 1; - } - else if(havepart) - particles= 1; - - if (scene->obedit) { // XXX get from context - object_flip_subdivison_particles(scene, scene->obedit, &set, level, mode, particles, 0); - } else { - for(base= scene->base.first; base; base= base->next) { - if(((level==-1) && (TESTBASE(v3d, base))) || (TESTBASELIB(v3d, base))) { - object_flip_subdivison_particles(scene, base->object, &set, level, mode, particles, 0); - } - } - } - - DAG_ids_flush_update(0); -} - static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob) { //XXX no longer used - to be removed - replaced by game_properties_copy_exec @@ -1197,7 +1061,7 @@ static void copymenu_logicbricks(Scene *scene, View3D *v3d, Object *ob) } } -static void copymenu_modifiers(Scene *scene, View3D *v3d, Object *ob) +static void copymenu_modifiers(Main *bmain, Scene *scene, View3D *v3d, Object *ob) { Base *base; int i, event; @@ -1296,7 +1160,7 @@ static void copymenu_modifiers(Scene *scene, View3D *v3d, Object *ob) // if(errorstr) notice(errorstr); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } @@ -1344,7 +1208,7 @@ static void copy_texture_space(Object *to, Object *ob) } -void copy_attr(Scene *scene, View3D *v3d, short event) +void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event) { Object *ob; Base *base; @@ -1369,7 +1233,7 @@ void copy_attr(Scene *scene, View3D *v3d, short event) return; } else if(event==24) { - copymenu_modifiers(scene, v3d, ob); + copymenu_modifiers(bmain, scene, v3d, ob); return; } @@ -1587,12 +1451,12 @@ void copy_attr(Scene *scene, View3D *v3d, short event) } if(do_scene_sort) - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); } -void copy_attr_menu(Scene *scene, View3D *v3d) +void copy_attr_menu(Main *bmain, Scene *scene, View3D *v3d) { Object *ob; short event; @@ -1643,7 +1507,7 @@ void copy_attr_menu(Scene *scene, View3D *v3d) event= pupmenu(str); if(event<= 0) return; - copy_attr(scene, v3d, event); + copy_attr(bmain, scene, v3d, event); } /* ********************************************** */ diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c index ba609bd9bb3..b0a6c6471a2 100644 --- a/source/blender/editors/object/object_group.c +++ b/source/blender/editors/object/object_group.c @@ -60,6 +60,7 @@ static int objects_add_active_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob= OBACT; Group *group; @@ -70,7 +71,7 @@ static int objects_add_active_exec(bContext *C, wmOperator *op) /* linking to same group requires its own loop so we can avoid looking up the active objects groups each time */ - for(group= G.main->group.first; group; group=group->id.next) { + for(group= bmain->group.first; group; group=group->id.next) { if(object_in_group(ob, group)) { /* Assign groups to selected objects */ CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { @@ -83,7 +84,7 @@ static int objects_add_active_exec(bContext *C, wmOperator *op) if(!ok) BKE_report(op->reports, RPT_ERROR, "Active Object contains no groups"); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_GROUP|NA_EDITED, NULL); return OPERATOR_FINISHED; @@ -106,6 +107,7 @@ void GROUP_OT_objects_add_active(wmOperatorType *ot) static int objects_remove_active_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob= OBACT; Group *group; @@ -116,7 +118,7 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op) /* linking to same group requires its own loop so we can avoid looking up the active objects groups each time */ - for(group= G.main->group.first; group; group=group->id.next) { + for(group= bmain->group.first; group; group=group->id.next) { if(object_in_group(ob, group)) { /* Assign groups to selected objects */ CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { @@ -129,7 +131,7 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op) if(!ok) BKE_report(op->reports, RPT_ERROR, "Active Object contains no groups"); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_GROUP|NA_EDITED, NULL); return OPERATOR_FINISHED; @@ -152,6 +154,7 @@ void GROUP_OT_objects_remove_active(wmOperatorType *ot) static int group_objects_remove_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Group *group= NULL; @@ -162,7 +165,7 @@ static int group_objects_remove_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_GROUP|NA_EDITED, NULL); return OPERATOR_FINISHED; @@ -185,6 +188,7 @@ void GROUP_OT_objects_remove(wmOperatorType *ot) static int group_create_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Group *group= NULL; char name[32]; /* id name */ @@ -198,7 +202,7 @@ static int group_create_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_GROUP|NA_EDITED, NULL); return OPERATOR_FINISHED; diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index 88e463039a1..fefefae586c 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -45,6 +45,7 @@ #include "BKE_context.h" #include "BKE_customdata.h" #include "BKE_depsgraph.h" +#include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_object.h" @@ -413,7 +414,7 @@ static Object *add_hook_object_new(Scene *scene, Object *obedit) return ob; } -static void add_hook_object(Scene *scene, Object *obedit, Object *ob, int mode) +static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *ob, int mode) { ModifierData *md=NULL; HookModifierData *hmd = NULL; @@ -459,11 +460,12 @@ static void add_hook_object(Scene *scene, Object *obedit, Object *ob, int mode) mul_serie_m4(hmd->parentinv, ob->imat, obedit->obmat, NULL, NULL, NULL, NULL, NULL, NULL); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } static int object_add_hook_selob_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *obedit = CTX_data_edit_object(C); Object *obsel=NULL; @@ -482,7 +484,7 @@ static int object_add_hook_selob_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - add_hook_object(scene, obedit, obsel, OBJECT_ADDHOOK_SELOB); + add_hook_object(bmain, scene, obedit, obsel, OBJECT_ADDHOOK_SELOB); WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, obedit); return OPERATOR_FINISHED; @@ -505,10 +507,11 @@ void OBJECT_OT_hook_add_selobj(wmOperatorType *ot) static int object_add_hook_newob_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *obedit = CTX_data_edit_object(C); - add_hook_object(scene, obedit, NULL, OBJECT_ADDHOOK_NEWOB); + add_hook_object(bmain, scene, obedit, NULL, OBJECT_ADDHOOK_NEWOB); WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, obedit); diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 0661b675668..a54ed9bd239 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -53,6 +53,7 @@ #include "BKE_global.h" #include "BKE_key.h" #include "BKE_lattice.h" +#include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_multires.h" @@ -77,7 +78,7 @@ /******************************** API ****************************/ -ModifierData *ED_object_modifier_add(ReportList *reports, Scene *scene, Object *ob, char *name, int type) +ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *scene, Object *ob, char *name, int type) { ModifierData *md=NULL, *new_md=NULL; ModifierTypeInfo *mti = modifierType_getInfo(type); @@ -129,10 +130,10 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Scene *scene, Object * ob->pd= object_add_collision_fields(0); ob->pd->deflect= 1; - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } else if(type == eModifierType_Surface) - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } DAG_id_flush_update(&ob->id, OB_RECALC_DATA); @@ -140,7 +141,7 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Scene *scene, Object * return new_md; } -int ED_object_modifier_remove(ReportList *reports, Scene *scene, Object *ob, ModifierData *md) +int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Object *ob, ModifierData *md) { ModifierData *obmd; @@ -175,13 +176,13 @@ int ED_object_modifier_remove(ReportList *reports, Scene *scene, Object *ob, Mod if(ob->pd) ob->pd->deflect= 0; - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } else if(md->type == eModifierType_Surface) { if(ob->pd && ob->pd->shape == PFIELD_SHAPE_SURFACE) ob->pd->shape = PFIELD_SHAPE_PLANE; - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } else if(md->type == eModifierType_Smoke) { ob->dt = OB_TEXTURE; @@ -243,7 +244,7 @@ int ED_object_modifier_move_down(ReportList *reports, Object *ob, ModifierData * return 1; } -int ED_object_modifier_convert(ReportList *reports, Scene *scene, Object *ob, ModifierData *md) +int ED_object_modifier_convert(ReportList *reports, Main *bmain, Scene *scene, Object *ob, ModifierData *md) { Object *obn; ParticleSystem *psys; @@ -341,7 +342,7 @@ int ED_object_modifier_convert(ReportList *reports, Scene *scene, Object *ob, Mo } } - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); return 1; } @@ -500,11 +501,12 @@ int ED_object_modifier_copy(ReportList *reports, Object *ob, ModifierData *md) static int modifier_add_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); int type= RNA_enum_get(op->ptr, "type"); - if(!ED_object_modifier_add(op->reports, scene, ob, NULL, type)) + if(!ED_object_modifier_add(op->reports, bmain, scene, ob, NULL, type)) return OPERATOR_CANCELLED; WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); @@ -626,11 +628,12 @@ static ModifierData *edit_modifier_property_get(bContext *C, wmOperator *op, Obj static int modifier_remove_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); ModifierData *md = edit_modifier_property_get(C, op, ob, 0); - if(!ob || !md || !ED_object_modifier_remove(op->reports, scene, ob, md)) + if(!ob || !md || !ED_object_modifier_remove(op->reports, bmain, scene, ob, md)) return OPERATOR_CANCELLED; WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); @@ -792,11 +795,12 @@ void OBJECT_OT_modifier_apply(wmOperatorType *ot) static int modifier_convert_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); ModifierData *md = edit_modifier_property_get(C, op, ob, 0); - if(!ob || !md || !ED_object_modifier_convert(op->reports, scene, ob, md)) + if(!ob || !md || !ED_object_modifier_convert(op->reports, bmain, scene, ob, md)) return OPERATOR_CANCELLED; DAG_id_flush_update(&ob->id, OB_RECALC_DATA); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 8d488eeabac..463db871f55 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -97,6 +97,7 @@ static int vertex_parent_set_poll(bContext *C) static int vertex_parent_set_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); EditVert *eve; @@ -230,7 +231,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_OBJECT, NULL); @@ -295,6 +296,7 @@ static int make_proxy_invoke (bContext *C, wmOperator *op, wmEvent *evt) static int make_proxy_exec (bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Object *ob, *gob= CTX_data_active_object(C); GroupObject *go; Scene *scene= CTX_data_scene(C); @@ -338,7 +340,7 @@ static int make_proxy_exec (bContext *C, wmOperator *op) object_make_proxy(newob, ob, gob); /* depsgraph flushes are needed for the new data */ - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); DAG_id_flush_update(&newob->id, OB_RECALC_ALL); WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, newob); } @@ -413,6 +415,8 @@ static EnumPropertyItem prop_clear_parent_types[] = { /* note, poll should check for editable scene */ static int parent_clear_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); + Scene *scene= CTX_data_scene(C); int type= RNA_enum_get(op->ptr, "type"); CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { @@ -431,8 +435,8 @@ static int parent_clear_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(CTX_data_scene(C)); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, scene); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -517,6 +521,7 @@ void ED_object_parent(Object *ob, Object *par, int type, const char *substr) static int parent_set_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *par= CTX_data_active_object(C); bPoseChannel *pchan= NULL; @@ -594,15 +599,15 @@ static int parent_set_exec(bContext *C, wmOperator *op) switch (partype) { case PAR_CURVE: /* curve deform */ - md= ED_object_modifier_add(op->reports, scene, ob, NULL, eModifierType_Curve); + md= ED_object_modifier_add(op->reports, bmain, scene, ob, NULL, eModifierType_Curve); ((CurveModifierData *)md)->object= par; break; case PAR_LATTICE: /* lattice deform */ - md= ED_object_modifier_add(op->reports, scene, ob, NULL, eModifierType_Lattice); + md= ED_object_modifier_add(op->reports, bmain, scene, ob, NULL, eModifierType_Lattice); ((LatticeModifierData *)md)->object= par; break; default: /* armature deform */ - md= ED_object_modifier_add(op->reports, scene, ob, NULL, eModifierType_Armature); + md= ED_object_modifier_add(op->reports, bmain, scene, ob, NULL, eModifierType_Armature); ((ArmatureModifierData *)md)->object= par; break; } @@ -657,8 +662,8 @@ static int parent_set_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(scene); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, scene); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -719,6 +724,7 @@ void OBJECT_OT_parent_set(wmOperatorType *ot) static int parent_noinv_set_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Object *par= CTX_data_active_object(C); par->recalc |= OB_RECALC_OB; @@ -745,8 +751,8 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(CTX_data_scene(C)); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, CTX_data_scene(C)); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -772,6 +778,7 @@ void OBJECT_OT_parent_no_inverse_set(wmOperatorType *ot) static int object_slow_parent_clear_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { @@ -786,7 +793,7 @@ static int object_slow_parent_clear_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SCENE, scene); return OPERATOR_FINISHED; @@ -813,6 +820,7 @@ void OBJECT_OT_slow_parent_clear(wmOperatorType *ot) static int object_slow_parent_set_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { @@ -824,7 +832,7 @@ static int object_slow_parent_set_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SCENE, scene); return OPERATOR_FINISHED; @@ -858,6 +866,8 @@ static EnumPropertyItem prop_clear_track_types[] = { /* note, poll should check for editable scene */ static int object_track_clear_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); + Scene *scene= CTX_data_scene(C); int type= RNA_enum_get(op->ptr, "type"); if(CTX_data_edit_object(C)) { @@ -883,8 +893,8 @@ static int object_track_clear_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_ids_flush_update(0); - DAG_scene_sort(CTX_data_scene(C)); + DAG_ids_flush_update(bmain, 0); + DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -920,6 +930,7 @@ static EnumPropertyItem prop_make_track_types[] = { static int track_set_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *obact= CTX_data_active_object(C); @@ -987,8 +998,8 @@ static int track_set_exec(bContext *C, wmOperator *op) CTX_DATA_END; } - DAG_scene_sort(scene); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, scene); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -1057,6 +1068,7 @@ static int move_to_layer_invoke(bContext *C, wmOperator *op, wmEvent *event) static int move_to_layer_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); View3D *v3d= CTX_wm_view3d(C); unsigned int lay, local; @@ -1097,7 +1109,7 @@ static int move_to_layer_exec(bContext *C, wmOperator *op) /* warning, active object may be hidden now */ WM_event_add_notifier(C, NC_SCENE|NC_OBJECT|ND_DRAW, scene); /* is NC_SCENE needed ? */ - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); return OPERATOR_FINISHED; } @@ -1123,10 +1135,10 @@ void OBJECT_OT_move_to_layer(wmOperatorType *ot) /************************** Link to Scene Operator *****************************/ -void link_to_scene(unsigned short nr) +void link_to_scene(Main *bmain, unsigned short nr) { #if 0 - Scene *sce= (Scene*) BLI_findlink(&G.main->scene, G.curscreen->scenenr-1); + Scene *sce= (Scene*) BLI_findlink(&bmain->scene, G.curscreen->scenenr-1); Base *base, *nbase; if(sce==0) return; @@ -1146,6 +1158,7 @@ void link_to_scene(unsigned short nr) static int make_links_scene_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene_to= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene")); if(scene_to==NULL) { @@ -1174,7 +1187,7 @@ static int make_links_scene_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); /* one day multiple scenes will be visible, then we should have some update function for them */ return OPERATOR_FINISHED; @@ -1214,6 +1227,7 @@ static int allow_make_links_data(int ev, Object *ob, Object *obt) static int make_links_data_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); int event = RNA_int_get(op->ptr, "type"); Object *ob; ID *id; @@ -1266,7 +1280,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C)); return OPERATOR_FINISHED; } @@ -1396,7 +1410,7 @@ void new_id_matar(Material **matar, int totcol) } } -void single_obdata_users(Scene *scene, int flag) +void single_obdata_users(Main *bmain, Scene *scene, int flag) { Object *ob; Lamp *la; @@ -1512,7 +1526,7 @@ void single_obdata_users(Scene *scene, int flag) } } - me= G.main->mesh.first; + me= bmain->mesh.first; while(me) { ID_NEW(me->texcomesh); me= me->id.next; @@ -1610,10 +1624,9 @@ void do_single_tex_user(Tex **from) } } -void single_tex_users_expand() +void single_tex_users_expand(Main *bmain) { /* only when 'parent' blocks are LIB_NEW */ - Main *bmain= G.main; Material *ma; Lamp *la; World *wo; @@ -1650,10 +1663,9 @@ void single_tex_users_expand() } } -static void single_mat_users_expand(void) +static void single_mat_users_expand(Main *bmain) { /* only when 'parent' blocks are LIB_NEW */ - Main *bmain= G.main; Object *ob; Mesh *me; Curve *cu; @@ -1686,14 +1698,14 @@ static void single_mat_users_expand(void) } /* used for copying scenes */ -void ED_object_single_users(Scene *scene, int full) +void ED_object_single_users(Main *bmain, Scene *scene, int full) { single_object_users(scene, NULL, 0); if(full) { - single_obdata_users(scene, 0); - single_mat_users_expand(); - single_tex_users_expand(); + single_obdata_users(bmain, scene, 0); + single_mat_users_expand(bmain); + single_tex_users_expand(bmain); } clear_id_newpoins(); @@ -1828,6 +1840,7 @@ void OBJECT_OT_make_local(wmOperatorType *ot) static int make_single_user_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); View3D *v3d= CTX_wm_view3d(C); /* ok if this is NULL */ int flag= RNA_enum_get(op->ptr, "type"); /* 0==ALL, SELECTED==selected objecs */ @@ -1836,7 +1849,7 @@ static int make_single_user_exec(bContext *C, wmOperator *op) single_object_users(scene, v3d, flag); if(RNA_boolean_get(op->ptr, "obdata")) - single_obdata_users(scene, flag); + single_obdata_users(bmain, scene, flag); if(RNA_boolean_get(op->ptr, "material")) single_mat_users(scene, flag, FALSE); @@ -1885,6 +1898,7 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot) static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *event) { + Main *bmain= CTX_data_main(C); Base *base= ED_view3d_give_base_under_cursor(C, event->mval); Material *ma; char name[32]; @@ -1896,7 +1910,7 @@ static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *even assign_material(base->object, ma, 1); - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C)); return OPERATOR_FINISHED; diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index bd23d3a4b67..d7961a8cd2b 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -68,6 +68,7 @@ static int object_location_clear_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Location"); @@ -102,7 +103,7 @@ static int object_location_clear_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* this is needed so children are also updated */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); @@ -126,6 +127,7 @@ void OBJECT_OT_location_clear(wmOperatorType *ot) static int object_rotation_clear_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Rotation"); @@ -244,7 +246,7 @@ static int object_rotation_clear_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* this is needed so children are also updated */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); @@ -268,6 +270,7 @@ void OBJECT_OT_rotation_clear(wmOperatorType *ot) static int object_scale_clear_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Scaling"); @@ -307,7 +310,7 @@ static int object_scale_clear_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* this is needed so children are also updated */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); @@ -331,6 +334,7 @@ void OBJECT_OT_scale_clear(wmOperatorType *ot) static int object_origin_clear_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); float *v1, *v3, mat[3][3]; int armature_clear= 0; @@ -348,7 +352,7 @@ static int object_origin_clear_exec(bContext *C, wmOperator *op) CTX_DATA_END; if(armature_clear==0) /* in this case flush was done */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); @@ -767,7 +771,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - for (tob= G.main->object.first; tob; tob= tob->id.next) { + for (tob= bmain->object.first; tob; tob= tob->id.next) { if(tob->data) ((ID *)tob->data)->flag &= ~LIB_DOIT; } @@ -921,14 +925,14 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - for (tob= G.main->object.first; tob; tob= tob->id.next) { + for (tob= bmain->object.first; tob; tob= tob->id.next) { if(tob->data && (((ID *)tob->data)->flag & LIB_DOIT)) { tob->recalc= OB_RECALC_OB|OB_RECALC_DATA; } } if (tot_change) { - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); } diff --git a/source/blender/editors/physics/particle_boids.c b/source/blender/editors/physics/particle_boids.c index 37de0d8f873..a18890881a8 100644 --- a/source/blender/editors/physics/particle_boids.c +++ b/source/blender/editors/physics/particle_boids.c @@ -35,6 +35,7 @@ #include "BKE_boids.h" #include "BKE_context.h" #include "BKE_depsgraph.h" +#include "BKE_main.h" #include "BKE_particle.h" #include "BLI_listbase.h" @@ -99,6 +100,7 @@ void BOID_OT_rule_add(wmOperatorType *ot) } static int rule_del_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -125,7 +127,7 @@ static int rule_del_exec(bContext *C, wmOperator *op) if(rule) rule->flag |= BOIDRULE_CURRENT; - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); DAG_id_flush_update(&psys->part->id, OB_RECALC_DATA|PSYS_RECALC_RESET); WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); @@ -266,6 +268,7 @@ void BOID_OT_state_add(wmOperatorType *ot) } static int state_del_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -297,7 +300,7 @@ static int state_del_exec(bContext *C, wmOperator *op) state->flag |= BOIDSTATE_CURRENT; - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); DAG_id_flush_update(&psys->part->id, OB_RECALC_DATA|PSYS_RECALC_RESET); WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index 059805fdf2d..ba5d1ee5250 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -166,7 +166,7 @@ static int new_particle_settings_exec(bContext *C, wmOperator *op) psys_check_boid_data(psys); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); DAG_id_flush_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob); @@ -193,6 +193,7 @@ void PARTICLE_OT_new(wmOperatorType *ot) static int new_particle_target_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -214,7 +215,7 @@ static int new_particle_target_exec(bContext *C, wmOperator *op) BLI_addtail(&psys->targets, pt); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); DAG_id_flush_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob); @@ -238,6 +239,7 @@ void PARTICLE_OT_new_target(wmOperatorType *ot) static int remove_particle_target_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -262,7 +264,7 @@ static int remove_particle_target_exec(bContext *C, wmOperator *op) if(pt) pt->flag |= PTARGET_CURRENT; - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); DAG_id_flush_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob); diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 7110c3aa7a7..b5392f6dede 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -403,6 +403,7 @@ static int screen_render_exec(bContext *C, wmOperator *op) Render *re= RE_NewRender(scene->id.name); Image *ima; View3D *v3d= CTX_wm_view3d(C); + Main *mainp= G.main; //BKE_undo_get_main(&scene); int lay= (v3d)? v3d->lay: scene->lay; if(re==NULL) { @@ -418,9 +419,11 @@ static int screen_render_exec(bContext *C, wmOperator *op) BKE_image_backup_render(scene, ima); if(RNA_boolean_get(op->ptr, "animation")) - RE_BlenderAnim(re, scene, lay, scene->r.sfra, scene->r.efra, scene->r.frame_step, op->reports); + RE_BlenderAnim(re, mainp, scene, lay, scene->r.sfra, scene->r.efra, scene->r.frame_step, op->reports); else - RE_BlenderFrame(re, scene, NULL, lay, scene->r.cfra); + RE_BlenderFrame(re, mainp, scene, NULL, lay, scene->r.cfra); + + //free_main(mainp); // no redraw needed, we leave state as we entered it ED_update_for_newframe(C, 1); @@ -555,19 +558,18 @@ static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrec static void render_startjob(void *rjv, short *stop, short *do_update, float *progress) { RenderJob *rj= rjv; -// Main *mainp= BKE_undo_get_main(&rj->scene); + Main *mainp= G.main; //BKE_undo_get_main(&rj->scene); rj->stop= stop; rj->do_update= do_update; rj->progress= progress; if(rj->anim) - RE_BlenderAnim(rj->re, rj->scene, rj->lay, rj->scene->r.sfra, rj->scene->r.efra, rj->scene->r.frame_step, rj->reports); + RE_BlenderAnim(rj->re, mainp, rj->scene, rj->lay, rj->scene->r.sfra, rj->scene->r.efra, rj->scene->r.frame_step, rj->reports); else - RE_BlenderFrame(rj->re, rj->scene, rj->srl, rj->lay, rj->scene->r.cfra); + RE_BlenderFrame(rj->re, mainp, rj->scene, rj->srl, rj->lay, rj->scene->r.cfra); -// if(mainp) -// free_main(mainp); + //free_main(mainp); } static void render_endjob(void *rjv) diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 5881d50c309..524e36b3fc9 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -241,6 +241,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op) static void screen_opengl_render_end(bContext *C, OGLRender *oglrender) { + Main *bmain= CTX_data_main(C); Scene *scene= oglrender->scene; if(oglrender->mh) { @@ -250,7 +251,7 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender) if(oglrender->timer) { /* exec will not have a timer */ scene->r.cfra= oglrender->cfrao; - scene_update_for_newframe(scene, screen_opengl_layers(oglrender)); + scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender)); WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), oglrender->timer); } @@ -297,6 +298,7 @@ static int screen_opengl_render_anim_initialize(bContext *C, wmOperator *op) } static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); OGLRender *oglrender= op->customdata; Scene *scene= oglrender->scene; ImBuf *ibuf; @@ -316,11 +318,11 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) if(lay & 0xFF000000) lay &= 0xFF000000; - scene_update_for_newframe(scene, lay); + scene_update_for_newframe(bmain, scene, lay); CFRA++; } - scene_update_for_newframe(scene, screen_opengl_layers(oglrender)); + scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender)); if(view_context) { if(oglrender->rv3d->persp==RV3D_CAMOB && oglrender->v3d->camera && oglrender->v3d->scenelock) { diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 4bb1f630dad..d4c90a7f24e 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -704,7 +704,7 @@ void BIF_view3d_previewrender_clear(ScrArea *sa) } /* afterqueue call */ -void BIF_view3d_previewrender(Scene *scene, ScrArea *sa) +void BIF_view3d_previewrender(Main *bmain, Scene *scene, ScrArea *sa) { View3D *v3d= sa->spacedata.first; RegionView3D *rv3d= NULL; // XXX @@ -804,7 +804,7 @@ void BIF_view3d_previewrender(Scene *scene, ScrArea *sa) /* database can have created render-resol data... */ if(rstats->convertdone) - DAG_scene_flush_update(scene, scene->lay, 0); + DAG_scene_flush_update(bmain, scene, scene->lay, 0); //printf("dbase update\n"); } diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 5082992aaba..78ec4fe3a01 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1727,6 +1727,7 @@ void ED_screen_animation_timer_update(bScreen *screen, int redraws, int refresh) /* results in fully updated anim system */ void ED_update_for_newframe(const bContext *C, int mute) { + Main *bmain= CTX_data_main(C); bScreen *screen= CTX_wm_screen(C); Scene *scene= CTX_data_scene(C); @@ -1750,7 +1751,7 @@ void ED_update_for_newframe(const bContext *C, int mute) /* this function applies the changes too */ /* XXX future: do all windows */ - scene_update_for_newframe(scene, BKE_screen_visible_layers(screen, scene)); /* BKE_scene.h */ + scene_update_for_newframe(bmain, scene, BKE_screen_visible_layers(screen, scene)); /* BKE_scene.h */ //if ( (CFRA>1) && (!mute) && (scene->r.audio.flag & AUDIO_SCRUB)) // audiostream_scrub( CFRA ); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index c8192996127..b085c8178b0 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2838,9 +2838,9 @@ static int scene_new_exec(bContext *C, wmOperator *op) /* these can't be handled in blenkernel curently, so do them here */ if(type == SCE_COPY_LINK_DATA) - ED_object_single_users(newscene, 0); + ED_object_single_users(bmain, newscene, 0); else if(type == SCE_COPY_FULL) - ED_object_single_users(newscene, 1); + ED_object_single_users(bmain, newscene, 1); WM_event_add_notifier(C, NC_SCENE|ND_SCENEBROWSE, newscene); diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index bf433923707..a6c57126cfe 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -299,16 +299,17 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa) static void do_graph_region_driver_buttons(bContext *C, void *arg, int event) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); switch (event) { case B_IPO_DEPCHANGE: { /* rebuild depsgraph for the new deps */ - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); /* force an update of depsgraph */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); } break; } diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 98422ec2d9f..ae2cee64a23 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -359,6 +359,7 @@ static void old_sca_move_actuator(bContext *C, void *datav, void *move_up) void do_logic_buts(bContext *C, void *arg, int event) { + Main *bmain= CTX_data_main(C); bSensor *sens; bController *cont; bActuator *act; @@ -382,7 +383,7 @@ void do_logic_buts(bContext *C, void *arg, int event) break; case B_ADD_SENS: - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { if(ob->scaflag & OB_ADDSENS) { ob->scaflag &= ~OB_ADDSENS; sens= new_sensor(SENS_ALWAYS); @@ -396,7 +397,7 @@ void do_logic_buts(bContext *C, void *arg, int event) break; case B_CHANGE_SENS: - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { sens= ob->sensors.first; while(sens) { if(sens->type != sens->otype) { @@ -410,7 +411,7 @@ void do_logic_buts(bContext *C, void *arg, int event) break; case B_DEL_SENS: - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { sens= ob->sensors.first; while(sens) { if(sens->flag & SENS_DEL) { @@ -425,7 +426,7 @@ void do_logic_buts(bContext *C, void *arg, int event) break; case B_ADD_CONT: - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { if(ob->scaflag & OB_ADDCONT) { ob->scaflag &= ~OB_ADDCONT; cont= new_controller(CONT_LOGIC_AND); @@ -450,7 +451,7 @@ void do_logic_buts(bContext *C, void *arg, int event) break; case B_SET_STATE_BIT: - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { if(ob->scaflag & OB_ALLSTATE) { ob->scaflag &= ~OB_ALLSTATE; ob->state = 0x3FFFFFFF; @@ -459,7 +460,7 @@ void do_logic_buts(bContext *C, void *arg, int event) break; case B_INIT_STATE_BIT: - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { if(ob->scaflag & OB_INITSTBIT) { ob->scaflag &= ~OB_INITSTBIT; ob->state = ob->init_state; @@ -470,7 +471,7 @@ void do_logic_buts(bContext *C, void *arg, int event) break; case B_CHANGE_CONT: - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { cont= ob->controllers.first; while(cont) { if(cont->type != cont->otype) { @@ -485,7 +486,7 @@ void do_logic_buts(bContext *C, void *arg, int event) case B_DEL_CONT: - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { cont= ob->controllers.first; while(cont) { if(cont->flag & CONT_DEL) { @@ -501,7 +502,7 @@ void do_logic_buts(bContext *C, void *arg, int event) break; case B_ADD_ACT: - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { if(ob->scaflag & OB_ADDACT) { ob->scaflag &= ~OB_ADDACT; act= new_actuator(ACT_OBJECT); @@ -514,7 +515,7 @@ void do_logic_buts(bContext *C, void *arg, int event) break; case B_CHANGE_ACT: - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { act= ob->actuators.first; while(act) { if(act->type != act->otype) { @@ -528,7 +529,7 @@ void do_logic_buts(bContext *C, void *arg, int event) break; case B_DEL_ACT: - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { act= ob->actuators.first; while(act) { if(act->flag & ACT_DEL) { @@ -546,7 +547,7 @@ void do_logic_buts(bContext *C, void *arg, int event) case B_SOUNDACT_BROWSE: /* since we don't know which... */ didit= 0; - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { act= ob->actuators.first; while(act) { @@ -555,11 +556,11 @@ void do_logic_buts(bContext *C, void *arg, int event) bSoundActuator *sa= act->data; if(sa->sndnr) { - bSound *sound= G.main->sound.first; + bSound *sound= bmain->sound.first; int nr= 1; if(sa->sndnr == -2) { -// XXX activate_databrowse((ID *)G.main->sound.first, ID_SO, 0, B_SOUNDACT_BROWSE, +// XXX activate_databrowse((ID *)bmain->sound.first, ID_SO, 0, B_SOUNDACT_BROWSE, // &sa->sndnr, do_logic_buts); break; } @@ -768,6 +769,7 @@ static void set_sca_ob(Object *ob) static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisflag) { Base *base; + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob, *obt, *obact= CTX_data_active_object(C); ID **idar; @@ -784,7 +786,7 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf if(scene==NULL) return NULL; - ob= G.main->object.first; + ob= bmain->object.first; while(ob) { ob->scavisflag= 0; set_sca_ob(ob); @@ -818,7 +820,7 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf while(doit) { doit= 0; - ob= G.main->object.first; + ob= bmain->object.first; while(ob) { /* 1st case: select sensor when controller selected */ @@ -899,7 +901,7 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf } /* now we count */ - ob= G.main->object.first; + ob= bmain->object.first; while(ob) { if( ob->scavisflag ) (*count)++; ob= ob->id.next; @@ -910,7 +912,7 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf idar= MEM_callocN( (*count)*sizeof(void *), "idar"); - ob= G.main->object.first; + ob= bmain->object.first; nr= 0; /* make the active object always the first one of the list */ @@ -1817,7 +1819,7 @@ static void check_armature_actuator(bContext *C, void *arg1_but, void *arg2_act) } -static short draw_actuatorbuttons(Object *ob, bActuator *act, uiBlock *block, short xco, short yco, short width) +static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlock *block, short xco, short yco, short width) { bSoundActuator *sa = NULL; bObjectActuator *oa = NULL; @@ -2142,8 +2144,8 @@ static short draw_actuatorbuttons(Object *ob, bActuator *act, uiBlock *block, sh glRects(xco, yco-ysize, xco+width, yco); uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1); - if(G.main->sound.first) { - IDnames_to_pupstring(&str, "Sound files", NULL, &(G.main->sound), (ID *)sa->sound, &(sa->sndnr)); + if(bmain->sound.first) { + IDnames_to_pupstring(&str, "Sound files", NULL, &(bmain->sound), (ID *)sa->sound, &(sa->sndnr)); /* reset this value, it is for handling the event */ sa->sndnr = 0; uiDefButS(block, MENU, B_SOUNDACT_BROWSE, str, xco+10,yco-22,20,19, &(sa->sndnr), 0, 0, 0, 0, ""); @@ -4709,6 +4711,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar) void logic_buttons(bContext *C, ARegion *ar) { + Main *bmain= CTX_data_main(C); SpaceLogic *slogic= CTX_wm_space_logic(C); Object *ob= CTX_data_active_object(C); ID **idar; @@ -5033,7 +5036,7 @@ void logic_buttons(bContext *C, ARegion *ar) uiButSetFunc(but, make_unique_prop_names_cb, act->name, (void*) 0); ycoo= yco; - yco= draw_actuatorbuttons(ob, act, block, xco, yco, width); + yco= draw_actuatorbuttons(bmain, ob, act, block, xco, yco, width); if(yco-6 < ycoo) ycoo= (yco+ycoo-20)/2; } else { diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 082f3f97dfd..01992d225c7 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -190,6 +190,7 @@ static void node_buts_normal(uiLayout *layout, bContext *C, PointerRNA *ptr) #if 0 // not used in 2.5x yet static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v) { + Main *bmain= CTX_data_main(C); bNodeTree *ntree= ntree_v; bNode *node= node_v; Tex *tex; @@ -200,7 +201,7 @@ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v) node->id->us--; node->id= NULL; } - tex= BLI_findlink(&G.main->tex, node->menunr-1); + tex= BLI_findlink(&bmain->tex, node->menunr-1); node->id= &tex->id; id_us_plus(node->id); @@ -220,6 +221,7 @@ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v) #endif static void node_dynamic_update_cb(bContext *C, void *ntree_v, void *node_v) { + Main *bmain= CTX_data_main(C); Material *ma; bNode *node= (bNode *)node_v; ID *id= node->id; @@ -229,7 +231,7 @@ static void node_dynamic_update_cb(bContext *C, void *ntree_v, void *node_v) /* Users only have to press the "update" button in one pynode * and we also update all others sharing the same script */ - for (ma= G.main->mat.first; ma; ma= ma->id.next) { + for (ma= bmain->mat.first; ma; ma= ma->id.next) { if (ma->nodetree) { bNode *nd; for (nd= ma->nodetree->nodes.first; nd; nd= nd->next) { @@ -277,6 +279,7 @@ static void node_buts_math(uiLayout *layout, bContext *C, PointerRNA *ptr) static void node_browse_text_cb(bContext *C, void *ntree_v, void *node_v) { + Main *bmain= CTX_data_main(C); bNodeTree *ntree= ntree_v; bNode *node= node_v; ID *oldid; @@ -287,7 +290,7 @@ static void node_browse_text_cb(bContext *C, void *ntree_v, void *node_v) node->id->us--; } oldid= node->id; - node->id= BLI_findlink(&G.main->text, node->menunr-1); + node->id= BLI_findlink(&bmain->text, node->menunr-1); id_us_plus(node->id); BLI_strncpy(node->name, node->id->name+2, 21); /* huh? why 21? */ @@ -368,6 +371,7 @@ static void node_shader_buts_geometry(uiLayout *layout, bContext *C, PointerRNA static void node_shader_buts_dynamic(uiLayout *layout, bContext *C, PointerRNA *ptr) { + Main *bmain= CTX_data_main(C); uiBlock *block= uiLayoutAbsoluteBlock(layout); bNode *node= ptr->data; bNodeTree *ntree= ptr->id.data; @@ -380,7 +384,7 @@ static void node_shader_buts_dynamic(uiLayout *layout, bContext *C, PointerRNA * /* B_NODE_EXEC is handled in butspace.c do_node_buts */ if(!node->id) { char *strp; - IDnames_to_pupstring(&strp, NULL, "", &(G.main->text), NULL, NULL); + IDnames_to_pupstring(&strp, NULL, "", &(bmain->text), NULL, NULL); node->menunr= 0; bt= uiDefButS(block, MENU, B_NODE_EXEC/*+node->nr*/, strp, butr->xmin, dy, 19, 19, diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index cea88c33c5b..dcd87b89ea0 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -1852,6 +1852,7 @@ void NODE_OT_links_cut(wmOperatorType *ot) /* goes over all scenes, reads render layers */ static int node_read_renderlayers_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); SpaceNode *snode= CTX_wm_space_node(C); Scene *curscene= CTX_data_scene(C), *scene; bNode *node; @@ -1859,7 +1860,7 @@ static int node_read_renderlayers_exec(bContext *C, wmOperator *op) ED_preview_kill_jobs(C); /* first tag scenes unread */ - for(scene= G.main->scene.first; scene; scene= scene->id.next) + for(scene= bmain->scene.first; scene; scene= scene->id.next) scene->id.flag |= LIB_DOIT; for(node= snode->edittree->nodes.first; node; node= node->next) { diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index 3cdc2437c45..ad04e28ee4a 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -3186,7 +3186,7 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto if(scene->obedit==base->object) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO); - ED_base_object_free_and_unlink(scene, base); + ED_base_object_free_and_unlink(CTX_data_main(C), scene, base); te->directdata= NULL; tselem->id= NULL; } @@ -3337,7 +3337,7 @@ void outliner_del(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops) ;// del_seq(); else { outliner_do_object_operation(C, scene, soops, &soops->tree, object_delete_cb); - DAG_scene_sort(scene); + DAG_scene_sort(CTX_data_main(C), scene); ED_undo_push(C, "Delete Objects"); } } @@ -3356,6 +3356,7 @@ static EnumPropertyItem prop_object_op_types[] = { static int outliner_object_operation_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); SpaceOops *soops= CTX_wm_space_outliner(C); int event; @@ -3382,7 +3383,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) } else if(event==4) { outliner_do_object_operation(C, scene, soops, &soops->tree, object_delete_cb); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); str= "Delete Objects"; } else if(event==5) { /* disabled, see above (ton) */ diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 5638cb6daf5..7a3f0ff80e5 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -2359,6 +2359,7 @@ void TEXT_OT_insert(wmOperatorType *ot) static int find_and_replace(bContext *C, wmOperator *op, short mode) { + Main *bmain= CTX_data_main(C); SpaceText *st= CTX_wm_space_text(C); Text *start= NULL, *text= st->text; int flags, first= 1; @@ -2420,7 +2421,7 @@ static int find_and_replace(bContext *C, wmOperator *op, short mode) if(text->id.next) text= st->text= text->id.next; else - text= st->text= G.main->text.first; + text= st->text= bmain->text.first; txt_move_toline(text, 0, 0); text_update_cursor_moved(C); WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text); diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 19aaff2cea9..f4ae87c5b60 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -53,6 +53,7 @@ #include "BKE_customdata.h" #include "BKE_depsgraph.h" #include "BKE_idprop.h" +#include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_object.h" #include "BKE_global.h" @@ -997,6 +998,7 @@ static int test_parent_loop(Object *par, Object *ob) static void do_view3d_region_buttons(bContext *C, void *arg, int event) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); // Object *obedit= CTX_data_edit_object(C); View3D *v3d= CTX_wm_view3d(C); @@ -1028,7 +1030,7 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event) if(ob->id.lib || test_parent_loop(ob->parent, ob) ) ob->parent= NULL; else { - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); DAG_id_flush_update(&ob->id, OB_RECALC_OB); } } diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 14b769fdf39..761ef436d48 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -152,6 +152,7 @@ static void handle_view3d_lock(bContext *C) static int layers_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); ScrArea *sa= CTX_wm_area(C); View3D *v3d= sa->spacedata.first; @@ -213,7 +214,7 @@ static int layers_exec(bContext *C, wmOperator *op) if(v3d->scenelock) handle_view3d_lock(C); /* new layers might need unflushed events events */ - DAG_scene_update_flags(scene, v3d->lay); /* tags all that moves and flushes */ + DAG_scene_update_flags(bmain, scene, v3d->lay); /* tags all that moves and flushes */ ED_area_tag_redraw(sa); diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 9928ba1983e..b3763d6cb90 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -45,14 +45,15 @@ #include "BKE_action.h" #include "BKE_anim.h" -#include "BKE_context.h" #include "BKE_armature.h" +#include "BKE_context.h" #include "BKE_curve.h" #include "BKE_depsgraph.h" #include "BKE_DerivedMesh.h" #include "BKE_displist.h" #include "BKE_global.h" #include "BKE_lattice.h" +#include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_object.h" @@ -420,6 +421,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode) static int snap_sel_to_grid(bContext *C, wmOperator *op) { extern float originmat[3][3]; /* XXX object.c */ + Main *bmain= CTX_data_main(C); Object *obedit= CTX_data_edit_object(C); Scene *scene= CTX_data_scene(C); RegionView3D *rv3d= CTX_wm_region_data(C); @@ -526,7 +528,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *op) CTX_DATA_END; } - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -553,6 +555,7 @@ void VIEW3D_OT_snap_selected_to_grid(wmOperatorType *ot) static int snap_sel_to_curs(bContext *C, wmOperator *op) { extern float originmat[3][3]; /* XXX object.c */ + Main *bmain= CTX_data_main(C); Object *obedit= CTX_data_edit_object(C); Scene *scene= CTX_data_scene(C); View3D *v3d= CTX_wm_view3d(C); @@ -651,7 +654,7 @@ static int snap_sel_to_curs(bContext *C, wmOperator *op) CTX_DATA_END; } - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 8ec226ef57e..4de6a270245 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1344,7 +1344,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b /* ********************** local view operator ******************** */ -static unsigned int free_localbit(void) +static unsigned int free_localbit(Main *bmain) { unsigned int lay; ScrArea *sa; @@ -1354,7 +1354,7 @@ static unsigned int free_localbit(void) /* sometimes we loose a localview: when an area is closed */ /* check all areas: which localviews are in use? */ - for(sc= G.main->screen.first; sc; sc= sc->id.next) { + for(sc= bmain->screen.first; sc; sc= sc->id.next) { for(sa= sc->areabase.first; sa; sa= sa->next) { SpaceLink *sl= sa->spacedata.first; for(; sl; sl= sl->next) { @@ -1416,7 +1416,7 @@ int ED_view3d_scene_layer_set(int lay, const int *values, int *active) return lay; } -static void initlocalview(Scene *scene, ScrArea *sa) +static void initlocalview(Main *bmain, Scene *scene, ScrArea *sa) { View3D *v3d= sa->spacedata.first; Base *base; @@ -1428,7 +1428,7 @@ static void initlocalview(Scene *scene, ScrArea *sa) INIT_MINMAX(min, max); - locallay= free_localbit(); + locallay= free_localbit(bmain); if(locallay==0) { printf("Sorry, no more than 8 localviews\n"); // XXX error @@ -1592,7 +1592,7 @@ static int localview_exec(bContext *C, wmOperator *unused) if(v3d->localvd) endlocalview(CTX_data_scene(C), CTX_wm_area(C)); else - initlocalview(CTX_data_scene(C), CTX_wm_area(C)); + initlocalview(CTX_data_main(C), CTX_data_scene(C), CTX_wm_area(C)); ED_area_tag_redraw(CTX_wm_area(C)); @@ -1806,7 +1806,7 @@ static int game_engine_exec(bContext *C, wmOperator *op) //XXX restore_all_scene_cfra(scene_cfra_store); set_scene_bg(startscene); - //XXX scene_update_for_newframe(G.scene, G.scene->lay); + //XXX scene_update_for_newframe(bmain, scene, scene->lay); ED_area_tag_redraw(CTX_wm_area(C)); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 2f8da7c2dd6..e71b9bd66e0 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -4403,7 +4403,7 @@ static void set_trans_object_base_flags(bContext *C, TransInfo *t) } /* all recalc flags get flushed to all layers, so a layer flip later on works fine */ - DAG_scene_flush_update(t->scene, -1, 0); + DAG_scene_flush_update(G.main, t->scene, -1, 0); /* and we store them temporal in base (only used for transform code) */ /* this because after doing updates, the object->recalc is cleared */ @@ -4481,7 +4481,7 @@ static int count_proportional_objects(TransInfo *t) /* all recalc flags get flushed to all layers, so a layer flip later on works fine */ - DAG_scene_flush_update(t->scene, -1, 0); + DAG_scene_flush_update(G.main, t->scene, -1, 0); /* and we store them temporal in base (only used for transform code) */ /* this because after doing updates, the object->recalc is cleared */ diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index fbf2051f962..cd2b6a793b7 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -77,13 +77,14 @@ void ED_editors_init(bContext *C) /* frees all editmode stuff */ void ED_editors_exit(bContext *C) { + Main *bmain= CTX_data_main(C); Scene *sce; /* frees all editmode undos */ undo_editmode_clear(); ED_undo_paint_free(); - for(sce=G.main->scene.first; sce; sce= sce->id.next) { + for(sce=bmain->scene.first; sce; sce= sce->id.next) { if(sce->obedit) { Object *ob= sce->obedit; diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c index 7e52032687c..c4ed00794b0 100644 --- a/source/blender/makesrna/intern/rna_boid.c +++ b/source/blender/makesrna/intern/rna_boid.c @@ -97,7 +97,7 @@ static void rna_Boids_reset_deps(Main *bmain, Scene *scene, PointerRNA *ptr) else DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL); } diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 1c6c35a88de..05bddfa7a32 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -214,7 +214,7 @@ static void rna_Constraint_update(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Constraint_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - ED_object_constraint_dependency_update(scene, ptr->id.data); + ED_object_constraint_dependency_update(bmain, scene, ptr->id.data); } static void rna_Constraint_influence_update(Main *bmain, Scene *scene, PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index d10aed1595a..335f5919004 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -254,7 +254,7 @@ static void rna_Curve_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Curve_update_deps(Main *bmain, Scene *scene, PointerRNA *ptr) { - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); rna_Curve_update_data(bmain, scene, ptr); } diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index cd58b6574be..09f531cf95d 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -110,7 +110,7 @@ static void rna_ChannelDriver_update_data(Main *bmain, Scene *scene, PointerRNA driver->flag &= ~DRIVER_FLAG_INVALID; // TODO: this really needs an update guard... - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); DAG_id_flush_update(id, OB_RECALC_OB|OB_RECALC_DATA); WM_main_add_notifier(NC_SCENE|ND_FRAME, scene); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 18b0f1ca61a..fa5d703a84f 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -214,7 +214,7 @@ static void rna_Modifier_update(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Modifier_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { rna_Modifier_update(bmain, scene, ptr); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 4576a754f96..29666c6ed04 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -196,7 +196,7 @@ void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Object_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { DAG_id_flush_update(ptr->id.data, OB_RECALC_OB); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } /* when changing the selection flag the scene needs updating */ @@ -214,7 +214,7 @@ static void rna_Base_select_update(Main *bmain, Scene *scene, PointerRNA *ptr) ED_base_object_select(base, mode); } -static void rna_Object_layer_update__internal(Scene *scene, Base *base, Object *ob) +static void rna_Object_layer_update__internal(Main *bmain, Scene *scene, Base *base, Object *ob) { /* try to avoid scene sort */ if((ob->lay & scene->lay) && (base->lay & scene->lay)) { @@ -222,7 +222,7 @@ static void rna_Object_layer_update__internal(Scene *scene, Base *base, Object * } else if((ob->lay & scene->lay)==0 && (base->lay & scene->lay)==0) { /* pass */ } else { - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } } @@ -237,7 +237,7 @@ static void rna_Object_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) SWAP(int, base->lay, ob->lay); - rna_Object_layer_update__internal(scene, base, ob); + rna_Object_layer_update__internal(bmain, scene, base, ob); ob->lay= base->lay; } @@ -246,7 +246,7 @@ static void rna_Base_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) Base *base= (Base*)ptr->data; Object *ob= (Object*)base->object; - rna_Object_layer_update__internal(scene, base, ob); + rna_Object_layer_update__internal(bmain, scene, base, ob); ob->lay= base->lay; } @@ -1031,12 +1031,12 @@ static int rna_Object_constraint_remove(Object *object, int index) static ModifierData *rna_Object_modifier_new(Object *object, bContext *C, ReportList *reports, char *name, int type) { - return ED_object_modifier_add(reports, CTX_data_scene(C), object, name, type); + return ED_object_modifier_add(reports, CTX_data_main(C), CTX_data_scene(C), object, name, type); } static void rna_Object_modifier_remove(Object *object, bContext *C, ReportList *reports, ModifierData *md) { - ED_object_modifier_remove(reports, CTX_data_scene(C), object, md); + ED_object_modifier_remove(reports, CTX_data_main(C), CTX_data_scene(C), object, md); } static void rna_Object_boundbox_get(PointerRNA *ptr, float *values) diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index d253201fbc1..a3a1186eedc 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -510,11 +510,11 @@ static void rna_FieldSettings_shape_update(Main *bmain, Scene *scene, PointerRNA if(!md) { if(pd && (pd->shape == PFIELD_SHAPE_SURFACE) && ELEM(pd->forcefield,PFIELD_GUIDE,PFIELD_TEXTURE)==0) if(ELEM4(ob->type, OB_MESH, OB_SURF, OB_FONT, OB_CURVE)) - ED_object_modifier_add(NULL, scene, ob, NULL, eModifierType_Surface); + ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Surface); } else { if(!pd || pd->shape != PFIELD_SHAPE_SURFACE) - ED_object_modifier_remove(NULL, scene, ob, md); + ED_object_modifier_remove(NULL, bmain, scene, ob, md); } WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob); @@ -538,7 +538,7 @@ static void rna_FieldSettings_dependency_update(Main *bmain, Scene *scene, Point rna_FieldSettings_shape_update(bmain, scene, ptr); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); if(ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE) DAG_id_flush_update(&ob->id, OB_RECALC_ALL); @@ -582,7 +582,7 @@ static void rna_EffectorWeight_update(Main *bmain, Scene *scene, PointerRNA *ptr static void rna_EffectorWeight_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); DAG_id_flush_update((ID*)ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET); @@ -640,9 +640,9 @@ static void rna_CollisionSettings_dependency_update(Main *bmain, Scene *scene, P /* add/remove modifier as needed */ if(ob->pd->deflect && !md) - ED_object_modifier_add(NULL, scene, ob, NULL, eModifierType_Collision); + ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Collision); else if(!ob->pd->deflect && md) - ED_object_modifier_remove(NULL, scene, ob, md); + ED_object_modifier_remove(NULL, bmain, scene, ob, md); WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob); } diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 74bc564064e..4baf81a9427 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -214,7 +214,7 @@ static void rna_Particle_redo(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Particle_redo_dependency(Main *bmain, Scene *scene, PointerRNA *ptr) { - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); rna_Particle_redo(bmain, scene, ptr); } @@ -266,7 +266,7 @@ static void rna_Particle_target_reset(Main *bmain, Scene *scene, PointerRNA *ptr psys->recalc = PSYS_RECALC_RESET; DAG_id_flush_update(&ob->id, OB_RECALC_DATA); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL); diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 21ece0ac4a9..d05a3d341ba 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -151,7 +151,7 @@ static void rna_Pose_ik_solver_update(Main *bmain, Scene *scene, PointerRNA *ptr bPose *pose = ptr->data; pose->flag |= POSE_RECALC; // checks & sorts pose channels - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); update_pose_constraint_flags(pose); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 966e7696ede..027120b4f35 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -203,7 +203,7 @@ static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *report ob->recalc |= OB_RECALC_ALL; - DAG_scene_sort(scene); + DAG_scene_sort(G.main, scene); return base; } @@ -229,8 +229,8 @@ static void rna_Scene_object_unlink(Scene *scene, ReportList *reports, Object *o ob->id.us--; /* needed otherwise the depgraph will contain free'd objects which can crash, see [#20958] */ - DAG_scene_sort(scene); - DAG_ids_flush_update(0); + DAG_scene_sort(G.main, scene); + DAG_ids_flush_update(G.main, 0); WM_main_add_notifier(NC_SCENE|ND_OB_ACTIVE, scene); } @@ -838,7 +838,7 @@ static void rna_Scene_use_simplify_update(Main *bmain, Scene *scene, PointerRNA for(SETLOOPER(scene, base)) object_simplify_update(base->object); - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_main_add_notifier(NC_GEOM|ND_DATA, NULL); } diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index eb48fb6c237..c3b60514d2a 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -39,9 +39,10 @@ #ifdef RNA_RUNTIME #include "BKE_animsys.h" -#include "BKE_scene.h" -#include "BKE_image.h" #include "BKE_depsgraph.h" +#include "BKE_global.h" +#include "BKE_image.h" +#include "BKE_scene.h" #include "BKE_writeavi.h" @@ -50,11 +51,16 @@ static void rna_Scene_set_frame(Scene *scene, int frame) { scene->r.cfra= frame; CLAMP(scene->r.cfra, MINAFRAME, MAXFRAME); - scene_update_for_newframe(scene, (1<<20) - 1); + scene_update_for_newframe(G.main, scene, (1<<20) - 1); WM_main_add_notifier(NC_SCENE|ND_FRAME, scene); } +static void rna_Scene_update_tagged(Scene *scene) +{ + scene_update_tagged(G.main, scene); +} + static KeyingSet *rna_Scene_add_keying_set(Scene *sce, ReportList *reports, char name[], int absolute, int insertkey_needed, int insertkey_visual) { @@ -102,7 +108,7 @@ void RNA_api_scene(StructRNA *srna) parm= RNA_def_int(func, "frame", 0, MINAFRAME, MAXFRAME, "", "Frame number to set.", MINAFRAME, MAXFRAME); RNA_def_property_flag(parm, PROP_REQUIRED); - func= RNA_def_function(srna, "update", "scene_update_tagged"); + func= RNA_def_function(srna, "update", "rna_Scene_update_tagged"); RNA_def_function_ui_description(func, "Update data tagged to be updated from previous access to data or operators."); /* Add Keying Set */ diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index cd2297cc273..f921595304d 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -55,7 +55,7 @@ static void rna_Smoke_update(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Smoke_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { rna_Smoke_update(bmain, scene, ptr); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } static void rna_Smoke_reset(Main *bmain, Scene *scene, PointerRNA *ptr) diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index 802703d476c..bc25c9857d5 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -37,14 +37,15 @@ struct bNodeTree; struct Image; +struct Main; struct NodeBlurData; struct Object; -struct ReportList; struct RenderData; struct RenderEngine; struct RenderEngineType; struct RenderResult; struct ReportList; +struct ReportList; struct Scene; struct SceneRenderLayer; @@ -208,8 +209,8 @@ void RE_init_threadcount(Render *re); void RE_TileProcessor(struct Render *re); /* only RE_NewRender() needed, main Blender render calls */ -void RE_BlenderFrame(struct Render *re, struct Scene *scene, struct SceneRenderLayer *srl, unsigned int lay, int frame); -void RE_BlenderAnim(struct Render *re, struct Scene *scene, unsigned int lay, int sfra, int efra, int tfra, struct ReportList *reports); +void RE_BlenderFrame(struct Render *re, struct Main *bmain, struct Scene *scene, struct SceneRenderLayer *srl, unsigned int lay, int frame); +void RE_BlenderAnim(struct Render *re, struct Main *bmain, struct Scene *scene, unsigned int lay, int sfra, int efra, int tfra, struct ReportList *reports); /* main preview render call */ void RE_PreviewRender(struct Render *re, struct Scene *scene); diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index c75ae594daf..b124102f50b 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -55,6 +55,7 @@ struct RenderBuckets; struct ObjectInstanceRen; struct RayObject; struct RayFace; +struct Main; #define TABLEINITSIZE 1024 #define LAMPINITSIZE 256 @@ -170,7 +171,8 @@ struct Render /* shadow counter, detect shadow-reuse for shaders */ int shadowsamplenr[BLENDER_MAX_THREADS]; - /* scene, and its full copy of renderdata and world */ + /* main, scene, and its full copy of renderdata and world */ + struct Main *main; Scene *scene; RenderData r; World wrld; diff --git a/source/blender/render/intern/include/texture.h b/source/blender/render/intern/include/texture.h index 436b365b352..fb941d1b7f3 100644 --- a/source/blender/render/intern/include/texture.h +++ b/source/blender/render/intern/include/texture.h @@ -65,7 +65,7 @@ void do_lamp_tex(LampRen *la, float *lavec, struct ShadeInput *shi, float *colf, void do_volume_tex(struct ShadeInput *shi, float *xyz, int mapto_flag, float *col, float *val); void init_render_textures(Render *re); -void end_render_textures(void); +void end_render_textures(Render *re); void render_realtime_texture(struct ShadeInput *shi, struct Image *ima); diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 6564dd09864..45ffcc72bc4 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -3855,12 +3855,12 @@ static void set_material_lightgroups(Render *re) if(re->scene->r.scemode & R_PREVIEWBUTS) return; - for(group= G.main->group.first; group; group=group->id.next) + for(group= re->main->group.first; group; group=group->id.next) group->id.flag |= LIB_DOIT; /* it's a bit too many loops in loops... but will survive */ /* hola! materials not in use...? */ - for(ma= G.main->mat.first; ma; ma=ma->id.next) { + for(ma= re->main->mat.first; ma; ma=ma->id.next) { if(ma->group && (ma->group->id.flag & LIB_DOIT)) add_lightgroup(re, ma->group, ma->mode & MA_GROUP_NOLAY); } @@ -4542,8 +4542,8 @@ void RE_Database_Free(Render *re) #if 0 /* radio can be redone better */ end_radio_render(); #endif - end_render_materials(); - end_render_textures(); + end_render_materials(re->main); + end_render_textures(re); free_pointdensities(re); @@ -4868,7 +4868,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp /* objects in groups with OB_RENDER_DUPLI set still need to be created, * since they may not be part of the scene */ - for(group= G.main->group.first; group; group=group->id.next) + for(group= re->main->group.first; group; group=group->id.next) add_group_render_dupli_obs(re, group, nolamps, onlyselected, actob, timeoffset, renderlay, 0); /* imat objects has to be done again, since groups can mess it up */ @@ -4916,7 +4916,7 @@ void RE_Database_FromScene(Render *re, Scene *scene, unsigned int lay, int use_c /* applies changes fully */ if((re->r.scemode & R_PREVIEWBUTS)==0) - scene_update_for_newframe(re->scene, lay); + scene_update_for_newframe(re->main, re->scene, lay); /* if no camera, viewmat should have been set! */ if(use_camera_view && re->scene->camera) { @@ -4943,7 +4943,7 @@ void RE_Database_FromScene(Render *re, Scene *scene, unsigned int lay, int use_c /* still bad... doing all */ init_render_textures(re); VECCOPY(amb, &re->wrld.ambr); - init_render_materials(re->r.mode, amb); + init_render_materials(re->main, re->r.mode, amb); set_node_shader_lamp_loop(shade_material_loop); /* MAKE RENDER DATA */ @@ -5070,7 +5070,7 @@ static void database_fromscene_vectors(Render *re, Scene *scene, unsigned int la /* applies changes fully */ scene->r.cfra += timeoffset; - scene_update_for_newframe(re->scene, lay); + scene_update_for_newframe(re->main, re->scene, lay); /* if no camera, viewmat should have been set! */ if(re->scene->camera) { @@ -5626,7 +5626,7 @@ void RE_Database_Baking(Render *re, Scene *scene, unsigned int lay, int type, Ob init_render_textures(re); VECCOPY(amb, &re->wrld.ambr); - init_render_materials(re->r.mode, amb); + init_render_materials(re->main, re->r.mode, amb); set_node_shader_lamp_loop(shade_material_loop); diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index 1accb0fdb60..8977bc7f379 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -46,7 +46,6 @@ #include "BKE_library.h" #include "BKE_main.h" -#include "BKE_global.h" #include "BKE_image.h" // BKE_write_ibuf #include "BKE_texture.h" #include "BKE_utildefines.h" @@ -508,7 +507,7 @@ void make_envmaps(Render *re) /* 5 = hardcoded max recursion level */ while(depth<5) { - tex= G.main->tex.first; + tex= re->main->tex.first; while(tex) { if(tex->id.us && tex->type==TEX_ENVMAP) { if(tex->env && tex->env->object) { diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 64932313259..0db1bdc9abd 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2164,7 +2164,7 @@ static void tag_scenes_for_render(Render *re) bNode *node; Scene *sce; - for(sce= G.main->scene.first; sce; sce= sce->id.next) + for(sce= re->main->scene.first; sce; sce= sce->id.next) sce->id.flag &= ~LIB_DOIT; re->scene->id.flag |= LIB_DOIT; @@ -2319,7 +2319,7 @@ void RE_MergeFullSample(Render *re, Scene *sce, bNodeTree *ntree) /* first call RE_ReadRenderResult on every renderlayer scene. this creates Render structs */ /* tag scenes unread */ - for(scene= G.main->scene.first; scene; scene= scene->id.next) + for(scene= re->main->scene.first; scene; scene= scene->id.next) scene->id.flag |= LIB_DOIT; for(node= ntree->nodes.first; node; node= node->next) { @@ -2394,7 +2394,7 @@ static void do_render_composite_fields_blur_3d(Render *re) R.stats_draw= re->stats_draw; if (update_newframe) - scene_update_for_newframe(re->scene, re->lay); + scene_update_for_newframe(re->main, re->scene, re->lay); if(re->r.scemode & R_FULL_SAMPLE) do_merge_fullsample(re, ntree); @@ -2457,7 +2457,7 @@ static void do_render_seq(Render * re) if(recurs_depth==0) { /* otherwise sequencer animation isnt updated */ - BKE_animsys_evaluate_all_animation(G.main, (float)cfra); // XXX, was BKE_curframe(re->scene) + BKE_animsys_evaluate_all_animation(re->main, (float)cfra); // XXX, was BKE_curframe(re->scene) } recurs_depth++; @@ -2692,7 +2692,7 @@ static void update_physics_cache(Render *re, Scene *scene, int anim_init) BKE_ptcache_make_cache(&baker); } /* evaluating scene options for general Blender render */ -static int render_initialize_from_scene(Render *re, Scene *scene, SceneRenderLayer *srl, unsigned int lay, int anim, int anim_init) +static int render_initialize_from_main(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *srl, unsigned int lay, int anim, int anim_init) { int winx, winy; rcti disprect; @@ -2718,6 +2718,7 @@ static int render_initialize_from_scene(Render *re, Scene *scene, SceneRenderLay disprect.ymax= winy; } + re->main= bmain; re->scene= scene; re->lay= lay; @@ -2760,14 +2761,14 @@ static int render_initialize_from_scene(Render *re, Scene *scene, SceneRenderLay } /* general Blender frame render call */ -void RE_BlenderFrame(Render *re, Scene *scene, SceneRenderLayer *srl, unsigned int lay, int frame) +void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *srl, unsigned int lay, int frame) { /* ugly global still... is to prevent preview events and signal subsurfs etc to make full resol */ G.rendering= 1; scene->r.cfra= frame; - if(render_initialize_from_scene(re, scene, srl, lay, 0, 0)) { + if(render_initialize_from_main(re, bmain, scene, srl, lay, 0, 0)) { MEM_reset_peak_memory(); do_render_all_options(re); } @@ -2863,14 +2864,14 @@ static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, R } /* saves images to disk */ -void RE_BlenderAnim(Render *re, Scene *scene, unsigned int lay, int sfra, int efra, int tfra, ReportList *reports) +void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, unsigned int lay, int sfra, int efra, int tfra, ReportList *reports) { bMovieHandle *mh= BKE_get_movie_handle(scene->r.imtype); int cfrao= scene->r.cfra; int nfra; /* do not fully call for each frame, it initializes & pops output window */ - if(!render_initialize_from_scene(re, scene, NULL, lay, 0, 1)) + if(!render_initialize_from_main(re, bmain, scene, NULL, lay, 0, 1)) return; /* ugly global still... is to prevent renderwin events and signal subsurfs etc to make full resol */ @@ -2903,7 +2904,7 @@ void RE_BlenderAnim(Render *re, Scene *scene, unsigned int lay, int sfra, int ef char name[FILE_MAX]; /* only border now, todo: camera lens. (ton) */ - render_initialize_from_scene(re, scene, NULL, lay, 1, 0); + render_initialize_from_main(re, bmain, scene, NULL, lay, 1, 0); if(nfra!=scene->r.cfra) { /* @@ -2918,7 +2919,7 @@ void RE_BlenderAnim(Render *re, Scene *scene, unsigned int lay, int sfra, int ef else updatelay= re->lay; - scene_update_for_newframe(scene, updatelay); + scene_update_for_newframe(bmain, scene, updatelay); continue; } else diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index 32ae3ba12dc..a09c16b7ed9 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -282,7 +282,7 @@ void make_pointdensities(Render *re) re->i.infostr= "Caching Point Densities"; re->stats_draw(re->sdh, &re->i); - for (tex= G.main->tex.first; tex; tex= tex->id.next) { + for (tex= re->main->tex.first; tex; tex= tex->id.next) { if(tex->id.us && tex->type==TEX_POINTDENSITY) { cache_pointdensity(re, tex); } @@ -299,7 +299,7 @@ void free_pointdensities(Render *re) if(re->scene->r.scemode & R_PREVIEWBUTS) return; - for (tex= G.main->tex.first; tex; tex= tex->id.next) { + for (tex= re->main->tex.first; tex; tex= tex->id.next) { if(tex->id.us && tex->type==TEX_POINTDENSITY) { free_pointdensity(re, tex); } diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c index aa285401524..e8c95a34ac4 100644 --- a/source/blender/render/intern/source/sss.c +++ b/source/blender/render/intern/source/sss.c @@ -56,7 +56,6 @@ #include "DNA_material_types.h" #include "BKE_colortools.h" -#include "BKE_global.h" #include "BKE_main.h" #include "BKE_material.h" #include "BKE_node.h" @@ -993,7 +992,7 @@ void make_sss_tree(Render *re) re->i.infostr= "SSS preprocessing"; re->stats_draw(re->sdh, &re->i); - for(mat= G.main->mat.first; mat; mat= mat->id.next) + for(mat= re->main->mat.first; mat; mat= mat->id.next) if(mat->id.us && (mat->flag & MA_IS_USED) && (mat->sss_flag & MA_DIFF_SSS)) sss_create_tree_mat(re, mat); } diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c index 658748bdaeb..60565d0ff16 100644 --- a/source/blender/render/intern/source/texture.c +++ b/source/blender/render/intern/source/texture.c @@ -131,7 +131,7 @@ void init_render_textures(Render *re) { Tex *tex; - tex= G.main->tex.first; + tex= re->main->tex.first; while(tex) { if(tex->id.us) init_render_texture(re, tex); tex= tex->id.next; @@ -144,10 +144,10 @@ void end_render_texture(Tex *tex) ntreeEndExecTree(tex->nodetree); } -void end_render_textures(void) +void end_render_textures(Render *re) { Tex *tex; - for(tex= G.main->tex.first; tex; tex= tex->id.next) + for(tex= re->main->tex.first; tex; tex= tex->id.next) if(tex->id.us) end_render_texture(tex); } diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c index 64ba206bb86..076d6355585 100644 --- a/source/blender/render/intern/source/voxeldata.c +++ b/source/blender/render/intern/source/voxeldata.c @@ -39,7 +39,6 @@ #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" -#include "BKE_global.h" #include "BKE_image.h" #include "BKE_main.h" #include "BKE_modifier.h" @@ -318,7 +317,7 @@ void make_voxeldata(struct Render *re) re->stats_draw(re->sdh, &re->i); /* XXX: should be doing only textures used in this render */ - for (tex= G.main->tex.first; tex; tex= tex->id.next) { + for (tex= re->main->tex.first; tex; tex= tex->id.next) { if(tex->id.us && tex->type==TEX_VOXELDATA) { cache_voxeldata(re, tex); } diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 63dcda3c12e..867700980af 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -296,7 +296,7 @@ void wm_event_do_notifiers(bContext *C) /* XXX make lock in future, or separated derivedmesh users in scene */ if(!G.rendering) /* depsgraph & animation: update tagged datablocks */ - scene_update_tagged(win->screen->scene); + scene_update_tagged(CTX_data_main(C), win->screen->scene); } CTX_wm_window_set(C, NULL); diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 04f5175b1bf..e2293f79e95 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -314,7 +314,7 @@ void WM_read_file(bContext *C, char *name, ReportList *reports) CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first); ED_editors_init(C); - DAG_on_load_update(); + DAG_on_load_update(CTX_data_main(C)); #ifndef DISABLE_PYTHON /* run any texts that were loaded in and flagged as modules */ @@ -394,7 +394,7 @@ int WM_read_homefile(bContext *C, wmOperator *op) BKE_write_undo(C, "original"); /* save current state */ ED_editors_init(C); - DAG_on_load_update(); + DAG_on_load_update(CTX_data_main(C)); WM_event_add_notifier(C, NC_WM|ND_FILEREAD, NULL); CTX_wm_window_set(C, NULL); /* exits queues */ diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 9fff73165b8..2ab0a055156 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1629,8 +1629,8 @@ static int wm_link_append_exec(bContext *C, wmOperator *op) flag_all_listbases_ids(LIB_PRE_EXISTING, 0); /* recreate dependency graph to include new objects */ - DAG_scene_sort(scene); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, scene); + DAG_ids_flush_update(bmain, 0); BLO_blendhandle_close(bh); @@ -2954,15 +2954,17 @@ static int redraw_timer_exec(bContext *C, wmOperator *op) redraw_timer_window_swap(C); } else if (type==4) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); if(a & 1) scene->r.cfra--; else scene->r.cfra++; - scene_update_for_newframe(scene, scene->lay); + scene_update_for_newframe(bmain, scene, scene->lay); } else if (type==5) { /* play anim, return on same frame as started with */ + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); int tot= (scene->r.efra - scene->r.sfra) + 1; @@ -2972,7 +2974,7 @@ static int redraw_timer_exec(bContext *C, wmOperator *op) if(scene->r.cfra > scene->r.efra) scene->r.cfra= scene->r.sfra; - scene_update_for_newframe(scene, scene->lay); + scene_update_for_newframe(bmain, scene, scene->lay); redraw_timer_window_swap(C); } } -- cgit v1.2.3 From f3cca3e1929a59ea8dbf715645bef4712a530ef5 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 1 Aug 2010 12:57:01 +0000 Subject: 2.5: more G.main changes. --- source/blender/blenkernel/BKE_scene.h | 16 ++++++++-------- source/blender/blenkernel/intern/blender.c | 2 +- source/blender/blenkernel/intern/scene.c | 20 ++++++++++---------- source/blender/collada/DocumentImporter.cpp | 12 +++++++----- source/blender/editors/screen/screen_edit.c | 2 +- source/blender/editors/space_view3d/view3d_view.c | 2 +- source/blender/render/intern/source/pipeline.c | 2 +- 7 files changed, 29 insertions(+), 27 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index 878fca81378..96ef8d44cf4 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -31,16 +31,16 @@ #ifndef BKE_SCENE_H #define BKE_SCENE_H +struct AviCodecData; +struct Base; struct bglMats; -struct Scene; +struct Main; struct Object; -struct Base; -struct Text; -struct AviCodecData; struct QuicktimeCodecData; struct RenderData; +struct Scene; +struct Text; struct Text; -struct Main; #define SCE_COPY_EMPTY 0 #define SCE_COPY_LINK_OB 1 @@ -57,8 +57,8 @@ void free_scene(struct Scene *sce); struct Scene *add_scene(char *name); struct Base *object_in_scene(struct Object *ob, struct Scene *sce); -void set_scene_bg(struct Scene *sce); -struct Scene *set_scene_name(char *name); +void set_scene_bg(struct Main *bmain, struct Scene *sce); +struct Scene *set_scene_name(struct Main *bmain, char *name); struct Scene *copy_scene(struct Main *bmain, struct Scene *sce, int type); void unlink_scene(struct Main *bmain, struct Scene *sce, struct Scene *newsce); @@ -78,7 +78,7 @@ void scene_deselect_all(struct Scene *sce); void scene_select_base(struct Scene *sce, struct Base *selbase); /* checks for cycle, returns 1 if it's all OK */ -int scene_check_setscene(struct Scene *sce); +int scene_check_setscene(struct Main *bmain, struct Scene *sce); float BKE_curframe(struct Scene *scene); diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 64d07db024b..1a1f3a724ca 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -313,7 +313,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename) BLI_strncpy(G.main->name, filename, FILE_MAX); /* is guaranteed current file */ /* baseflags, groups, make depsgraph, etc */ - set_scene_bg(CTX_data_scene(C)); + set_scene_bg(G.main, CTX_data_scene(C)); MEM_freeN(bfd); } diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 811f8a81b06..48cef7e1bde 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -501,7 +501,7 @@ Base *object_in_scene(Object *ob, Scene *sce) return NULL; } -void set_scene_bg(Scene *scene) +void set_scene_bg(Main *bmain, Scene *scene) { Scene *sce; Base *base; @@ -511,18 +511,18 @@ void set_scene_bg(Scene *scene) int flag; /* check for cyclic sets, for reading old files but also for definite security (py?) */ - scene_check_setscene(scene); + scene_check_setscene(bmain, scene); /* can happen when switching modes in other scenes */ if(scene->obedit && !(scene->obedit->mode & OB_MODE_EDIT)) scene->obedit= NULL; /* deselect objects (for dataselect) */ - for(ob= G.main->object.first; ob; ob= ob->id.next) + for(ob= bmain->object.first; ob; ob= ob->id.next) ob->flag &= ~(SELECT|OB_FROMGROUP); /* group flags again */ - for(group= G.main->group.first; group; group= group->id.next) { + for(group= bmain->group.first; group; group= group->id.next) { go= group->gobject.first; while(go) { if(go->ob) go->ob->flag |= OB_FROMGROUP; @@ -531,12 +531,12 @@ void set_scene_bg(Scene *scene) } /* sort baselist */ - DAG_scene_sort(G.main, scene); + DAG_scene_sort(bmain, scene); /* ensure dags are built for sets */ for(sce= scene->set; sce; sce= sce->set) if(sce->theDag==NULL) - DAG_scene_sort(G.main, sce); + DAG_scene_sort(bmain, sce); /* copy layers and flags from bases to objects */ for(base= scene->base.first; base; base= base->next) { @@ -558,11 +558,11 @@ void set_scene_bg(Scene *scene) } /* called from creator.c */ -Scene *set_scene_name(char *name) +Scene *set_scene_name(Main *bmain, char *name) { Scene *sce= (Scene *)find_id("SC", name); if(sce) { - set_scene_bg(sce); + set_scene_bg(bmain, sce); printf("Scene switch: '%s' in file: '%s'\n", name, G.sce); return sce; } @@ -871,7 +871,7 @@ void scene_select_base(Scene *sce, Base *selbase) } /* checks for cycle, returns 1 if it's all OK */ -int scene_check_setscene(Scene *sce) +int scene_check_setscene(Main *bmain, Scene *sce) { Scene *scene; int a, totscene; @@ -879,7 +879,7 @@ int scene_check_setscene(Scene *sce) if(sce->set==NULL) return 1; totscene= 0; - for(scene= G.main->scene.first; scene; scene= scene->id.next) + for(scene= bmain->scene.first; scene; scene= scene->id.next) totscene++; for(a=0, scene=sce; scene->set; scene=scene->set, a++) { diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index a415b90ff08..2f1568f7fda 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -216,6 +216,7 @@ static int set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space return false; Object workob; + Main *bmain = CTX_data_main(C); Scene *sce = CTX_data_scene(C); ob->parent = par; @@ -243,8 +244,8 @@ static int set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA; par->recalc |= OB_RECALC_OB; - DAG_scene_sort(sce); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, sce); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return true; @@ -611,6 +612,7 @@ private: void link_armature(bContext *C, Object *ob, std::map& joint_by_uid, TransformReader *tm) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); ModifierData *md = ED_object_modifier_add(NULL, scene, ob, NULL, eModifierType_Armature); @@ -630,8 +632,8 @@ private: ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA; - DAG_scene_sort(scene); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, scene); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); #endif @@ -3132,7 +3134,7 @@ public: where_is_object(scene, job); // after parenting and layer change - DAG_scene_sort(scene); + DAG_scene_sort(CTX_data_main(C), scene); joint_objects[node->getUniqueId()] = job; } diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 78ec4fe3a01..8cee4a24dcc 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1426,7 +1426,7 @@ void ED_screen_set_scene(bContext *C, Scene *scene) } CTX_data_scene_set(C, scene); - set_scene_bg(scene); + set_scene_bg(CTX_data_main(C), scene); ED_update_for_newframe(C, 1); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 4de6a270245..5e00d17cfab 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1805,7 +1805,7 @@ static int game_engine_exec(bContext *C, wmOperator *op) RestoreState(C); //XXX restore_all_scene_cfra(scene_cfra_store); - set_scene_bg(startscene); + set_scene_bg(CTX_data_main(C), startscene); //XXX scene_update_for_newframe(bmain, scene, scene->lay); ED_area_tag_redraw(CTX_wm_area(C)); diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 0db1bdc9abd..dbb117d3542 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2146,7 +2146,7 @@ static void render_scene(Render *re, Scene *sce, int cfra) resc->lay= sce->lay; /* ensure scene has depsgraph, base flags etc OK */ - set_scene_bg(sce); + set_scene_bg(re->main, sce); /* copy callbacks */ resc->display_draw= re->display_draw; -- cgit v1.2.3 From e33d7d37c95922da92fd7b2dad97b21a80de521a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 1 Aug 2010 13:57:04 +0000 Subject: bugfix [#23129] alt-p in the texteditor doesn't work anymore recent commit cleared the __main__ namespace once a script finished which meant classes defined there would loose their namespace. now inset a new __main__ module into sys.modules for every script that runs, any classes that are registered will hold a reference to that modules namespace. --- source/blender/python/intern/bpy_interface.c | 94 +++++++++------------------- 1 file changed, 29 insertions(+), 65 deletions(-) (limited to 'source/blender') diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 83f407bab67..731c31af4fc 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -148,49 +148,23 @@ void BPY_update_modules( void ) /***************************************************************************** * Description: This function creates a new Python dictionary object. +* note: dict is owned by sys.modules["__main__"] module, reference is borrowed +* note: important we use the dict from __main__, this is what python expects + for 'pickle' to work as well as strings like this... + >> foo = 10 + >> print(__import__("__main__").foo) *****************************************************************************/ -static PyObject *CreateGlobalDictionary(bContext *C, const char *filename, PyObject *main_ns_orig) +static PyObject *CreateGlobalDictionary(bContext *C, const char *filename) { - PyObject *item; - PyObject *dict; + PyInterpreterState *interp= PyThreadState_GET()->interp; + PyObject *mod_main= PyModule_New("__main__"); + PyDict_SetItemString(interp->modules, "__main__", mod_main); + PyModule_AddObject(mod_main, "__builtins__", interp->builtins); + PyModule_AddStringConstant(mod_main, "__name__", "__main__"); + PyModule_AddStringConstant(mod_main, "__file__", filename); /* __file__ only for nice UI'ness */ - /* important we use the dict from __main__, this is what python expects - * for 'pickle' to work as well as strings like this... - - >> foo = 10 - >> print(__import__("__main__").foo) - */ - dict= PyModule_GetDict(PyImport_AddModule("__main__")); - PyDict_Merge(main_ns_orig, dict, 1); - PyDict_Clear(dict); - Py_INCREF(dict); - - /* using builtins rather then PyEval_GetBuiltins() - * print's many less items when printing, the modules __dict__ - * this is how python works so better follow. */ - PyDict_SetItemString(dict, "__builtins__", PyImport_AddModule("builtins")); - - - item = PyUnicode_FromString( "__main__" ); - PyDict_SetItemString( dict, "__name__", item ); - Py_DECREF(item); - - /* __file__ only for nice UI'ness */ - if(filename) { - PyObject *item = PyUnicode_FromString( filename ); - PyDict_SetItemString( dict, "__file__", item ); - Py_DECREF(item); - } - - return dict; -} - -static void CreateGlobalDictionary_Restore(PyObject *main_ns_orig) -{ - PyObject *main_ns= PyModule_GetDict(PyImport_AddModule("__main__")); - PyDict_Clear(main_ns); - PyDict_Merge(main_ns, main_ns_orig, 1); + return PyModule_GetDict(mod_main); } /* must be called before Py_Initialize */ @@ -346,7 +320,6 @@ void BPY_end_python( void ) int BPY_run_python_script( bContext *C, const char *fn, struct Text *text, struct ReportList *reports) { PyObject *py_dict, *py_result= NULL; - PyObject *main_ns_orig= PyDict_New(); PyGILState_STATE gilstate; if (fn==NULL && text==NULL) { @@ -358,7 +331,7 @@ int BPY_run_python_script( bContext *C, const char *fn, struct Text *text, struc if (text) { char fn_dummy[FILE_MAXDIR]; bpy_text_filename_get(fn_dummy, text); - py_dict = CreateGlobalDictionary(C, fn_dummy, main_ns_orig); + py_dict = CreateGlobalDictionary(C, fn_dummy); if( !text->compiled ) { /* if it wasn't already compiled, do it now */ char *buf = txt_to_buf( text ); @@ -379,7 +352,7 @@ int BPY_run_python_script( bContext *C, const char *fn, struct Text *text, struc else { FILE *fp= fopen(fn, "r"); - py_dict = CreateGlobalDictionary(C, fn, main_ns_orig); + py_dict = CreateGlobalDictionary(C, fn); if(fp) { #ifdef _WIN32 @@ -413,11 +386,8 @@ int BPY_run_python_script( bContext *C, const char *fn, struct Text *text, struc } else { Py_DECREF( py_result ); } - - CreateGlobalDictionary_Restore(main_ns_orig); - Py_DECREF(main_ns_orig); - - Py_DECREF(py_dict); + + PyDict_SetItemString(PyThreadState_GET()->interp->modules, "__main__", Py_None); bpy_context_clear(C, &gilstate); @@ -555,7 +525,7 @@ int BPY_run_python_script_space(const char *modulename, const char *func) Py_XDECREF(module); - Py_DECREF(py_dict); + PyDict_SetItemString(PyThreadState_GET()->interp->modules, "__main__", Py_None); PyGILState_Release(gilstate); return 1; @@ -566,8 +536,7 @@ int BPY_run_python_script_space(const char *modulename, const char *func) int BPY_eval_button(bContext *C, const char *expr, double *value) { PyGILState_STATE gilstate; - PyObject *dict, *mod, *retval; - PyObject *main_ns_orig= PyDict_New(); + PyObject *py_dict, *mod, *retval; int error_ret = 0; if (!value || !expr) return -1; @@ -579,11 +548,11 @@ int BPY_eval_button(bContext *C, const char *expr, double *value) bpy_context_set(C, &gilstate); - dict= CreateGlobalDictionary(C, NULL, main_ns_orig); + py_dict= CreateGlobalDictionary(C, ""); mod = PyImport_ImportModule("math"); if (mod) { - PyDict_Merge(dict, PyModule_GetDict(mod), 0); /* 0 - dont overwrite existing values */ + PyDict_Merge(py_dict, PyModule_GetDict(mod), 0); /* 0 - dont overwrite existing values */ Py_DECREF(mod); } else { /* highly unlikely but possibly */ @@ -591,7 +560,7 @@ int BPY_eval_button(bContext *C, const char *expr, double *value) PyErr_Clear(); } - retval = PyRun_String(expr, Py_eval_input, dict, dict); + retval = PyRun_String(expr, Py_eval_input, py_dict, py_dict); if (retval == NULL) { error_ret= -1; @@ -628,11 +597,9 @@ int BPY_eval_button(bContext *C, const char *expr, double *value) if(error_ret) { BPy_errors_to_report(CTX_wm_reports(C)); } - - CreateGlobalDictionary_Restore(main_ns_orig); - Py_DECREF(main_ns_orig); - Py_DECREF(dict); + PyDict_SetItemString(PyThreadState_GET()->interp->modules, "__main__", Py_None); + bpy_context_clear(C, &gilstate); return error_ret; @@ -641,8 +608,7 @@ int BPY_eval_button(bContext *C, const char *expr, double *value) int BPY_eval_string(bContext *C, const char *expr) { PyGILState_STATE gilstate; - PyObject *dict, *retval; - PyObject *main_ns_orig= PyDict_New(); + PyObject *py_dict, *retval; int error_ret = 0; if (!expr) return -1; @@ -653,9 +619,9 @@ int BPY_eval_string(bContext *C, const char *expr) bpy_context_set(C, &gilstate); - dict= CreateGlobalDictionary(C, NULL, main_ns_orig); + py_dict= CreateGlobalDictionary(C, ""); - retval = PyRun_String(expr, Py_eval_input, dict, dict); + retval = PyRun_String(expr, Py_eval_input, py_dict, py_dict); if (retval == NULL) { error_ret= -1; @@ -666,12 +632,10 @@ int BPY_eval_string(bContext *C, const char *expr) Py_DECREF(retval); } - CreateGlobalDictionary_Restore(main_ns_orig); - Py_DECREF(main_ns_orig); + PyDict_SetItemString(PyThreadState_GET()->interp->modules, "__main__", Py_None); - Py_DECREF(dict); bpy_context_clear(C, &gilstate); - + return error_ret; } -- cgit v1.2.3 From 4a63d2a2d28df692e57a2795b03bbd918f3f50e7 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 1 Aug 2010 14:08:33 +0000 Subject: Fix for crash due to last commit. --- source/blender/editors/util/ed_util.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/blender') diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index cd2b6a793b7..3491c1b4df2 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -79,6 +79,9 @@ void ED_editors_exit(bContext *C) { Main *bmain= CTX_data_main(C); Scene *sce; + + if(!bmain) + return; /* frees all editmode undos */ undo_editmode_clear(); -- cgit v1.2.3 From 7524967238698ca770a76365a782f299c5d2ac86 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 1 Aug 2010 14:23:06 +0000 Subject: - new __main__ module wasnt de-referenced after adding into sys.modules - made int buttons round floats better 10.6 --> 11 --- source/blender/editors/interface/interface.c | 2 +- source/blender/python/intern/bpy_interface.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'source/blender') diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 7b67a458ae2..38c11e507cc 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1644,7 +1644,7 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str) value= atof(str); #endif - if(!ui_is_but_float(but)) value= (int)value; + if(!ui_is_but_float(but)) value= (int)floor(value + 0.5); if(but->type==NUMABS) value= fabs(value); /* not that we use hard limits here */ diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 731c31af4fc..901e8e8e103 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -159,6 +159,7 @@ static PyObject *CreateGlobalDictionary(bContext *C, const char *filename) PyInterpreterState *interp= PyThreadState_GET()->interp; PyObject *mod_main= PyModule_New("__main__"); PyDict_SetItemString(interp->modules, "__main__", mod_main); + Py_DECREF(mod_main); /* sys.modules owns now */ PyModule_AddObject(mod_main, "__builtins__", interp->builtins); PyModule_AddStringConstant(mod_main, "__name__", "__main__"); -- cgit v1.2.3 From 0be152501e515244f9e565a38dd36819fdc8d78d Mon Sep 17 00:00:00 2001 From: Daniel Genrich Date: Sun, 1 Aug 2010 15:00:53 +0000 Subject: Smoke: - Bugfix for not cleared smoke sim when doing alt-a and waiting for 2 sim cycles to complete --- source/blender/blenkernel/intern/smoke.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 15c7d3b4678..97eb3aa866c 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -296,7 +296,7 @@ int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, Derive return 1; } - return 1; + return 2; } static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs) @@ -1325,6 +1325,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM int startframe, endframe, framenr; float timescale; int cache_result = 0, cache_result_wt = 0; + int did_init = 0; framenr = scene->r.cfra; @@ -1354,7 +1355,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM // printf("startframe: %d, framenr: %d\n", startframe, framenr); - if(!smokeModifier_init(smd, ob, scene, dm)) + if(!(did_init = smokeModifier_init(smd, ob, scene, dm))) { printf("bad smokeModifier_init\n"); return; @@ -1411,8 +1412,18 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM smoke_dissolve(sds->fluid, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG); smoke_step(sds->fluid, smd->time, scene->r.frs_sec / scene->r.frs_sec_base); } + else + { + /* Smoke did not load cache and was not reset but we're on startframe */ + /* So now reinit the smoke since it was not done yet */ + if(did_init == 2) + { + smokeModifier_reset(smd); + smokeModifier_init(smd, ob, scene, dm); + } + } - // create shadows before writing cache so we get nice shadows for sstartframe, too + // create shadows before writing cache so we get nice shadows for startframe, too if(get_lamp(scene, light)) smoke_calc_transparency(sds->shadow, smoke_get_density(sds->fluid), sds->p0, sds->p1, sds->res, sds->dx, light, calc_voxel_transp, -7.0*sds->dx); -- cgit v1.2.3 From a3e58a951ac94741f74efa3e6a67d219216bb78d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 1 Aug 2010 15:15:57 +0000 Subject: set blender binary name for python --- source/blender/python/intern/bpy_interface.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source/blender') diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 901e8e8e103..d20f2a23664 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -228,9 +228,12 @@ void BPY_start_python( int argc, char **argv ) { PyThreadState *py_tstate = NULL; - BPY_start_python_path(); /* allow to use our own included python */ + /* not essential but nice to set our name */ + static wchar_t bprogname_wchar[FILE_MAXDIR+FILE_MAXFILE]; /* python holds a reference */ + utf8towchar(bprogname_wchar, bprogname); + Py_SetProgramName(bprogname_wchar); - // Py_SetProgramName(); // extern char bprogname[FILE_MAXDIR+FILE_MAXFILE]; + BPY_start_python_path(); /* allow to use our own included python */ Py_Initialize( ); -- cgit v1.2.3 From 7e555711752cd00ed0d613f3c89a457512031b12 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 1 Aug 2010 15:42:22 +0000 Subject: bugfix [#23134] uv project modifier not working. own recent commit introduced this bug. would like to have this working correctly but for now commenting. --- source/blender/editors/interface/interface_layout.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender') diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index b6f4dcc0356..c56b3c31222 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1115,7 +1115,11 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, char *str, ui ID *id= itemptr.data; char name_ui[32]; +#if 0 /* this name is used for a string comparison and can't be modified, TODO */ name_uiprefix_id(name_ui, id); +#else + strcpy(name_ui, id->name+2); +#endif name= BLI_strdup(name_ui); iconid= ui_id_icon_get((bContext*)C, id, 1); } -- cgit v1.2.3 From 4e031236d561e23a53965d3f333545265f1961e4 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sun, 1 Aug 2010 16:35:27 +0000 Subject: Compile fix for recent changes. Function needed 1 more argument. Chingiz can you please check? --- source/blender/collada/DocumentImporter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender') diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 2f1568f7fda..ab246aedee0 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -615,7 +615,7 @@ private: Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - ModifierData *md = ED_object_modifier_add(NULL, scene, ob, NULL, eModifierType_Armature); + ModifierData *md = ED_object_modifier_add(NULL, NULL, scene, ob, NULL, eModifierType_Armature); ((ArmatureModifierData *)md)->object = ob_arm; copy_m4_m4(ob->obmat, bind_shape_matrix); -- cgit v1.2.3 From 0753766a578f78b003e038370abcde8732ce45db Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sun, 1 Aug 2010 16:38:30 +0000 Subject: Fix for the fix. --- source/blender/collada/DocumentImporter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender') diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index ab246aedee0..b9052d23511 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -615,7 +615,7 @@ private: Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - ModifierData *md = ED_object_modifier_add(NULL, NULL, scene, ob, NULL, eModifierType_Armature); + ModifierData *md = ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Armature); ((ArmatureModifierData *)md)->object = ob_arm; copy_m4_m4(ob->obmat, bind_shape_matrix); -- cgit v1.2.3 From 9b006d6d00c72de51b97e1b2c96b2df09db6b72b Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 1 Aug 2010 20:36:24 +0000 Subject: Fix preview render crash after recent G.main changes. --- source/blender/editors/object/object_bake.c | 8 ++++++-- source/blender/editors/render/render_preview.c | 2 +- source/blender/render/extern/include/RE_pipeline.h | 4 ++-- source/blender/render/intern/source/convertblender.c | 3 ++- source/blender/render/intern/source/pipeline.c | 3 ++- 5 files changed, 13 insertions(+), 7 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 9f9d41147b6..6261c33a6f7 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -94,6 +94,7 @@ static ScrArea *biggest_image_area(bScreen *screen) typedef struct BakeRender { Render *re; + Main *main; Scene *scene; struct Object *actob; int tot, ready; @@ -139,6 +140,7 @@ static void init_bake_internal(BakeRender *bkr, bContext *C) Scene *scene= CTX_data_scene(C); bkr->sa= biggest_image_area(CTX_wm_screen(C)); /* can be NULL */ + bkr->main= CTX_data_main(C); bkr->scene= scene; bkr->actob= (scene->r.bake_flag & R_BAKE_TO_ACTIVE) ? OBACT : NULL; bkr->re= RE_NewRender("_Bake View_"); @@ -196,6 +198,7 @@ static void bake_startjob(void *bkv, short *stop, short *do_update, float *progr { BakeRender *bkr= bkv; Scene *scene= bkr->scene; + Main *bmain= bkr->main; bkr->stop= stop; bkr->do_update= do_update; @@ -204,7 +207,7 @@ static void bake_startjob(void *bkv, short *stop, short *do_update, float *progr RE_test_break_cb(bkr->re, NULL, thread_break); G.afbreek= 0; /* blender_test_break uses this global */ - RE_Database_Baking(bkr->re, scene, scene->lay, scene->r.bake_mode, bkr->actob); + RE_Database_Baking(bkr->re, bmain, scene, scene->lay, scene->r.bake_mode, bkr->actob); /* baking itself is threaded, cannot use test_break in threads. we also update optional imagewindow */ bkr->tot= RE_bake_shade_all_selected(bkr->re, scene->r.bake_mode, bkr->actob, bkr->do_update, bkr->progress); @@ -284,6 +287,7 @@ static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *_eve static int bake_image_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -302,7 +306,7 @@ static int bake_image_exec(bContext *C, wmOperator *op) RE_test_break_cb(bkr.re, NULL, thread_break); G.afbreek= 0; /* blender_test_break uses this global */ - RE_Database_Baking(bkr.re, scene, scene->lay, scene->r.bake_mode, (scene->r.bake_flag & R_BAKE_TO_ACTIVE)? OBACT: NULL); + RE_Database_Baking(bkr.re, bmain, scene, scene->lay, scene->r.bake_mode, (scene->r.bake_flag & R_BAKE_TO_ACTIVE)? OBACT: NULL); /* baking itself is threaded, cannot use test_break in threads */ BLI_init_threads(&threads, do_bake_render, 1); diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index d4c90a7f24e..49395f7fb56 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -975,7 +975,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs ((Camera *)sce->camera->data)->lens *= (float)sp->sizey/(float)sizex; /* entire cycle for render engine */ - RE_PreviewRender(re, sce); + RE_PreviewRender(re, G.main, sce); ((Camera *)sce->camera->data)->lens= oldlens; diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index bc25c9857d5..af7f3fcf387 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -213,7 +213,7 @@ void RE_BlenderFrame(struct Render *re, struct Main *bmain, struct Scene *scene, void RE_BlenderAnim(struct Render *re, struct Main *bmain, struct Scene *scene, unsigned int lay, int sfra, int efra, int tfra, struct ReportList *reports); /* main preview render call */ -void RE_PreviewRender(struct Render *re, struct Scene *scene); +void RE_PreviewRender(struct Render *re, struct Main *bmain, struct Scene *scene); void RE_ReadRenderResult(struct Scene *scene, struct Scene *scenode); void RE_WriteRenderResult(RenderResult *rr, char *filename, int compress); @@ -249,7 +249,7 @@ void RE_zbuf_accumulate_vecblur(struct NodeBlurData *nbd, int xsize, int ysize, #define RE_BAKE_DISPLACEMENT 5 #define RE_BAKE_SHADOW 6 -void RE_Database_Baking(struct Render *re, struct Scene *scene, unsigned int lay, int type, struct Object *actob); +void RE_Database_Baking(struct Render *re, struct Main *bmain, struct Scene *scene, unsigned int lay, int type, struct Object *actob); void RE_DataBase_GetView(struct Render *re, float mat[][4]); void RE_GetCameraWindow(struct Render *re, struct Object *camera, int frame, float mat[][4]); diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 45ffcc72bc4..e17e3a3c600 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -5560,12 +5560,13 @@ void RE_Database_FromScene_Vectors(Render *re, Scene *sce, unsigned int lay) RE_BAKE_DISPLACEMENT:for baking, no lamps, only selected objects RE_BAKE_SHADOW: for baking, only shadows, but all objects */ -void RE_Database_Baking(Render *re, Scene *scene, unsigned int lay, int type, Object *actob) +void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay, int type, Object *actob) { float mat[4][4]; float amb[3]; int onlyselected, nolamps; + re->main= bmain; re->scene= scene; re->lay= lay; diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index dbb117d3542..e9004f6a90f 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2975,7 +2975,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, unsigned int lay, int G.rendering= 0; } -void RE_PreviewRender(Render *re, Scene *sce) +void RE_PreviewRender(Render *re, Main *bmain, Scene *sce) { int winx, winy; @@ -2984,6 +2984,7 @@ void RE_PreviewRender(Render *re, Scene *sce) RE_InitState(re, NULL, &sce->r, NULL, winx, winy, NULL); + re->main = bmain; re->scene = sce; re->lay = sce->lay; -- cgit v1.2.3 From c92e3225f3aa5fadb9ad0920dffbdc0c0209a98a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 1 Aug 2010 22:20:45 +0000 Subject: patch [#23144] bpy.Image.gl_load() -- fix from Dan Eicher (dna) - image.gl_load() was using GL_UNSIGNED_INT rather then GL_UNSIGNED_BYTE channel type. - changed image.gl_load() to use the image clamp settings (patch had this as an extra argument). --- source/blender/makesrna/intern/rna_image_api.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/blender') diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index 289530d4f32..efe3d39d6cd 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -153,10 +153,12 @@ static int rna_Image_gl_load(Image *image, ReportList *reports, int filter, int error = (int)gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_INT, ibuf->rect); if (!error) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, image->tpageflag & IMA_CLAMP_U ? GL_CLAMP : GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, image->tpageflag & IMA_CLAMP_V ? GL_CLAMP : GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLint)filter); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLint)mag); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ibuf->x, ibuf->y, 0, GL_RGBA, GL_UNSIGNED_INT, ibuf->rect); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ibuf->x, ibuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); error = (int)glGetError(); } -- cgit v1.2.3