[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15666] branches/soc-2008-quorn/release/ scripts/scripttemplate_text_plugin.py: Script template added for text plug-ins
Revision: 15666 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15666 Author: quorn Date: 2008-07-21 12:07:03 +0200 (Mon, 21 Jul 2008) Log Message: --- Script template added for text plug-ins Added Paths: --- branches/soc-2008-quorn/release/scripts/scripttemplate_text_plugin.py Added: branches/soc-2008-quorn/release/scripts/scripttemplate_text_plugin.py === --- branches/soc-2008-quorn/release/scripts/scripttemplate_text_plugin.py (rev 0) +++ branches/soc-2008-quorn/release/scripts/scripttemplate_text_plugin.py 2008-07-21 10:07:03 UTC (rev 15666) @@ -0,0 +1,69 @@ +#!BPY + +Name: 'Text Plugin' +Blender: 246 +Group: 'ScriptTemplate' +Tooltip: 'Add a new text for writing a text plugin' + + +from Blender import Window +import bpy + +script_data = \ +'''#!BPY + +Name: 'My Plugin Script' +Blender: 246 +Group: 'TextPlugin' +Shortcut: 'Ctrl+Alt+U' +Tooltip: 'Put some useful info here' + + +# Add a licence here if you wish to re-distribute, we recommend the GPL + +from Blender import Window, sys +import BPyTextPlugin, bpy + +def my_script_util(txt): + # This function prints out statistical information about a script + + desc = BPyTextPlugin.get_cached_descriptor(txt) + print '---' + print 'Script Name:', desc.name + print 'Classes:', len(desc.classes) + print ' ', desc.classes.keys() + print 'Functions:', len(desc.defs) + print ' ', desc.defs.keys() + print 'Variables:', len(desc.vars) + print ' ', desc.vars.keys() + +def main(): + + # Gets the active text object, there can be many in one blend file. + txt = bpy.data.texts.active + + # Silently return if the script has been run with no active text + if not txt: + return + + # Text plug-ins should run quickly so we time it here + Window.WaitCursor(1) + t = sys.time() + + # Run our utility function + my_script_util(txt) + + # Timing the script is a good way to be aware on any speed hits when scripting + print 'Plugin script finished in %.2f seconds' % (sys.time()-t) + Window.WaitCursor(0) + + +# This lets you import the script without running it +if __name__ == '__main__': + main() +''' + +new_text = bpy.data.texts.new('textplugin_template.py') +new_text.write(script_data) +bpy.data.texts.active = new_text +Window.RedrawAll() ___ 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 [15667] branches/soc-2008-quorn/release/ scripts/bpymodules/BPyTextPlugin.py: Oops, typo in rev.
Revision: 15667 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15667 Author: quorn Date: 2008-07-21 13:21:49 +0200 (Mon, 21 Jul 2008) Log Message: --- Oops, typo in rev. 15664 caused error Modified Paths: -- branches/soc-2008-quorn/release/scripts/bpymodules/BPyTextPlugin.py Modified: branches/soc-2008-quorn/release/scripts/bpymodules/BPyTextPlugin.py === --- branches/soc-2008-quorn/release/scripts/bpymodules/BPyTextPlugin.py 2008-07-21 10:07:03 UTC (rev 15666) +++ branches/soc-2008-quorn/release/scripts/bpymodules/BPyTextPlugin.py 2008-07-21 11:21:49 UTC (rev 15667) @@ -350,7 +350,7 @@ close = line.find(')', end[1]) var_type = dict if var_type and close+1 len(line): - if line[close]+1 != ' ' and line[close+1] != '\t': + if line[close+1] != ' ' and line[close+1] != '\t': var_type = None cls_vars[var_name] = VarDesc(var_name, var_type, start[0]) var1_step = 0 ___ 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 [15668] trunk/blender/source/gameengine: BGE patch: Optimization of bullet adaptation layer - part 1.
Revision: 15668 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15668 Author: ben2610 Date: 2008-07-21 14:37:27 +0200 (Mon, 21 Jul 2008) Log Message: --- BGE patch: Optimization of bullet adaptation layer - part 1. First batch of optimizaton of the bullet adaptation layer in the BGE. - remove circular motion state update. - optimization of physic adaptation layer for bullet: bypass unecessary conversion of rotation matrix to quaternion and back. - remove double updates during object replication. Modified Paths: -- trunk/blender/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp trunk/blender/source/gameengine/Ketsji/KX_BulletPhysicsController.h trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp trunk/blender/source/gameengine/Ketsji/KX_IPhysicsController.h trunk/blender/source/gameengine/Ketsji/KX_OdePhysicsController.cpp trunk/blender/source/gameengine/Ketsji/KX_OdePhysicsController.h trunk/blender/source/gameengine/Ketsji/KX_RadarSensor.cpp trunk/blender/source/gameengine/Ketsji/KX_Scene.cpp trunk/blender/source/gameengine/Ketsji/KX_SumoPhysicsController.cpp trunk/blender/source/gameengine/Ketsji/KX_SumoPhysicsController.h trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.h Modified: trunk/blender/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp === --- trunk/blender/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp 2008-07-21 11:21:49 UTC (rev 15667) +++ trunk/blender/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp 2008-07-21 12:37:27 UTC (rev 15668) @@ -133,9 +133,10 @@ CcdPhysicsController::getOrientation(myorn[0],myorn[1],myorn[2],myorn[3]); orn = MT_Quaternion(myorn[0],myorn[1],myorn[2],myorn[3]); } -void KX_BulletPhysicsController::setOrientation(const MT_Quaternion orn) +void KX_BulletPhysicsController::setOrientation(const MT_Matrix3x3 orn) { - CcdPhysicsController::setOrientation(orn.x(),orn.y(),orn.z(),orn.w()); + btMatrix3x3 btmat(orn[0][0], orn[0][1], orn[1][2], orn[1][0], orn[1][1], orn[1][2], orn[2][0], orn[2][1], orn[2][2]); + CcdPhysicsController::setWorldOrientation(btmat); } void KX_BulletPhysicsController::setPosition(const MT_Point3 pos) { Modified: trunk/blender/source/gameengine/Ketsji/KX_BulletPhysicsController.h === --- trunk/blender/source/gameengine/Ketsji/KX_BulletPhysicsController.h 2008-07-21 11:21:49 UTC (rev 15667) +++ trunk/blender/source/gameengine/Ketsji/KX_BulletPhysicsController.h 2008-07-21 12:37:27 UTC (rev 15668) @@ -35,7 +35,7 @@ virtual voidSetAngularVelocity(const MT_Vector3 ang_vel,bool local); virtual voidSetLinearVelocity(const MT_Vector3 lin_vel,bool local); virtual voidgetOrientation(MT_Quaternion orn); - virtual void setOrientation(const MT_Quaternion orn); + virtual void setOrientation(const MT_Matrix3x3 orn); virtual void setPosition(const MT_Point3 pos); virtual void setScaling(const MT_Vector3 scaling); virtual MT_Scalar GetMass(); Modified: trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp === --- trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp2008-07-21 11:21:49 UTC (rev 15667) +++ trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp2008-07-21 12:37:27 UTC (rev 15668) @@ -744,7 +744,7 @@ if (m_pPhysicsController1 (!GetSGNode() || !GetSGNode()-GetSGParent())) { // see note above - m_pPhysicsController1-setOrientation(rot.getRotation()); + m_pPhysicsController1-setOrientation(rot); } if (GetSGNode()) GetSGNode()-SetLocalOrientation(rot); Modified: trunk/blender/source/gameengine/Ketsji/KX_IPhysicsController.h === --- trunk/blender/source/gameengine/Ketsji/KX_IPhysicsController.h 2008-07-21 11:21:49 UTC (rev 15667) +++ trunk/blender/source/gameengine/Ketsji/KX_IPhysicsController.h 2008-07-21 12:37:27 UTC (rev 15668) @@ -71,7 +71,8 @@ virtual voidresolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ) = 0; virtual voidgetOrientation(MT_Quaternion orn)=0; - virtual void setOrientation(const MT_Quaternion orn)=0; + virtual void setOrientation(const MT_Matrix3x3 orn)=0; + //virtual void setOrientation(const MT_Quaternion orn)=0; virtual void setPosition(const MT_Point3 pos)=0; virtual void setScaling(const MT_Vector3 scaling)=0; virtual MT_Scalar
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15669] branches/apricot/source: svn merge -r15657:HEAD https://svn.blender.org/svnroot/bf-blender/trunk/ blende
Revision: 15669 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15669 Author: campbellbarton Date: 2008-07-21 15:11:56 +0200 (Mon, 21 Jul 2008) Log Message: --- svn merge -r15657:HEAD https://svn.blender.org/svnroot/bf-blender/trunk/blende Modified Paths: -- branches/apricot/source/blender/blenkernel/intern/collision.c branches/apricot/source/blender/blenkernel/intern/particle_system.c branches/apricot/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp branches/apricot/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h branches/apricot/source/gameengine/GamePlayer/common/GPC_Canvas.h branches/apricot/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp branches/apricot/source/gameengine/Ketsji/KX_BulletPhysicsController.h branches/apricot/source/gameengine/Ketsji/KX_ConstraintActuator.cpp branches/apricot/source/gameengine/Ketsji/KX_GameObject.cpp branches/apricot/source/gameengine/Ketsji/KX_IPhysicsController.h branches/apricot/source/gameengine/Ketsji/KX_OdePhysicsController.cpp branches/apricot/source/gameengine/Ketsji/KX_OdePhysicsController.h branches/apricot/source/gameengine/Ketsji/KX_RadarSensor.cpp branches/apricot/source/gameengine/Ketsji/KX_Scene.cpp branches/apricot/source/gameengine/Ketsji/KX_SumoPhysicsController.cpp branches/apricot/source/gameengine/Ketsji/KX_SumoPhysicsController.h branches/apricot/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp branches/apricot/source/gameengine/Physics/Bullet/CcdPhysicsController.h branches/apricot/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp branches/apricot/source/gameengine/Rasterizer/RAS_2DFilterManager.h branches/apricot/source/gameengine/Rasterizer/RAS_ICanvas.h Modified: branches/apricot/source/blender/blenkernel/intern/collision.c === --- branches/apricot/source/blender/blenkernel/intern/collision.c 2008-07-21 12:37:27 UTC (rev 15668) +++ branches/apricot/source/blender/blenkernel/intern/collision.c 2008-07-21 13:11:56 UTC (rev 15669) @@ -1437,6 +1437,9 @@ if(coll_ob == self) continue; + + if( !collmd-bvhtree) + continue; if(numobj = maxobj) { Modified: branches/apricot/source/blender/blenkernel/intern/particle_system.c === --- branches/apricot/source/blender/blenkernel/intern/particle_system.c 2008-07-21 12:37:27 UTC (rev 15668) +++ branches/apricot/source/blender/blenkernel/intern/particle_system.c 2008-07-21 13:11:56 UTC (rev 15669) @@ -2797,7 +2797,10 @@ epart= epsys-part; pd= epart-pd; totepart= epsys-totpart; - + + if(totepart = 0) + continue; + if(pd-forcefield==PFIELD_HARMONIC){ /* every particle is mapped to only one harmonic effector particle */ p= pa_no%epsys-totpart; Modified: branches/apricot/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp === --- branches/apricot/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp 2008-07-21 12:37:27 UTC (rev 15668) +++ branches/apricot/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp 2008-07-21 13:11:56 UTC (rev 15669) @@ -101,6 +101,13 @@ return scrarea_get_win_height(m_area); } +RAS_Rect +KX_BlenderCanvas:: +GetWindowArea( +){ + return m_area_rect; +} + void KX_BlenderCanvas:: SetViewPort( @@ -112,6 +119,11 @@ int minx = scrarea_get_win_x(m_area); int miny = scrarea_get_win_y(m_area); + m_area_rect.SetLeft(minx + x1); + m_area_rect.SetBottom(miny + y1); + m_area_rect.SetRight(minx + x2); + m_area_rect.SetTop(miny + y2); + glViewport(minx + x1, miny + y1, vp_width, vp_height); glScissor(minx + x1, miny + y1, vp_width, vp_height); } Modified: branches/apricot/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h === --- branches/apricot/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h 2008-07-21 12:37:27 UTC (rev 15668) +++ branches/apricot/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h 2008-07-21 13:11:56 UTC (rev 15669) @@ -117,6 +117,10 @@ return m_displayarea;
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15670] branches/fluidcontrol/intern/ elbeem/intern/mvmcoords.cpp: Fix for crash with fc and quality 5 ( reported by Nudel)
Revision: 15670 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15670 Author: genscher Date: 2008-07-21 15:47:42 +0200 (Mon, 21 Jul 2008) Log Message: --- Fix for crash with fc and quality 5 (reported by Nudel) Modified Paths: -- branches/fluidcontrol/intern/elbeem/intern/mvmcoords.cpp Modified: branches/fluidcontrol/intern/elbeem/intern/mvmcoords.cpp === --- branches/fluidcontrol/intern/elbeem/intern/mvmcoords.cpp2008-07-21 13:11:56 UTC (rev 15669) +++ branches/fluidcontrol/intern/elbeem/intern/mvmcoords.cpp2008-07-21 13:47:42 UTC (rev 15670) @@ -32,7 +32,9 @@ mNumVerts = (int)reference_vertices.size(); for (vectorntlVec3Gfx::iterator iter = points.begin(); iter != points.end(); ++iter, ++i) { + /* if(i%(points.size()/10)==1) debMsgStd(MeanValueMeshCoords::calculateMVMCs,DM_MSG,Computing weights, points: i/points.size(),5 ); + */ tds.lastpos = *iter; tds.weights.resize(0); // clear computeWeights(reference_vertices, tris, tds, numweights); ___ 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 [15671] branches/apricot/source: Apricot Branch
Revision: 15671 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15671 Author: blendix Date: 2008-07-21 17:35:11 +0200 (Mon, 21 Jul 2008) Log Message: --- Apricot Branch == * Refactoring in the texture and material drawing code, moving code into the gpu module, removing the duplicated versions in the game engine. * Made game engine text drawing work with GLSL. It works based on filling in the default uv layer, so it requires a texture with the text image and mapped as uv's to work. Modified Paths: -- branches/apricot/source/blender/blenkernel/BKE_DerivedMesh.h branches/apricot/source/blender/blenkernel/BKE_bad_level_calls.h branches/apricot/source/blender/blenkernel/BKE_mesh.h branches/apricot/source/blender/blenkernel/bad_level_call_stubs/stubs.c branches/apricot/source/blender/blenkernel/intern/DerivedMesh.c branches/apricot/source/blender/blenkernel/intern/cdderivedmesh.c branches/apricot/source/blender/blenkernel/intern/image.c branches/apricot/source/blender/blenkernel/intern/mesh.c branches/apricot/source/blender/blenkernel/intern/subsurf_ccg.c branches/apricot/source/blender/gpu/intern/gpu_codegen.c branches/apricot/source/blender/include/BDR_drawmesh.h branches/apricot/source/blender/include/BDR_drawobject.h branches/apricot/source/blender/python/CMakeLists.txt branches/apricot/source/blender/python/SConscript branches/apricot/source/blender/python/api2_2x/Blender.c branches/apricot/source/blender/python/api2_2x/Image.c branches/apricot/source/blender/python/api2_2x/Makefile branches/apricot/source/blender/src/drawmesh.c branches/apricot/source/blender/src/drawobject.c branches/apricot/source/blender/src/drawview.c branches/apricot/source/blender/src/editface.c branches/apricot/source/blender/src/editsima.c branches/apricot/source/blender/src/headerbuttons.c branches/apricot/source/blender/src/imagepaint.c branches/apricot/source/blender/src/meshtools.c branches/apricot/source/blender/src/sculptmode.c branches/apricot/source/blender/src/space.c branches/apricot/source/blender/src/verse_image.c branches/apricot/source/creator/Makefile branches/apricot/source/creator/SConscript branches/apricot/source/creator/creator.c branches/apricot/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp branches/apricot/source/gameengine/BlenderRoutines/KX_BlenderGL.h branches/apricot/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp branches/apricot/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h branches/apricot/source/gameengine/GamePlayer/common/CMakeLists.txt branches/apricot/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp branches/apricot/source/gameengine/GamePlayer/common/GPC_RenderTools.h branches/apricot/source/gameengine/GamePlayer/common/SConscript branches/apricot/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp branches/apricot/source/gameengine/Ketsji/KX_BlenderMaterial.cpp branches/apricot/source/gameengine/Ketsji/KX_PolygonMaterial.cpp branches/apricot/source/gameengine/Rasterizer/RAS_IRenderTools.h branches/apricot/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp Added Paths: --- branches/apricot/source/blender/gpu/GPU_draw.h branches/apricot/source/blender/gpu/intern/gpu_draw.c Removed Paths: - branches/apricot/source/gameengine/GamePlayer/common/GPC_PolygonMaterial.cpp branches/apricot/source/gameengine/GamePlayer/common/GPC_PolygonMaterial.h Modified: branches/apricot/source/blender/blenkernel/BKE_DerivedMesh.h === --- branches/apricot/source/blender/blenkernel/BKE_DerivedMesh.h 2008-07-21 13:47:42 UTC (rev 15670) +++ branches/apricot/source/blender/blenkernel/BKE_DerivedMesh.h 2008-07-21 15:35:11 UTC (rev 15671) @@ -199,7 +199,8 @@ * * Also called for *final* editmode DerivedMeshes */ - void (*drawFacesSolid)(DerivedMesh *dm, int (*setMaterial)(int)); + void (*drawFacesSolid)(DerivedMesh *dm, + int (*setMaterial)(int, void *attribs)); /* Draw all faces * o If useTwoSided, draw front and back using col arrays @@ -221,7 +222,7 @@ * o Only if setMaterial returns true */ void (*drawFacesGLSL)(DerivedMesh *dm, - int (*setMaterial)(int, struct GPUVertexAttribs *attribs)); + int (*setMaterial)(int, void *attribs)); /* Draw mapped faces (no color, or texture) * o Only if !setDrawOptions or @@ -255,7 +256,7 @@ * o Only if setMaterial and setDrawOptions return true */ void (*drawMappedFacesGLSL)(DerivedMesh *dm, - int (*setMaterial)(int, struct GPUVertexAttribs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15674] branches/soc-2008-quorn/source/ blender: Removed requirement for suggestions to be pre-sorted.
Revision: 15674 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15674 Author: quorn Date: 2008-07-21 18:40:32 +0200 (Mon, 21 Jul 2008) Log Message: --- Removed requirement for suggestions to be pre-sorted. Allowed lists of strings to be suggested without having to specify their type. Specifying a prefix when suggesting is now also optional. Modified Paths: -- branches/soc-2008-quorn/source/blender/blenkernel/BKE_suggestions.h branches/soc-2008-quorn/source/blender/blenkernel/intern/suggestions.c branches/soc-2008-quorn/source/blender/python/api2_2x/Text.c branches/soc-2008-quorn/source/blender/python/api2_2x/doc/Text.py branches/soc-2008-quorn/source/blender/src/drawtext.c Modified: branches/soc-2008-quorn/source/blender/blenkernel/BKE_suggestions.h === --- branches/soc-2008-quorn/source/blender/blenkernel/BKE_suggestions.h 2008-07-21 15:56:42 UTC (rev 15673) +++ branches/soc-2008-quorn/source/blender/blenkernel/BKE_suggestions.h 2008-07-21 16:40:32 UTC (rev 15674) @@ -34,8 +34,10 @@ #endif /* -Suggestions must be added in sorted order (no attempt is made to sort the list) -The list is then divided up based on the prefix provided by update_suggestions: +Suggestions should be added in sorted order although a linear sorting method is +implemented. The list is then divided up based on the prefix provided by +update_suggestions: + Example: Prefix: ab aaa -- first @@ -70,6 +72,7 @@ void suggest_add(const char *name, char type); void suggest_prefix(const char *prefix); +void suggest_clear_list(); SuggItem *suggest_first(); SuggItem *suggest_last(); Modified: branches/soc-2008-quorn/source/blender/blenkernel/intern/suggestions.c === --- branches/soc-2008-quorn/source/blender/blenkernel/intern/suggestions.c 2008-07-21 15:56:42 UTC (rev 15673) +++ branches/soc-2008-quorn/source/blender/blenkernel/intern/suggestions.c 2008-07-21 16:40:32 UTC (rev 15674) @@ -37,6 +37,10 @@ #include BKE_text.h #include BKE_suggestions.h +/**/ +/* Static definitions */ +/**/ + static SuggList suggestions = {NULL, NULL, NULL, NULL, NULL}; static Text *suggText = NULL; static SuggItem *lastInsert = NULL; @@ -71,13 +75,37 @@ } } +/**/ +/* General tool functions */ +/**/ + void free_suggestions() { sugg_free(); docs_free(); } +void suggest_set_active(Text *text) { + if (suggText == text) return; + suggest_clear_active(); + suggText = text; +} + +void suggest_clear_active() { + free_suggestions(); + suggText = NULL; +} + +short suggest_is_active(Text *text) { + return suggText==text ? 1 : 0; +} + +/***/ +/* Suggestion list methods */ +/***/ + void suggest_add(const char *name, char type) { - SuggItem *newitem; + SuggItem *newitem, *item; + int len, cmp; newitem = MEM_mallocN(sizeof(SuggItem) + strlen(name) + 1, SuggestionItem); if (!newitem) { @@ -86,18 +114,42 @@ } newitem-name = (char *) (newitem + 1); - strcpy(newitem-name, name); + len = strlen(name); + strncpy(newitem-name, name, len); + newitem-name[len] = '\0'; newitem-type = type; newitem-prev = newitem-next = NULL; - if (!suggestions.first) { + /* Perform simple linear search for ordered storage */ + if (!suggestions.first || !suggestions.last) { suggestions.first = suggestions.last = newitem; } else { - newitem-prev = suggestions.last; - suggestions.last-next = newitem; - suggestions.last = newitem; + cmp = -1; + for (item=suggestions.last; item; item=item-prev) { + cmp = suggest_cmp(name, item-name, len); + + /* Newitem comes after this item, insert here */ + if (cmp = 0) { + newitem-prev = item; + if (item-next) + item-next-prev = newitem; + newitem-next = item-next; + item-next = newitem; + + /* At last item, set last pointer here */ + if (item == suggestions.last) + suggestions.last = newitem; + break; + } + } + /* Reached beginning of list, insert before first */ + if (cmp 0) { + newitem-next =
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15675] branches/soc-2008-unclezeiv/source /blender/render/intern/source/lightcuts.c: Added requested error rate to console stats.
Revision: 15675 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15675 Author: unclezeiv Date: 2008-07-21 18:59:46 +0200 (Mon, 21 Jul 2008) Log Message: --- Added requested error rate to console stats. Modified Paths: -- branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c Modified: branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c === --- branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c 2008-07-21 16:40:32 UTC (rev 15674) +++ branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c 2008-07-21 16:59:46 UTC (rev 15675) @@ -1422,19 +1422,20 @@ BLI_heap_free(cut, 0); } -/* TODO SUN: more complete stats */ static void lightcuts_print_stats(LightcutsData *lcd) { printf(Lightcuts stats\n ---\n Computed samples: %d\n Number of (point) lights: %d (%dl + %ds + %do)\n + Requested error rate: %.3f\n Max cut: %d\n Average cut size: %.2f\n Shadow rays: %.2f (%.2f%%)\n ---\n, lcd-stat_samples, lcd-light_counter, lcd-trees[TREE_LOCAL].counter, lcd-trees[TREE_SUN].counter, lcd-trees[TREE_SPOT].counter, + lcd-error_rate, lcd-max_cut, (float)lcd-stat_cut_size / (float)lcd-stat_samples, (float)lcd-stat_rays_shot / (float)lcd-stat_samples, ___ 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 [15676] trunk/blender/source/blender: allow to write to libraries that are indirectly linked
Revision: 15676 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15676 Author: campbellbarton Date: 2008-07-21 19:05:59 +0200 (Mon, 21 Jul 2008) Log Message: --- allow to write to libraries that are indirectly linked Modified Paths: -- trunk/blender/source/blender/python/api2_2x/Blender.c trunk/blender/source/blender/src/usiblender.c Modified: trunk/blender/source/blender/python/api2_2x/Blender.c === --- trunk/blender/source/blender/python/api2_2x/Blender.c 2008-07-21 16:59:46 UTC (rev 15675) +++ trunk/blender/source/blender/python/api2_2x/Blender.c 2008-07-21 17:05:59 UTC (rev 15676) @@ -708,7 +708,7 @@ expected filename and optional int (overwrite flag) as arguments ); for( li = G.main-library.first; li; li = li-id.next ) { - if( BLI_streq( li-name, fname ) ) { + if( li-parent==NULL BLI_streq( li-name, fname ) ) { return EXPP_ReturnPyObjError( PyExc_AttributeError, cannot overwrite used library ); } Modified: trunk/blender/source/blender/src/usiblender.c === --- trunk/blender/source/blender/src/usiblender.c 2008-07-21 16:59:46 UTC (rev 15675) +++ trunk/blender/source/blender/src/usiblender.c 2008-07-21 17:05:59 UTC (rev 15676) @@ -883,7 +883,7 @@ if (G.f G_DOSCRIPTLINKS) BPY_do_pyscript(G.scene-id, SCRIPT_ONSAVE); for (li= G.main-library.first; li; li= li-id.next) { - if (BLI_streq(li-name, target)) { + if (li-parent==NULL BLI_streq(li-name, target)) { error(Cannot overwrite used library); return; } ___ 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 [15677] branches/soc-2008-jaguarandi/ source/blender/blenkernel/intern/shrinkwrap.c: Made shrinkwrap modifier work when target or cutPlane are in edit
Revision: 15677 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15677 Author: jaguarandi Date: 2008-07-21 20:12:02 +0200 (Mon, 21 Jul 2008) Log Message: --- Made shrinkwrap modifier work when target or cutPlane are in editmode. Modified Paths: -- branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/shrinkwrap.c Modified: branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/shrinkwrap.c === --- branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/shrinkwrap.c 2008-07-21 17:05:59 UTC (rev 15676) +++ branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/shrinkwrap.c 2008-07-21 18:12:02 UTC (rev 15677) @@ -42,6 +42,7 @@ #include BKE_utildefines.h #include BKE_deform.h #include BKE_cdderivedmesh.h +#include BKE_displist.h #include BKE_global.h #include BLI_arithb.h @@ -90,7 +91,20 @@ static float nearest_point_in_tri_surface(const float *point, const float *v0, const float *v1, const float *v2, float *nearest); static float ray_intersect_plane(const float *point, const float *dir, const float *plane_point, const float *plane_normal); - +/* get derived mesh */ +//TODO is anyfunction that does this? returning the derivedFinal witouth we caring if its in edit mode or not? +DerivedMesh *object_get_derived_final(Object *ob, CustomDataMask dataMask) +{ + if (ob==G.obedit) + { + DerivedMesh *final = NULL; + editmesh_get_derived_cage_and_final(final, dataMask); + return final; + } + else + return mesh_get_derived_final(ob, dataMask); +} + /* ray - triangle */ #define ISECT_EPSILON 1e-6 static float ray_tri_intersection(const BVHTreeRay *ray, const float m_dist, const float *v0, const float *v1, const float *v2) @@ -184,8 +198,15 @@ int i; int numVerts= mesh-getNumVerts(mesh); MVert *vert = mesh-getVertDataArray(mesh, CD_MVERT); + BVHTree *tree = NULL; - BVHTree *tree = BLI_bvhtree_new(numVerts, epsilon, tree_type, axis); + if(vert == NULL) + { + printf(bvhtree cant be build: cant get a vertex array); + return NULL; + } + + tree = BLI_bvhtree_new(numVerts, epsilon, tree_type, axis); if(tree != NULL) { for(i = 0; i numVerts; i++) @@ -206,9 +227,13 @@ int numFaces= mesh-getNumFaces(mesh); MVert *vert = mesh-getVertDataArray(mesh, CD_MVERT); MFace *face = mesh-getFaceDataArray(mesh, CD_MFACE); - BVHTree *tree= NULL; + BVHTree *tree = NULL; - /* Count needed faces */ + if(vert == NULL face == NULL) + { + printf(bvhtree cant be build: cant get a vertex/face array); + return NULL; + } /* Create a bvh-tree of the given target */ tree = BLI_bvhtree_new(numFaces, epsilon, tree_type, axis); @@ -217,7 +242,6 @@ for(i = 0; i numFaces; i++) { float co[4][3]; - VECCOPY(co[0], vert[ face[i].v1 ].co); VECCOPY(co[1], vert[ face[i].v2 ].co); VECCOPY(co[2], vert[ face[i].v3 ].co); @@ -226,7 +250,6 @@ BLI_bvhtree_insert(tree, i, co[0], face[i].v4 ? 4 : 3); } - BLI_bvhtree_balance(tree); } @@ -1141,9 +1164,15 @@ return dm; } + //remove loop dependencies on derived meshs (TODO should this be done elsewhere?) + if(smd-target == ob) smd-target = NULL; + if(smd-cutPlane == ob) smd-cutPlane = NULL; + + if(smd-target) { - calc.target = (DerivedMesh *)smd-target-derivedFinal; + //TODO currently we need a copy in case object_get_derived_final returns an emDM that does not defines getVertArray or getFace array + calc.target = CDDM_copy( object_get_derived_final(smd-target, CD_MASK_BAREMESH) ); if(!calc.target) { @@ -1190,7 +1219,7 @@ if(calc.moved) { //Adjust vertxs that didn't moved (project to cut plane) - shrinkwrap_projectToCutPlane(calc); +// shrinkwrap_projectToCutPlane(calc); //Destroy faces, edges and stuff shrinkwrap_removeUnused(calc); @@ -1208,6 +1237,9 @@ break; } + //free derived mesh + calc.target-release( calc.target ); + calc.target = NULL; } CDDM_calc_normals(calc.final); @@ -1392,7 +1424,7 @@ *
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15678] branches/soc-2008-quorn: Updated the textplugin_outliner.py plug-in to use the new Draw. PupTreeMenu and updated this menu to support titles.
Revision: 15678 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15678 Author: quorn Date: 2008-07-21 21:11:38 +0200 (Mon, 21 Jul 2008) Log Message: --- Updated the textplugin_outliner.py plug-in to use the new Draw.PupTreeMenu and updated this menu to support titles. Modified Paths: -- branches/soc-2008-quorn/release/scripts/textplugin_outliner.py branches/soc-2008-quorn/source/blender/python/api2_2x/doc/Draw.py branches/soc-2008-quorn/source/blender/src/toolbox.c Modified: branches/soc-2008-quorn/release/scripts/textplugin_outliner.py === --- branches/soc-2008-quorn/release/scripts/textplugin_outliner.py 2008-07-21 18:12:02 UTC (rev 15677) +++ branches/soc-2008-quorn/release/scripts/textplugin_outliner.py 2008-07-21 19:11:38 UTC (rev 15678) @@ -16,62 +16,118 @@ except ImportError: OK = False -def do_long_menu(title, items): +def make_menu(items, eventoffs): n = len(items) if n 20: - return Draw.PupMenu(title+'%t|'+'|'.join(items)) + return [(items[i], i+1+eventoffs) for i in range(len(items))] letters = [] - check = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_' # Cannot start 0-9 so just letters + check = 'abcdefghijklmnopqrstuvwxyz_' # Names cannot start 0-9 for c in check: for item in items: - if item[0].upper() == c: + if item[0].lower() == c: letters.append(c) break - i = Draw.PupMenu(title+'%t|'+'|'.join(letters)) - if i 1: - return i - - c = letters[i-1] - newitems = [] - + dict = {} i = 0 for item in items: i += 1 - if item[0].upper() == c: - newitems.append(item+'%x'+str(i)) + c = item[0].lower() + if not dict.has_key(c): dict[c] = [] + dict[c].append((item, i+eventoffs)) - return Draw.PupMenu(title+'%t|'+'|'.join(newitems)) + subs = [] + for c in letters: + subs.append((c, dict[c])) + + return subs +def find_word(txt, word): + i = 0 + for line in txt.asLines(): + c = line.find(word) + if c != -1: + txt.setCursorPos(i, c) + break + i += 1 + def main(): txt = bpy.data.texts.active if not txt: return + # Identify word under cursor + if get_context(txt) == CTX_NORMAL: + line, c = current_line(txt) + start = c-1 + end = c + while start = 0: + if not line[start].lower() in 'abcdefghijklmnopqrstuvwxyz0123456789_': + break + start -= 1 + while end len(line): + if not line[end].lower() in 'abcdefghijklmnopqrstuvwxyz0123456789_': + break + end += 1 + word = line[start+1:end] + if word in KEYWORDS: + word = None + else: + word = None + + script = get_cached_descriptor(txt) items = [] - i = Draw.PupMenu('Outliner%t|Classes|Defs|Variables') - if i 1: return + desc = None - script = get_cached_descriptor(txt) - if i == 1: - type = script.classes - elif i == 2: - type = script.defs - elif i == 3: - type = script.vars - else: + tmp = script.classes.keys() + tmp.sort(cmp = suggest_cmp) + class_menu = make_menu(tmp, len(items)) + class_menu_length = len(tmp) + items.extend(tmp) + + tmp = script.defs.keys() + tmp.sort(cmp = suggest_cmp) + defs_menu = make_menu(tmp, len(items)) + defs_menu_length = len(tmp) + items.extend(tmp) + + tmp = script.vars.keys() + tmp.sort(cmp = suggest_cmp) + vars_menu = make_menu(tmp, len(items)) + vars_menu_length = len(tmp) + items.extend(tmp) + + menu = [('Outliner%t', 0), + ('Classes', class_menu), + ('Functions', defs_menu), + ('Variables', vars_menu)] + if word: + menu.extend([None, ('Locate', [(word, -10)])]) + + i = Draw.PupTreeMenu(menu) + if i == -1: return - items.extend(type.keys()) - items.sort(cmp = suggest_cmp) - i = do_long_menu('Outliner', items) - if i 1: - return - try: - desc = type[items[i-1]] - except: -
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15680] trunk/blender/source/blender/ python/api2_2x: Python API
Revision: 15680 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15680 Author: khughes Date: 2008-07-21 22:42:11 +0200 (Mon, 21 Jul 2008) Log Message: --- Python API -- Particle patch from C?\195?\169dric Paille: bugfixes and child-particles export improvements for .getLoc(), part.getRot() part.getSize(), part.getAge() methods. Also fix a bug with part.randemission getter (was using PART_BOIDS_2D instead of PART_TRAND), plus typos and duplications in API documentation. Modified Paths: -- trunk/blender/source/blender/python/api2_2x/Particle.c trunk/blender/source/blender/python/api2_2x/doc/Particle.py Modified: trunk/blender/source/blender/python/api2_2x/Particle.c === --- trunk/blender/source/blender/python/api2_2x/Particle.c 2008-07-21 19:27:59 UTC (rev 15679) +++ trunk/blender/source/blender/python/api2_2x/Particle.c 2008-07-21 20:42:11 UTC (rev 15680) @@ -40,6 +40,7 @@ #include BKE_material.h #include BKE_utildefines.h #include BKE_pointcache.h +#include BKE_DerivedMesh.h #include BIF_editparticle.h #include BIF_space.h #include blendef.h @@ -799,22 +800,27 @@ Py_RETURN_NONE; } -static PyObject *Part_GetLoc( BPy_PartSys * self, PyObject * args ){ +static PyObject *Part_GetLoc( BPy_PartSys * self, PyObject * args ) +{ ParticleSystem *psys = 0L; Object *ob = 0L; PyObject *partlist,*seglist; + ParticleCacheKey **cache,*path; PyObject* loc = 0L; - ParticleCacheKey **cache,*path; ParticleKey state; - float cfra=bsystem_time(ob,(float)CFRA,0.0); + DerivedMesh* dm; + float cfra; int i,j,k; + float vm[4][4],wm[4][4]; int childexists = 0; int all = 0; int id = 0; + cfra = bsystem_time(ob,(float)CFRA,0.0); + if( !PyArg_ParseTuple( args, |ii, all,id ) ) return EXPP_ReturnPyObjError( PyExc_TypeError, - expected one optional integer as argument ); + expected two optional integers as arguments ); psys = self-psys; ob = self-object; @@ -822,89 +828,119 @@ if (!ob || !psys) Py_RETURN_NONE; - if (psys-part-type == 2){ - cache=psys-pathcache; + G.rendering = 1; - /* little hack to calculate hair steps in render mode */ - psys-renderdata = (void*)(int)1; + /* Just to create a valid rendering context */ + psys_render_set(ob,psys,vm,wm,0,0,0); - psys_cache_paths(ob, psys, cfra, 1); + dm = mesh_create_derived_render(ob,CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL); + dm-release(dm); - psys-renderdata = NULL; + if ( !psys_check_enabled(ob,psys) ){ + G.rendering = 0; + psys_render_restore(ob,psys); + Particle_Recalc(self,1); + Py_RETURN_NONE; + } - partlist = PyList_New( 0 ); - if( !partlist ) - return EXPP_ReturnPyObjError( PyExc_MemoryError, PyList() failed ); + partlist = PyList_New( 0 ); + if( !partlist ){ + PyErr_SetString( PyExc_MemoryError, PyList_New() failed ); + goto error; + } - for(i = 0; i psys-totpart; i++){ - path=cache[i]; - seglist = PyList_New( 0 ); - k = path-steps+1; - for( j = 0; j k ; j++){ - loc = PyTuple_New(3); + if (psys-part-type == PART_HAIR){ + cache = psys-pathcache; - PyTuple_SetItem(loc,0,PyFloat_FromDouble((double)path-co[0])); - PyTuple_SetItem(loc,1,PyFloat_FromDouble((double)path-co[1])); - PyTuple_SetItem(loc,2,PyFloat_FromDouble((double)path-co[2])); + if ( ((self-psys-part-draw PART_DRAW_PARENT) (self-psys-part-childtype != 0)) || (self-psys-part-childtype == 0) ){ - if ( (PyList_Append(seglist,loc) 0) ){ - Py_DECREF(seglist); - Py_DECREF(partlist); - Py_XDECREF(loc); - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - Couldn't append item to PyList ); + for(i = 0; i psys-totpart; i++){ + seglist = PyList_New( 0 ); + if (!seglist){ + PyErr_SetString( PyExc_MemoryError, + PyList_New() failed ); +
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15684] branches/soc-2008-nicholasbishop/ source/blender: Started removing the old multires code.
Revision: 15684 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15684 Author: nicholasbishop Date: 2008-07-22 01:41:01 +0200 (Tue, 22 Jul 2008) Log Message: --- Started removing the old multires code. Also removed a few pointers in the DNA data that won't be needed for backwards-compat. Put a warning in the Python code as a reminder that it'll need to be updated to work with the new multires code. Modified Paths: -- branches/soc-2008-nicholasbishop/source/blender/blenkernel/BKE_multires.h branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/multires.c branches/soc-2008-nicholasbishop/source/blender/blenloader/intern/readfile.c branches/soc-2008-nicholasbishop/source/blender/makesdna/DNA_meshdata_types.h branches/soc-2008-nicholasbishop/source/blender/python/api2_2x/Mesh.c branches/soc-2008-nicholasbishop/source/blender/src/buttons_editing.c branches/soc-2008-nicholasbishop/source/blender/src/multires.c Modified: branches/soc-2008-nicholasbishop/source/blender/blenkernel/BKE_multires.h === --- branches/soc-2008-nicholasbishop/source/blender/blenkernel/BKE_multires.h 2008-07-21 22:36:05 UTC (rev 15683) +++ branches/soc-2008-nicholasbishop/source/blender/blenkernel/BKE_multires.h 2008-07-21 23:41:01 UTC (rev 15684) @@ -41,7 +41,6 @@ struct MultiresLevel *multires_level_n(struct Multires *mr, int n); /* Level control */ -void multires_add_level(struct Object *ob, struct Mesh *me, const char subdiv_type); void multires_set_level(struct Object *ob, struct Mesh *me, const int render); void multires_free_level(struct MultiresLevel *lvl); Modified: branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/multires.c === --- branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/multires.c 2008-07-21 22:36:05 UTC (rev 15683) +++ branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/multires.c 2008-07-21 23:41:01 UTC (rev 15684) @@ -71,21 +71,6 @@ return NULL; } -/* Free and clear the temporary connectivity data */ -static void multires_free_temp_data(MultiresLevel *lvl) -{ - if(lvl) { - if(lvl-edge_boundary_states) MEM_freeN(lvl-edge_boundary_states); - if(lvl-vert_edge_map) MEM_freeN(lvl-vert_edge_map); - if(lvl-vert_face_map) MEM_freeN(lvl-vert_face_map); - if(lvl-map_mem) MEM_freeN(lvl-map_mem); - - lvl-edge_boundary_states = NULL; - lvl-vert_edge_map = lvl-vert_face_map = NULL; - lvl-map_mem = NULL; - } -} - /* Does not actually free lvl itself */ void multires_free_level(MultiresLevel *lvl) { @@ -93,8 +78,6 @@ if(lvl-faces) MEM_freeN(lvl-faces); if(lvl-edges) MEM_freeN(lvl-edges); if(lvl-colfaces) MEM_freeN(lvl-colfaces); - - multires_free_temp_data(lvl); } } @@ -133,9 +116,6 @@ lvl-faces= MEM_dupallocN(orig-faces); lvl-colfaces= MEM_dupallocN(orig-colfaces); lvl-edges= MEM_dupallocN(orig-edges); - lvl-edge_boundary_states = NULL; - lvl-vert_edge_map= lvl-vert_face_map= NULL; - lvl-map_mem= NULL; return lvl; } @@ -416,60 +396,6 @@ unsigned Index; } MultiresMapNode; -/* Produces temporary connectivity data for the multires lvl */ -static void multires_calc_temp_data(MultiresLevel *lvl) -{ - unsigned i, j, emax; - MultiresMapNode *indexnode= NULL; - - lvl-map_mem= MEM_mallocN(sizeof(MultiresMapNode)*(lvl-totedge*2 + lvl-totface*4), map_mem); - indexnode= lvl-map_mem; - - /* edge map */ - lvl-vert_edge_map= MEM_callocN(sizeof(ListBase)*lvl-totvert,vert_edge_map); - for(i=0; ilvl-totedge; ++i) { - for(j=0; j2; ++j, ++indexnode) { - indexnode-Index= i; - BLI_addtail(lvl-vert_edge_map[lvl-edges[i].v[j]], indexnode); - } - } - - /* face map */ - lvl-vert_face_map= MEM_callocN(sizeof(ListBase)*lvl-totvert,vert_face_map); - for(i=0; ilvl-totface; ++i){ - for(j=0; j(lvl-faces[i].v[3]?4:3); ++j, ++indexnode) { - indexnode-Index= i; - BLI_addtail(lvl-vert_face_map[lvl-faces[i].v[j]], indexnode); - } - } - - /* edge boundaries */ - emax = (lvl-prev ? (lvl-prev-totedge * 2) : lvl-totedge); - lvl-edge_boundary_states= MEM_callocN(sizeof(char)*lvl-totedge, edge_boundary_states); - for(i=0; iemax; ++i) { - MultiresMapNode *n1= lvl-vert_face_map[lvl-edges[i].v[0]].first; -
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15685] branches/soc-2008-mxcurioni/source /blender/freestyle/intern/python/StrokeAttribute.cpp: soc-2008-mxcurioni: corrected StrokeAttribute, verifi
Revision: 15685 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15685 Author: mxcurioni Date: 2008-07-22 02:27:40 +0200 (Tue, 22 Jul 2008) Log Message: --- soc-2008-mxcurioni: corrected StrokeAttribute, verified with test case. I realized today that it will not be possible to implement getter/setter functionality easily for our Freestyle API. The reason is that Python does not support function overloading as-is. It is possible to 'fake' overloading by taking a general argument object and count the number of arguments in the object (rgbTuple_setCol in Blender's API is a good example of how to go about it). For the time being, we'll get around that problem. The tangible effect of that constraint is that all API setter functions return a 'None' PyObject, instead of returning an integer status code. It is important to note that this problem is due to Freestyle's API being C++ in nature. Fortunately, this shouldn't really impact the usage of the API. If the Blender Python group wants me to correct that, I'll be able to do it. It is just going to take me quite some time correcting it, writing support functions for methods having different types of arguments. Modified Paths: -- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeAttribute.cpp Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeAttribute.cpp === --- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeAttribute.cpp 2008-07-21 23:41:01 UTC (rev 15684) +++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeAttribute.cpp 2008-07-22 00:27:40 UTC (rev 15685) @@ -28,13 +28,13 @@ static PyObject * StrokeAttribute_isAttributeAvailableReal( BPy_StrokeAttribute *self, PyObject *args ); static PyObject * StrokeAttribute_isAttributeAvailableVec2f( BPy_StrokeAttribute *self, PyObject *args ); static PyObject * StrokeAttribute_isAttributeAvailableVec3f( BPy_StrokeAttribute *self, PyObject *args ); -static int StrokeAttribute_setColor( BPy_StrokeAttribute *self, PyObject *args ); -static int StrokeAttribute_setAlpha( BPy_StrokeAttribute *self, PyObject *args ); -static int StrokeAttribute_setThickness( BPy_StrokeAttribute *self, PyObject *args ); -static int StrokeAttribute_setVisible( BPy_StrokeAttribute *self, PyObject *args ); -static int StrokeAttribute_setAttributeReal( BPy_StrokeAttribute *self, PyObject *args ); -static int StrokeAttribute_setAttributeVec2f( BPy_StrokeAttribute *self, PyObject *args ); -static int StrokeAttribute_setAttributeVec3f( BPy_StrokeAttribute *self, PyObject *args ); +static PyObject * StrokeAttribute_setColor( BPy_StrokeAttribute *self, PyObject *args ); +static PyObject * StrokeAttribute_setAlpha( BPy_StrokeAttribute *self, PyObject *args ); +static PyObject * StrokeAttribute_setThickness( BPy_StrokeAttribute *self, PyObject *args ); +static PyObject * StrokeAttribute_setVisible( BPy_StrokeAttribute *self, PyObject *args ); +static PyObject * StrokeAttribute_setAttributeReal( BPy_StrokeAttribute *self, PyObject *args ); +static PyObject * StrokeAttribute_setAttributeVec2f( BPy_StrokeAttribute *self, PyObject *args ); +static PyObject * StrokeAttribute_setAttributeVec3f( BPy_StrokeAttribute *self, PyObject *args ); /*--StrokeAttribute instance definitions */ @@ -64,6 +64,8 @@ {NULL, NULL, 0, NULL} }; + + /*---BPy_StrokeAttribute type definition --*/ PyTypeObject StrokeAttribute_Type = { @@ -124,7 +126,7 @@ /*** Attribute descriptor and subclassing stuff ***/ BPy_StrokeAttribute_methods,/* struct PyMethodDef *tp_methods; */ NULL, /* struct PyMemberDef *tp_members; */ - NULL, /* struct PyGetSetDef *tp_getset; */ + NULL, /* struct PyGetSetDef *tp_getset; */ NULL, /* struct _typeobject *tp_base; */ NULL, /* PyObject *tp_dict; */ NULL, /* descrgetfunc tp_descr_get; */ @@ -184,9 +186,7 @@ *( ((BPy_StrokeAttribute *) obj2)-sa ), PyFloat_AsDouble( obj3 ) ); - } else if( obj4 obj5 obj6 - PyFloat_Check(obj1) PyFloat_Check(obj2) PyFloat_Check(obj2) - PyFloat_Check(obj4)