[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18521] branches/blender2.5/blender/source /blender/editors/object: 2.5
Revision: 18521 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=18521 Author: mfoxdogg Date: 2009-01-15 11:02:45 +0100 (Thu, 15 Jan 2009) Log Message: --- 2.5 * small commit, ported make dupli real Modified Paths: -- branches/blender2.5/blender/source/blender/editors/object/object_edit.c branches/blender2.5/blender/source/blender/editors/object/object_intern.h branches/blender2.5/blender/source/blender/editors/object/object_ops.c Modified: branches/blender2.5/blender/source/blender/editors/object/object_edit.c === --- branches/blender2.5/blender/source/blender/editors/object/object_edit.c 2009-01-15 05:51:00 UTC (rev 18520) +++ branches/blender2.5/blender/source/blender/editors/object/object_edit.c 2009-01-15 10:02:45 UTC (rev 18521) @@ -2293,6 +2293,44 @@ prop = RNA_def_property(ot-srna, type, PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, prop_make_track_types); } + +/* * Make Dupli Real * */ + +static int object_make_dupli_real_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + ScrArea *sa= CTX_wm_area(C); + View3D *v3d= sa-spacedata.first; + + clear_id_newpoins(); + + CTX_DATA_BEGIN(C, Base*, base, visible_bases) { + make_object_duplilist_real(scene, v3d, base); + } + CTX_DATA_END; + + DAG_scene_sort(CTX_data_scene(C)); + ED_anim_dag_flush_update(C); + WM_event_add_notifier(C, NC_SCENE, CTX_data_scene(C)); + + ED_undo_push(C,Make duplicates real); + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_make_dupli_real(wmOperatorType *ot) +{ + + /* identifiers */ + ot-name= Make Dupli Real; + ot-idname= OBJECT_OT_make_dupli_real; + + /* api callbacks */ + ot-invoke= WM_operator_confirm; + ot-exec= object_make_dupli_real_exec; + + ot-poll= ED_operator_scene_editable; +} /* *** Set Object Center ** */ static EnumPropertyItem prop_set_center_types[] = { Modified: branches/blender2.5/blender/source/blender/editors/object/object_intern.h === --- branches/blender2.5/blender/source/blender/editors/object/object_intern.h 2009-01-15 05:51:00 UTC (rev 18520) +++ branches/blender2.5/blender/source/blender/editors/object/object_intern.h 2009-01-15 10:02:45 UTC (rev 18521) @@ -62,6 +62,7 @@ void OBJECT_OT_set_slowparent(struct wmOperatorType *ot); void OBJECT_OT_clear_slowparent(struct wmOperatorType *ot); void OBJECT_OT_set_center(struct wmOperatorType *ot); +void OBJECT_OT_make_dupli_real(struct wmOperatorType *ot); /* editlattice.c */ Modified: branches/blender2.5/blender/source/blender/editors/object/object_ops.c === --- branches/blender2.5/blender/source/blender/editors/object/object_ops.c 2009-01-15 05:51:00 UTC (rev 18520) +++ branches/blender2.5/blender/source/blender/editors/object/object_ops.c 2009-01-15 10:02:45 UTC (rev 18521) @@ -83,6 +83,7 @@ WM_operatortype_append(OBJECT_OT_set_slowparent); WM_operatortype_append(OBJECT_OT_clear_slowparent); WM_operatortype_append(OBJECT_OT_set_center); + WM_operatortype_append(OBJECT_OT_make_dupli_real); } void ED_keymap_object(wmWindowManager *wm) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18523] branches/blender2.5/blender/source /blender: 2.5
Revision: 18523 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=18523 Author: ton Date: 2009-01-15 16:01:39 +0100 (Thu, 15 Jan 2009) Log Message: --- 2.5 - Depricated another bunch of globals; all the totobj, totmesh, totvert, and so on. - All code that needs such totals now count it themselves, these stats were not supposed to be reliable - Editmesh now stores and manages own totals. - Todo: make a scene-stats that tracks notifiers. Bugfix: selecting failed in editmesh, backbuffer stuff was too late, already using index ranges before it was set. Modified Paths: -- branches/blender2.5/blender/source/blender/blenkernel/BKE_global.h branches/blender2.5/blender/source/blender/blenkernel/intern/booleanops.c branches/blender2.5/blender/source/blender/blenkernel/intern/exotic.c branches/blender2.5/blender/source/blender/blenkernel/intern/object.c branches/blender2.5/blender/source/blender/blenlib/BLI_editVert.h branches/blender2.5/blender/source/blender/editors/curve/editcurve.c branches/blender2.5/blender/source/blender/editors/include/ED_view3d.h branches/blender2.5/blender/source/blender/editors/mesh/editmesh.c branches/blender2.5/blender/source/blender/editors/mesh/editmesh_add.c branches/blender2.5/blender/source/blender/editors/mesh/editmesh_lib.c branches/blender2.5/blender/source/blender/editors/mesh/editmesh_mods.c branches/blender2.5/blender/source/blender/editors/mesh/editmesh_tools.c branches/blender2.5/blender/source/blender/editors/mesh/mesh_intern.h branches/blender2.5/blender/source/blender/editors/object/object_edit.c branches/blender2.5/blender/source/blender/editors/space_view3d/drawobject.c branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_draw.c branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_select.c branches/blender2.5/blender/source/blender/editors/transform/transform_conversions.c branches/blender2.5/blender/source/blender/editors/transform/transform_orientations.c branches/blender2.5/blender/source/blender/makesdna/DNA_scene_types.h Modified: branches/blender2.5/blender/source/blender/blenkernel/BKE_global.h === --- branches/blender2.5/blender/source/blender/blenkernel/BKE_global.h 2009-01-15 10:55:48 UTC (rev 18522) +++ branches/blender2.5/blender/source/blender/blenkernel/BKE_global.h 2009-01-15 15:01:39 UTC (rev 18523) @@ -52,7 +52,6 @@ /* active pointers */ struct Main *main; - char editModeTitleExtra[64]; /* fonts, allocated global data */ struct BMF_Font *font, *fonts, *fontss; @@ -65,12 +64,7 @@ /* strings of recent opend files */ struct ListBase recent_files; - - /* totals */ - int totobj, totlamp, totobjsel, totcurve, totmesh; - int totbone, totbonesel; - int totvert, totedge, totface, totvertsel, totedgesel, totfacesel; - + short afbreek, moving; short background; short winpos, displaymode; /* used to be in Render */ @@ -108,10 +102,6 @@ /* Janco's playing ground */ struct bSoundListener* listener; - /* Test thingy for Nzc */ - int compat; /* toggle compatibility mode for edge rendering */ - int notonlysolid;/* T- also edge-render transparent faces */ - /* ndof device found ? */ int ndofdevice; Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/booleanops.c === --- branches/blender2.5/blender/source/blender/blenkernel/intern/booleanops.c 2009-01-15 10:55:48 UTC (rev 18522) +++ branches/blender2.5/blender/source/blender/blenkernel/intern/booleanops.c 2009-01-15 15:01:39 UTC (rev 18523) @@ -268,7 +268,6 @@ // Initialize the mesh data associated with this object. ob_new-data= add_mesh(Mesh); - G.totmesh++; // Finally assign the object type. ob_new-type= OB_MESH; Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/exotic.c === --- branches/blender2.5/blender/source/blender/blenkernel/intern/exotic.c 2009-01-15 10:55:48 UTC (rev 18522) +++ branches/blender2.5/blender/source/blender/blenkernel/intern/exotic.c 2009-01-15 15:01:39 UTC (rev 18523) @@ -2430,7 +2430,7 @@ if(em) { - fprintf(fp, %d\n, G.totvert); + fprintf(fp, %d\n, em-totvert); tot= 0; eve= em-verts.first; @@ -3457,7 +3457,7 @@ } else { *o = NULL; - *m = add_mesh(Mesh); G.totmesh++; + *m =
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18524] branches/blender2.5/blender/source /blender: 2.5
Revision: 18524 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=18524 Author: ton Date: 2009-01-15 17:07:39 +0100 (Thu, 15 Jan 2009) Log Message: --- 2.5 SHIFT+A add object back, no primitives in it though... later! Modified Paths: -- branches/blender2.5/blender/source/blender/editors/object/object_edit.c branches/blender2.5/blender/source/blender/editors/object/object_intern.h branches/blender2.5/blender/source/blender/editors/object/object_ops.c branches/blender2.5/blender/source/blender/windowmanager/intern/wm_operators.c Modified: branches/blender2.5/blender/source/blender/editors/object/object_edit.c === --- branches/blender2.5/blender/source/blender/editors/object/object_edit.c 2009-01-15 15:01:39 UTC (rev 18523) +++ branches/blender2.5/blender/source/blender/editors/object/object_edit.c 2009-01-15 16:07:39 UTC (rev 18524) @@ -266,55 +266,80 @@ } } +/* *** add object operator ** */ +static EnumPropertyItem prop_object_types[] = { + {OB_EMPTY, EMPTY, Empty, }, + {OB_MESH, MESH, Mesh, }, + {OB_CURVE, CURVE, Curve, }, + {OB_SURF, SURFACE, Surface, }, + {OB_FONT, TEXT, Text, }, + {OB_MBALL, META, Meta, }, + {OB_LAMP, LAMP, Lamp, }, + {OB_CAMERA, CAMERA, Camera, }, + {OB_ARMATURE, ARMATURE, Armature, }, + {OB_LATTICE, LATTICE, Lattice, }, + {0, NULL, NULL, NULL} +}; + + + void add_object_draw(Scene *scene, View3D *v3d, int type) /* for toolbox or menus, only non-editmode stuff */ { + /* keep here to get things compile, remove later */ +} + +static int object_add_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + ScrArea *sa= CTX_wm_area(C); Object *ob; + View3D *v3d= NULL; + int type= RNA_int_get(op-ptr, type); -// ED_view3d_exit_paint_modes(C); - -// XXX if (obedit) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* freedata, and undo */ + /* hrms, this is editor level operator */ + ED_view3d_exit_paint_modes(C); + + if (CTX_data_edit_object(C)) + ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* freedata, and undo */ + + /* deselects all, sets scene-basact */ ob= add_object(scene, type); -// ED_base_object_activate(C, BASACT); + /* editor level activate, notifiers */ + ED_base_object_activate(C, BASACT); + + /* more editor stuff */ + if(sa sa-spacetype==SPACE_VIEW3D) + v3d= sa-spacedata.first; ED_object_base_init_from_view(scene, v3d, BASACT); - /* only undo pushes on objects without editmode... */ - if(type==OB_EMPTY) BIF_undo_push(Add Empty); - else if(type==OB_LAMP) { - BIF_undo_push(Add Lamp); - reshadeall_displist(scene); /* only frees */ - } - else if(type==OB_LATTICE) BIF_undo_push(Add Lattice); - else if(type==OB_CAMERA) BIF_undo_push(Add Camera); - - allqueue(REDRAWVIEW3D, 0); - -// XXX redraw_test_buttons(OBACT); - - allqueue(REDRAWALL, 0); - -// XXX deselect_all_area_oops(); -// XXX set_select_flag_oops(); + DAG_scene_sort(scene); - DAG_scene_sort(scene); - allqueue(REDRAWINFO, 1);/* 1, because header-win==0! */ + return OPERATOR_FINISHED; } -void add_objectLamp(Scene *scene, View3D *v3d, short type) +void OBJECT_OT_object_add(wmOperatorType *ot) { - Lamp *la; - - if(scene-obedit==NULL) { // XXX get from context - add_object_draw(scene, v3d, OB_LAMP); - ED_object_base_init_from_view(scene, v3d, BASACT); - } + PropertyRNA *prop; - la = BASACT-object-data; - la-type = type; - - allqueue(REDRAWALL, 0); + /* identifiers */ + ot-name= Add Object; + ot-idname= OBJECT_OT_object_add; + + /* api callbacks */ + ot-invoke= WM_menu_invoke; + ot-exec= object_add_exec; + + ot-poll= ED_operator_scene_editable; + ot-flag= OPTYPE_REGISTER; + + prop = RNA_def_property(ot-srna, type, PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, prop_object_types); } + +/* *** */ + /* remove base from a specific scene */ /* note: now unlinks constraints as well */ void ED_base_object_free_and_unlink(Scene *scene, Base *base) @@ -1138,18 +1163,6 @@ /* * */ /* ** Select by Type ** */ -static EnumPropertyItem prop_select_object_types[] = { - {OB_EMPTY, EMPTY, Empty, }, - {OB_MESH, MESH, Mesh, }, - {OB_CURVE, CURVE, Curve, }, - {OB_SURF, SURFACE, Surface, }, - {OB_FONT, TEXT, Text, }, -
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18525] branches/blender2.5/blender/source /blender/makesrna/intern: RNA
Revision: 18525 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=18525 Author: blendix Date: 2009-01-15 17:18:32 +0100 (Thu, 15 Jan 2009) Log Message: --- RNA * Attempt to fix CMake build on some systems were it could not find the rna_*_gen.c files, now it specifies full path. Modified Paths: -- branches/blender2.5/blender/source/blender/makesrna/intern/CMakeLists.txt branches/blender2.5/blender/source/blender/makesrna/intern/makesrna.c Modified: branches/blender2.5/blender/source/blender/makesrna/intern/CMakeLists.txt === --- branches/blender2.5/blender/source/blender/makesrna/intern/CMakeLists.txt 2009-01-15 16:07:39 UTC (rev 18524) +++ branches/blender2.5/blender/source/blender/makesrna/intern/CMakeLists.txt 2009-01-15 16:18:32 UTC (rev 18525) @@ -71,52 +71,7 @@ rna_wm.c rna_world.c) -SET(GENSRC - rna_action_gen.c - rna_actuator_gen.c - rna_armature_gen.c - rna_brush_gen.c - rna_camera_gen.c - rna_cloth_gen.c - rna_color_gen.c - rna_constraint_gen.c - rna_controller_gen.c - rna_curve_gen.c - rna_fluidsim_gen.c - rna_group_gen.c - rna_ID_gen.c - rna_image_gen.c - rna_ipo_gen.c - rna_key_gen.c - rna_lamp_gen.c - rna_lattice_gen.c - rna_main_gen.c - rna_material_gen.c - rna_mesh_gen.c - rna_meta_gen.c - rna_modifier_gen.c - rna_nodetree_gen.c - rna_object_gen.c - rna_object_force_gen.c - rna_packedfile_gen.c - rna_particle_gen.c - rna_pose_gen.c - rna_property_gen.c - rna_radio_gen.c - rna_rna_gen.c - rna_scene_gen.c - rna_screen_gen.c - rna_scriptlink_gen.c - rna_sensor_gen.c - rna_sequence_gen.c - rna_sound_gen.c - rna_space_gen.c - rna_text_gen.c - rna_texture_gen.c - rna_userdef_gen.c - rna_vfont_gen.c - rna_wm_gen.c - rna_world_gen.c) +STRING(REGEX REPLACE rna_([a-zA-Z0-9_-]*).c ${CMAKE_CURRENT_BINARY_DIR}/rna_\\1_gen.c GENSRC ${DEFSRC}) SET(SRC makesrna.c @@ -135,7 +90,7 @@ # Output rna_*_gen.c ADD_CUSTOM_COMMAND( OUTPUT ${GENSRC} - COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesrna ${CMAKE_CURRENT_BINARY_DIR}/ ${CMAKE_SOURCE_DIR}/source/blender/makesrna/ + COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesrna ${CMAKE_CURRENT_BINARY_DIR}/ DEPENDS makesrna ) Modified: branches/blender2.5/blender/source/blender/makesrna/intern/makesrna.c === --- branches/blender2.5/blender/source/blender/makesrna/intern/makesrna.c 2009-01-15 16:07:39 UTC (rev 18524) +++ branches/blender2.5/blender/source/blender/makesrna/intern/makesrna.c 2009-01-15 16:18:32 UTC (rev 18525) @@ -962,7 +962,7 @@ {rna_world.c, RNA_def_world}, {NULL, NULL}}; -static void rna_generate(BlenderRNA *brna, char *basedirectory, FILE *f, char *filename) +static void rna_generate(BlenderRNA *brna, FILE *f, char *filename) { StructDefRNA *ds; PropertyDefRNA *dp; @@ -1014,7 +1014,7 @@ fclose(fp); } -static int rna_preprocess(char *basedirectory, char *outfile) +static int rna_preprocess(char *outfile) { BlenderRNA *brna; StructDefRNA *ds; @@ -1059,7 +1059,7 @@ status = 1; } else { - rna_generate(brna, basedirectory, file, PROCESS_ITEMS[i].filename); + rna_generate(brna, file, PROCESS_ITEMS[i].filename); fclose(file); status= (DefRNA.error != 0); @@ -1073,29 +1073,17 @@ return status; } -#ifndef BASE_HEADER -#define BASE_HEADER ../ -#endif - int main(int argc, char **argv) { int totblock, return_status = 0; - if (argc!=2 argc!=3) { - printf(Usage: %s outdirectory/ [base directory]\n, argv[0]); + if (argc2) { + printf(Usage: %s outdirectory/\n, argv[0]); return_status = 1; } else { - char baseDirectory[256]; - printf(Running makesrna, program versions %s\n, RNA_VERSION_DATE); - - if (argc==3) - strcpy(baseDirectory, argv[2]); - else - strcpy(baseDirectory, BASE_HEADER); - - return_status= rna_preprocess(baseDirectory, argv[1]); + return_status= rna_preprocess(argv[1]); } totblock= MEM_get_memory_blocks_in_use(); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18526] branches/blender2.5/blender/source /blender/editors/sculpt/sculpt.c: Brought back grab brush in sculpt mode, also removed old BrushAction stru
Revision: 18526 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=18526 Author: nicholasbishop Date: 2009-01-15 17:57:17 +0100 (Thu, 15 Jan 2009) Log Message: --- Brought back grab brush in sculpt mode, also removed old BrushAction struct. Modified Paths: -- branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c Modified: branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c === --- branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c 2009-01-15 16:18:32 UTC (rev 18525) +++ branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c 2009-01-15 16:57:17 UTC (rev 18526) @@ -115,15 +115,6 @@ float dist; } ActiveData; -typedef struct BrushActionSymm { - char index; - - float up[3], right[3], out[3]; - - /* Grab brush */ - float grab_delta[3]; -} BrushActionSymm; - typedef enum StrokeFlags { CLIP_X = 1, CLIP_Y = 2, @@ -151,6 +142,7 @@ int mouse[2]; /* Truly temporary storage that isn't saved as a property */ + int first_time; /* Beginning of stroke may do some things special */ MVert *mvert; /* Can be either Mesh mverts or MultiresDM mverts */ int totvert; /* Number of mverts */ float *layer_disps; /* Displacements for each vertex */ @@ -158,17 +150,13 @@ short (*orig_norms)[3]; /* Copy of the mesh vertices' normals */ int anchored_rotation; /* Texture rotation in anchored mode */ int pixel_radius, previous_pixel_radius; + ListBase grab_active_verts[8]; /* The same list of verts is used throught grab stroke */ + float grab_delta[3], grab_delta_symmetry[3]; + float old_grab_location[3]; + int symmetry; /* Symmetry index between 0 and 7 */ + float view_normal[3], view_normal_symmetry[3]; } StrokeCache; -typedef struct BrushAction { - BrushActionSymm symm; - - char firsttime; - - /* Grab brush */ - ListBase grab_active_verts[8]; -} BrushAction; - typedef struct RectNode { struct RectNode *next, *prev; rcti r; @@ -408,21 +396,23 @@ /* Currently only for the draw brush; finds average normal for all active vertices */ -static void calc_area_normal(SculptData *sd, float out[3], BrushAction *a, const float *outdir, const ListBase* active_verts) +static void calc_area_normal(SculptData *sd, float out[3], const ListBase* active_verts) { + StrokeCache *cache = sd-session-cache; ActiveData *node = active_verts-first; const int view = 0; /* XXX: should probably be a flag, not number: sd-brush_type==SCULPT_TOOL_DRAW ? sculptmode_brush()-view : 0; */ float out_flip[3]; + float *out_dir = cache-view_normal_symmetry; out[0]=out[1]=out[2] = out_flip[0]=out_flip[1]=out_flip[2] = 0; if(sd-brush-flag BRUSH_ANCHORED) { for(; node; node = node-next) - add_norm_if(a-symm.out, out, out_flip, sd-session-cache-orig_norms[node-Index]); + add_norm_if(out_dir, out, out_flip, cache-orig_norms[node-Index]); } else { for(; node; node = node-next) - add_norm_if(a-symm.out, out, out_flip, sd-session-mvert[node-Index].no); + add_norm_if(out_dir, out, out_flip, cache-mvert[node-Index].no); } if (out[0]==0.0 out[1]==0.0 out[2]==0.0) { @@ -431,21 +421,21 @@ Normalize(out); - if(outdir) { - out[0] = outdir[0] * view + out[0] * (10-view); - out[1] = outdir[1] * view + out[1] * (10-view); - out[2] = outdir[2] * view + out[2] * (10-view); + if(out_dir) { + out[0] = out_dir[0] * view + out[0] * (10-view); + out[1] = out_dir[1] * view + out[1] * (10-view); + out[2] = out_dir[2] * view + out[2] * (10-view); } Normalize(out); } -static void do_draw_brush(SculptData *sd, SculptSession *ss, BrushAction *a, const ListBase* active_verts) +static void do_draw_brush(SculptData *sd, SculptSession *ss, const ListBase* active_verts) { float area_normal[3]; ActiveData *node= active_verts-first; - calc_area_normal(sd, area_normal, a, a-symm.out, active_verts); + calc_area_normal(sd, area_normal, active_verts); sculpt_axislock(sd, area_normal); @@ -524,7 +514,7 @@ } } -static void do_pinch_brush(SculptSession *ss, const BrushAction *a, const ListBase* active_verts) +static void do_pinch_brush(SculptSession *ss, const ListBase* active_verts) { ActiveData *node= active_verts-first; @@ -538,13 +528,13 @@ } } -static void do_grab_brush(SculptData *sd, SculptSession *ss, BrushAction *a) +static void do_grab_brush(SculptData
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18527] trunk/blender/source: blender was crashing if no argument was given after '-t'
Revision: 18527 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=18527 Author: campbellbarton Date: 2009-01-15 19:06:06 +0100 (Thu, 15 Jan 2009) Log Message: --- blender was crashing if no argument was given after '-t' mesh.faces.deltete(...) with an empty list no longer returns an error. Modified Paths: -- trunk/blender/source/blender/python/api2_2x/Mesh.c trunk/blender/source/blender/render/intern/source/pipeline.c trunk/blender/source/creator/creator.c Modified: trunk/blender/source/blender/python/api2_2x/Mesh.c === --- trunk/blender/source/blender/python/api2_2x/Mesh.c 2009-01-15 16:57:17 UTC (rev 18526) +++ trunk/blender/source/blender/python/api2_2x/Mesh.c 2009-01-15 18:06:06 UTC (rev 18527) @@ -5390,9 +5390,9 @@ /* see how many args we need to parse */ len = PySequence_Size( args ); - if( len 1 ) - return EXPP_ReturnPyObjError( PyExc_TypeError, - sequence must contain at least one int or MFace ); + if( len 1 ) { + Py_RETURN_NONE; + } face_table = MEM_callocN( len*sizeof( unsigned int ), face_table ); Modified: trunk/blender/source/blender/render/intern/source/pipeline.c === --- trunk/blender/source/blender/render/intern/source/pipeline.c 2009-01-15 16:57:17 UTC (rev 18526) +++ trunk/blender/source/blender/render/intern/source/pipeline.c 2009-01-15 18:06:06 UTC (rev 18527) @@ -2710,7 +2710,7 @@ } else if(threads=1 threads=BLENDER_MAX_THREADS) { commandline_threads= threads; } else { - printf(Error, threads has to be in range 1-%d\n, BLENDER_MAX_THREADS); + printf(Error, threads has to be in range 0-%d\n, BLENDER_MAX_THREADS); } } Modified: trunk/blender/source/creator/creator.c === --- trunk/blender/source/creator/creator.c 2009-01-15 16:57:17 UTC (rev 18526) +++ trunk/blender/source/creator/creator.c 2009-01-15 18:06:06 UTC (rev 18527) @@ -785,10 +785,14 @@ case 't': a++; - if(G.background) { - RE_set_max_threads(atoi(argv[a])); + if (a argc) { + if(G.background) { + RE_set_max_threads(atoi(argv[a])); + } else { + printf(Warning: threads can only be set in background mode\n); + } } else { - printf(Warning: threads can only be set in background mode\n); + printf(\nError: you must specify a number of threads between 0 and 8 '-t '.\n); } break; case 'x': /* extension */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18528] branches/blender2.5/blender/source /blender/editors: 2.5
Revision: 18528 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=18528 Author: ton Date: 2009-01-15 19:28:40 +0100 (Thu, 15 Jan 2009) Log Message: --- 2.5 - Finished adding primitives in Mesh editmode. For test pleasure: hotkeys CTRL 0-9 add them. More fun for testers: - F3: gives menu of all registered ops. You can use it too, it then execs it again, and makes it the last executed operator. - F4: executes last registered operator without menu. Modified Paths: -- branches/blender2.5/blender/source/blender/editors/mesh/editmesh_add.c branches/blender2.5/blender/source/blender/editors/mesh/mesh_intern.h branches/blender2.5/blender/source/blender/editors/mesh/mesh_ops.c branches/blender2.5/blender/source/blender/editors/object/object_edit.c branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c Modified: branches/blender2.5/blender/source/blender/editors/mesh/editmesh_add.c === --- branches/blender2.5/blender/source/blender/editors/mesh/editmesh_add.c 2009-01-15 18:06:06 UTC (rev 18527) +++ branches/blender2.5/blender/source/blender/editors/mesh/editmesh_add.c 2009-01-15 18:28:40 UTC (rev 18528) @@ -1103,7 +1103,9 @@ } break; default: /* all types except grid, sphere... */ - if(ext==0 type!=7) depth= 0.0f; + if(type==PRIM_CONE); + else if(ext==0) + depth= 0.0f; /* vertices */ vtop= vdown= v1= v2= 0; @@ -1112,7 +1114,7 @@ vec[0]= dia*sin(phi); vec[1]= dia*cos(phi); - vec[2]= depth; + vec[2]= b?depth:-depth; Mat4MulVecfl(mat, vec); eve= addvertlist(em, vec, NULL); @@ -1123,19 +1125,19 @@ } phi+=phid; } - depth= -depth; } + /* center vertices */ - /* type 7, a cone can only have 1 one side filled + /* type PRIM_CONE can only have 1 one side filled * if the cone has no capping, dont add vtop */ - if((fill type1) || type == 7) { + if((fill type1) || type == PRIM_CONE) { vec[0]= vec[1]= 0.0f; - vec[2]-= -depth; + vec[2]= -depth; Mat4MulVecfl(mat, vec); vdown= addvertlist(em, vec, NULL); - if((ext || type==7) fill) { + if((ext || type==PRIM_CONE) fill) { vec[0]= vec[1]= 0.0f; - vec[2]-= depth; + vec[2]= depth; Mat4MulVecfl(mat,vec); vtop= addvertlist(em, vec, NULL); } @@ -1147,7 +1149,7 @@ if(vdown) vdown-f= SELECT; /* top and bottom face */ - if(fill || type==7) { + if(fill || type==PRIM_CONE) { if(tot==4 (type==0 || type==1)) { v3= v1-next-next; if(ext) v4= v2-next-next; @@ -1173,7 +1175,7 @@ } } } - else if(type==4) { /* we need edges for a circle */ + else if(type==PRIM_CIRCLE) { /* we need edges for a circle */ v3= v1; for(a=1;atot;a++) { addedgelist(em, v3, v3-next, NULL); @@ -1192,7 +1194,7 @@ } addfacelist(em, v3, v1, v2, v4, NULL, NULL); } - else if(type==7 fill) { + else if(type==PRIM_CONE fill) { /* add the bottom flat area of the cone * if capping is disabled dont bother */ v3= v1; @@ -1433,7 +1435,6 @@ float dia, mat[4][4]; dia= new_primitive_matrix(C, mat); - /* plane (diameter of 1.41 makes it unit size) */ dia*= sqrt(2.0f); @@ -1454,6 +1455,9 @@ /* api callbacks */ ot-exec= add_primitive_plane_exec; ot-poll= ED_operator_editmesh; + + /* flags */ + ot-flag= OPTYPE_REGISTER; } static int add_primitive_cube_exec(bContext *C, wmOperator *op) @@ -1462,7 +1466,6 @@ float dia, mat[4][4]; dia= new_primitive_matrix(C,
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18530] trunk/blender/release/scripts/ scripttemplate_background_job.py: have had few requests to use blender for performing background tasks
Revision: 18530 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=18530 Author: campbellbarton Date: 2009-01-15 23:16:29 +0100 (Thu, 15 Jan 2009) Log Message: --- have had few requests to use blender for performing background tasks - visualizing data, rendering scenes automatically and character rendering on a server. This example script shows how you can run blender in background mode, parse arguments from the command line to generate a simple scene and render/save it. Added Paths: --- trunk/blender/release/scripts/scripttemplate_background_job.py Added: trunk/blender/release/scripts/scripttemplate_background_job.py === --- trunk/blender/release/scripts/scripttemplate_background_job.py (rev 0) +++ trunk/blender/release/scripts/scripttemplate_background_job.py 2009-01-15 22:16:29 UTC (rev 18530) @@ -0,0 +1,123 @@ +#!BPY + +Name: 'Background Job Example' +Blender: 248 +Group: 'ScriptTemplate' +Tooltip: 'Script template for automating tasks from the command line with blender' + + +from Blender import Window +import bpy + +script_data = \ +'''# This script is an example of how you can run blender from the command line (in background mode with no interface) +# to automate tasks, in this example it creates a text object, camera and light, then renders and/or saves it. +# This example also shows how you can parse command line options to python scripts. +# +# Example usage for this test. +# blender -b -P $HOME/.blender/scripts/scripttemplate_background_job.py -- --text=Hello World --render=/tmp/hello --save=/tmp/hello.blend +# +# Notice all python args are after the '--' argument. + +import Blender +import bpy + +def example_function(body_text, save_path, render_path): + + sce= bpy.data.scenes.active + + txt_data= bpy.data.curves.new('MyText', 'Text3d') + + # Text Object + txt_ob = sce.objects.new(txt_data) # add the data to the scene as an object + txt_data.setText(body_text) # set the body text to the command line arg given + txt_data.setAlignment(Blender.Text3d.MIDDLE)# center text + + # Camera + cam_data= bpy.data.cameras.new('MyCam') # create new camera data + cam_ob= sce.objects.new(cam_data) # add the camera data to the scene (creating a new object) + sce.objects.camera= cam_ob # set the active camera + cam_ob.loc= 0,0,10 + + # Lamp + lamp_data= bpy.data.lamps.new('MyLamp') + lamp_ob= sce.objects.new(lamp_data) + lamp_ob.loc= 2,2,5 + + if save_path: + try: + f= open(save_path, 'w') + f.close() + ok= True + except: + print 'Cannot save to path %s' % save_path + ok= False + + if ok: + Blender.Save(save_path, 1) + + if render_path: + render= sce.render + render.extensions= True + render.renderPath = render_path + render.sFrame= 1 + render.eFrame= 1 + render.renderAnim() + + + +import sys # to get command line args +import optparse# to parse options for us and print a nice help message + +script_name= 'background_job.py' + +def main(): + + # get the args passed to blender after --, all of which are ignored by blender specifically + # so python may receive its own arguments + argv= sys.argv + + if '--' not in argv: + argv = [] # as if no args are passed + else: + argv = argv[argv.index('--')+1: ] # get all args after -- + + # When --help or no args are given, print this help + usage_text = 'Run blender in background mode with this script:\n' + usage_text += ' blender -b -P ' + script_name + ' -- [options]' + + parser = optparse.OptionParser(usage = usage_text) + + + # Example background utility, add some text and renders or saves it (with options) + parser.add_option('-t', '--text', dest='body_text', help='This text will be used to render an image') + + parser.add_option('-s', '--save', dest='save_path', help='Save the generated file to the specified path', metavar='FILE') + parser.add_option('-r', '--render', dest='render_path', help='Render an image to the specified path', metavar='FILE') + + options, args = parser.parse_args(argv) # In this example we wont use the args + + if not argv: + parser.print_help() + return + + if not hasattr(options, 'body_text'): +
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18531] branches/blender2.5/blender/source /blender/editors/sculpt/sculpt.c: Added some temporary error prints for get_depth in sculpt
Revision: 18531 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=18531 Author: nicholasbishop Date: 2009-01-16 01:44:46 +0100 (Fri, 16 Jan 2009) Log Message: --- Added some temporary error prints for get_depth in sculpt Modified Paths: -- branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c Modified: branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c === --- branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c 2009-01-15 22:16:29 UTC (rev 18530) +++ branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c 2009-01-16 00:44:46 UTC (rev 18531) @@ -248,9 +248,15 @@ if(vd vd-depths x 0 y 0 x vd-w y vd-h) return vd-depths[y * vd-w + x]; + + if(!vd) + fprintf(stderr, Error: Bad view3d!\n); + else if(!vd-depths) + fprintf(stderr, Error: Bad depths copy!\n); + else + fprintf(stderr, Error: Out of range: (%d,%d)\n, x, y); } - fprintf(stderr, Error: Bad depth store!\n); return 1; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18532] branches/blender2.5/blender/source /blender/editors/space_view3d: 2.5
Revision: 18532 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=18532 Author: mfoxdogg Date: 2009-01-16 01:58:33 +0100 (Fri, 16 Jan 2009) Log Message: --- 2.5 * - ported BorderZoom , shift-b - currently disabled in camera view as to not conflict with setting render border Modified Paths: -- branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_edit.c branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_intern.h branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_ops.c Modified: branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_edit.c === --- branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_edit.c 2009-01-16 00:44:46 UTC (rev 18531) +++ branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_edit.c 2009-01-16 00:58:33 UTC (rev 18532) @@ -955,6 +955,169 @@ RNA_def_property(ot-srna, ymax, PROP_INT, PROP_NONE); } +/* * Border Zoom operator ** */ + +static int view3d_border_zoom_exec(bContext *C, wmOperator *op) +{ + ScrArea *sa= CTX_wm_area(C); + ARegion *ar= CTX_wm_region(C); + View3D *v3d= sa-spacedata.first; + Scene *scene= CTX_data_scene(C); + + /* Zooms in on a border drawn by the user */ + rcti rect; + float dvec[3], vb[2], xscale, yscale, scale; + + /* SMOOTHVIEW */ + float new_dist; + float new_ofs[3]; + + /* ZBuffer depth vars */ + bglMats mats; + float depth, depth_close= MAXFLOAT; + int had_depth = 0; + double cent[2], p[3]; + int xs, ys; + + /* note; otherwise opengl won't work */ + view3d_operator_needs_opengl(C); + + /* get border select values using rna */ + rect.xmin= RNA_int_get(op-ptr, xmin); + rect.ymin= RNA_int_get(op-ptr, ymin); + rect.xmax= RNA_int_get(op-ptr, xmax); + rect.ymax= RNA_int_get(op-ptr, ymax); + + /* Get Z Depths, needed for perspective, nice for ortho */ + bgl_get_mats(mats); + draw_depth(scene, ar, v3d, NULL); + + /* force updating */ + if (v3d-depths) { + had_depth = 1; + v3d-depths-damaged = 1; + } + + view3d_update_depths(ar, v3d); + + /* Constrain rect to depth bounds */ + if (rect.xmin 0) rect.xmin = 0; + if (rect.ymin 0) rect.ymin = 0; + if (rect.xmax = v3d-depths-w) rect.xmax = v3d-depths-w-1; + if (rect.ymax = v3d-depths-h) rect.ymax = v3d-depths-h-1; + + /* Find the closest Z pixel */ + for (xs=rect.xmin; xs rect.xmax; xs++) { + for (ys=rect.ymin; ys rect.ymax; ys++) { + depth= v3d-depths-depths[ys*v3d-depths-w+xs]; + if(depth v3d-depths-depth_range[1] depth v3d-depths-depth_range[0]) { + if (depth_close depth) { + depth_close = depth; + } + } + } + } + + if (had_depth==0) { + MEM_freeN(v3d-depths-depths); + v3d-depths-depths = NULL; + } + v3d-depths-damaged = 1; + + cent[0] = (((double)rect.xmin)+((double)rect.xmax)) / 2; + cent[1] = (((double)rect.ymin)+((double)rect.ymax)) / 2; + + if (v3d-persp==V3D_PERSP) { + double p_corner[3]; + + /* no depths to use, we cant do anything! */ + if (depth_close==MAXFLOAT) + return OPERATOR_CANCELLED; + + /* convert border to 3d coordinates */ + if (( !gluUnProject(cent[0], cent[1], depth_close, mats.modelview, mats.projection, (GLint *)mats.viewport, p[0], p[1], p[2])) || + ( !gluUnProject((double)rect.xmin, (double)rect.ymin, depth_close, mats.modelview, mats.projection, (GLint *)mats.viewport, p_corner[0], p_corner[1], p_corner[2]))) + return OPERATOR_CANCELLED; + + dvec[0] = p[0]-p_corner[0]; + dvec[1] = p[1]-p_corner[1]; + dvec[2] = p[2]-p_corner[2]; + + new_dist = VecLength(dvec); + if(new_dist = v3d-near*1.5) new_dist= v3d-near*1.5; + + new_ofs[0] = -p[0]; + new_ofs[1] = -p[1]; + new_ofs[2] = -p[2]; + + } else { /* othographic */ + /* find the current window width and height */ + vb[0] = ar-winx; + vb[1] = ar-winy; + + new_dist = v3d-dist; + + /* convert the drawn rectangle into 3d space */ + if (depth_close!=MAXFLOAT gluUnProject(cent[0], cent[1], depth_close, mats.modelview, mats.projection,
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18533] trunk/lib/win64/python: x64 dependencies
Revision: 18533 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=18533 Author: jesterking Date: 2009-01-16 02:09:38 +0100 (Fri, 16 Jan 2009) Log Message: --- x64 dependencies - python 2.5.4 release and debug libraries. - rename zlib properly. Modified Paths: -- trunk/lib/win64/python/include/python2.5/Python-ast.h trunk/lib/win64/python/include/python2.5/Python.h trunk/lib/win64/python/include/python2.5/abstract.h trunk/lib/win64/python/include/python2.5/asdl.h trunk/lib/win64/python/include/python2.5/ast.h trunk/lib/win64/python/include/python2.5/bitset.h trunk/lib/win64/python/include/python2.5/boolobject.h trunk/lib/win64/python/include/python2.5/bufferobject.h trunk/lib/win64/python/include/python2.5/cStringIO.h trunk/lib/win64/python/include/python2.5/cellobject.h trunk/lib/win64/python/include/python2.5/ceval.h trunk/lib/win64/python/include/python2.5/classobject.h trunk/lib/win64/python/include/python2.5/cobject.h trunk/lib/win64/python/include/python2.5/code.h trunk/lib/win64/python/include/python2.5/codecs.h trunk/lib/win64/python/include/python2.5/compile.h trunk/lib/win64/python/include/python2.5/complexobject.h trunk/lib/win64/python/include/python2.5/datetime.h trunk/lib/win64/python/include/python2.5/descrobject.h trunk/lib/win64/python/include/python2.5/dictobject.h trunk/lib/win64/python/include/python2.5/enumobject.h trunk/lib/win64/python/include/python2.5/errcode.h trunk/lib/win64/python/include/python2.5/eval.h trunk/lib/win64/python/include/python2.5/fileobject.h trunk/lib/win64/python/include/python2.5/floatobject.h trunk/lib/win64/python/include/python2.5/frameobject.h trunk/lib/win64/python/include/python2.5/funcobject.h trunk/lib/win64/python/include/python2.5/genobject.h trunk/lib/win64/python/include/python2.5/graminit.h trunk/lib/win64/python/include/python2.5/grammar.h trunk/lib/win64/python/include/python2.5/import.h trunk/lib/win64/python/include/python2.5/intobject.h trunk/lib/win64/python/include/python2.5/intrcheck.h trunk/lib/win64/python/include/python2.5/iterobject.h trunk/lib/win64/python/include/python2.5/listobject.h trunk/lib/win64/python/include/python2.5/longintrepr.h trunk/lib/win64/python/include/python2.5/longobject.h trunk/lib/win64/python/include/python2.5/marshal.h trunk/lib/win64/python/include/python2.5/metagrammar.h trunk/lib/win64/python/include/python2.5/methodobject.h trunk/lib/win64/python/include/python2.5/modsupport.h trunk/lib/win64/python/include/python2.5/moduleobject.h trunk/lib/win64/python/include/python2.5/node.h trunk/lib/win64/python/include/python2.5/object.h trunk/lib/win64/python/include/python2.5/objimpl.h trunk/lib/win64/python/include/python2.5/opcode.h trunk/lib/win64/python/include/python2.5/osdefs.h trunk/lib/win64/python/include/python2.5/parsetok.h trunk/lib/win64/python/include/python2.5/patchlevel.h trunk/lib/win64/python/include/python2.5/pgen.h trunk/lib/win64/python/include/python2.5/pgenheaders.h trunk/lib/win64/python/include/python2.5/py_curses.h trunk/lib/win64/python/include/python2.5/pyarena.h trunk/lib/win64/python/include/python2.5/pydebug.h trunk/lib/win64/python/include/python2.5/pyerrors.h trunk/lib/win64/python/include/python2.5/pyexpat.h trunk/lib/win64/python/include/python2.5/pyfpe.h trunk/lib/win64/python/include/python2.5/pygetopt.h trunk/lib/win64/python/include/python2.5/pymactoolbox.h trunk/lib/win64/python/include/python2.5/pymem.h trunk/lib/win64/python/include/python2.5/pyport.h trunk/lib/win64/python/include/python2.5/pystate.h trunk/lib/win64/python/include/python2.5/pystrtod.h trunk/lib/win64/python/include/python2.5/pythonrun.h trunk/lib/win64/python/include/python2.5/pythread.h trunk/lib/win64/python/include/python2.5/rangeobject.h trunk/lib/win64/python/include/python2.5/setobject.h trunk/lib/win64/python/include/python2.5/sliceobject.h trunk/lib/win64/python/include/python2.5/stringobject.h trunk/lib/win64/python/include/python2.5/structmember.h trunk/lib/win64/python/include/python2.5/structseq.h trunk/lib/win64/python/include/python2.5/symtable.h trunk/lib/win64/python/include/python2.5/sysmodule.h trunk/lib/win64/python/include/python2.5/timefuncs.h trunk/lib/win64/python/include/python2.5/token.h trunk/lib/win64/python/include/python2.5/traceback.h trunk/lib/win64/python/include/python2.5/tupleobject.h trunk/lib/win64/python/include/python2.5/ucnhash.h trunk/lib/win64/python/include/python2.5/unicodeobject.h trunk/lib/win64/python/include/python2.5/weakrefobject.h trunk/lib/win64/python/lib/python25.dll trunk/lib/win64/python/lib/python25.lib Added Paths: ---
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18534] trunk/lib/win64/zlib/lib: x64 dependencies
Revision: 18534 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=18534 Author: jesterking Date: 2009-01-16 02:19:08 +0100 (Fri, 16 Jan 2009) Log Message: --- x64 dependencies * somehow this didn't get through previous commit Added Paths: --- trunk/lib/win64/zlib/lib/libz.lib Removed Paths: - trunk/lib/win64/zlib/lib/zlib.lib Copied: trunk/lib/win64/zlib/lib/libz.lib (from rev 18510, trunk/lib/win64/zlib/lib/zlib.lib) === (Binary files differ) Deleted: trunk/lib/win64/zlib/lib/zlib.lib === (Binary files differ) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18535] branches/blender2.5/blender/source /blender/editors: Added a view3d function to read cached depth buffer, before was in sculpt.c where it didn
Revision: 18535 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=18535 Author: nicholasbishop Date: 2009-01-16 02:56:11 +0100 (Fri, 16 Jan 2009) Log Message: --- Added a view3d function to read cached depth buffer, before was in sculpt.c where it didn't belong. Modified Paths: -- branches/blender2.5/blender/source/blender/editors/include/ED_view3d.h branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_view.c Modified: branches/blender2.5/blender/source/blender/editors/include/ED_view3d.h === --- branches/blender2.5/blender/source/blender/editors/include/ED_view3d.h 2009-01-16 01:19:08 UTC (rev 18534) +++ branches/blender2.5/blender/source/blender/editors/include/ED_view3d.h 2009-01-16 01:56:11 UTC (rev 18535) @@ -61,6 +61,8 @@ /* Projection */ +float read_cached_depth(struct ViewContext *vc, int x, int y); + void project_short(struct ARegion *ar, struct View3D *v3d, float *vec, short *adr); void project_short_noclip(struct ARegion *ar, struct View3D *v3d, float *vec, short *adr); Modified: branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c === --- branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c 2009-01-16 01:19:08 UTC (rev 18534) +++ branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c 2009-01-16 01:56:11 UTC (rev 18535) @@ -145,6 +145,8 @@ int first_time; /* Beginning of stroke may do some things special */ + ViewContext vc; + /* Mesh data can either come directly from a Mesh, or from a MultiresDM */ int multires; /* Special handling for multires meshes */ MVert *mvert; @@ -234,32 +236,6 @@ * Simple functions to get data from the GL */ -/* Uses window coordinates (x,y) to find the depth in the GL depth buffer. If - available, G.vd-depths is used so that the brush doesn't sculpt on top of - itself (G.vd-depths is only updated at the end of a brush stroke.) */ -static float get_depth(bContext *C, short x, short y) -{ - ScrArea *sa= CTX_wm_area(C); - - if(sa-spacetype==SPACE_VIEW3D) { // should check this in context instead? - ViewDepths *vd = ((View3D*)sa-spacedata.first)-depths; - - y -= CTX_wm_region(C)-winrct.ymin; - - if(vd vd-depths x 0 y 0 x vd-w y vd-h) - return vd-depths[y * vd-w + x]; - - if(!vd) - fprintf(stderr, Error: Bad view3d!\n); - else if(!vd-depths) - fprintf(stderr, Error: Bad depths copy!\n); - else - fprintf(stderr, Error: Out of range: (%d,%d)\n, x, y); - } - - return 1; -} - /* Uses window coordinates (x,y) and depth component z to find a point in modelspace */ static void unproject(SculptSession *ss, float out[3], const short x, const short y, const float z) @@ -1692,7 +1668,7 @@ SculptData *sd = CTX_data_scene(C)-sculptdata; Object *ob= CTX_data_active_object(C); ModifierData *md; - float depth = get_depth(C, event-x, event-y); + ViewContext vc; float scale[3], clip_tolerance[3] = {0,0,0}; int mouse[2], flag = 0; @@ -1724,9 +1700,11 @@ RNA_int_set_array(op-ptr, initial_mouse, mouse); /* Initial screen depth under the mouse */ - RNA_float_set(op-ptr, depth, depth); + view3d_set_viewcontext(C, vc); + RNA_float_set(op-ptr, depth, read_cached_depth(vc, event-x, event-y)); sculpt_update_cache_invariants(sd, op, ob); + sd-session-cache-vc = vc; } static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, wmEvent *event) @@ -1776,7 +1754,8 @@ float center[3]; int mouse[2] = {event-x, event-y}; - unproject(sd-session, center, event-x, event-y, get_depth(C, event-x, event-y)); + unproject(sd-session, center, event-x, event-y, + read_cached_depth(sd-session-cache-vc, event-x, event-y)); /* Add to stroke */ RNA_collection_add(op-ptr, stroke, itemptr); Modified: branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_view.c === --- branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_view.c 2009-01-16 01:19:08 UTC (rev 18534) +++ branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_view.c 2009-01-16 01:56:11 UTC (rev 18535) @@ -497,6 +497,18 @@ vec[2]= (v3d-persinv[0][2]*dx + v3d-persinv[1][2]*dy); } +float read_cached_depth(ViewContext *vc, int x, int y) +{ + ViewDepths *vd = vc-v3d-depths; + +