diff --git a/release/scripts/ac3d_import.py b/release/scripts/ac3d_import.py index d538838fdf3..9a7004e4b4d 100644 --- a/release/scripts/ac3d_import.py +++ b/release/scripts/ac3d_import.py @@ -679,6 +679,8 @@ class AC3DImport: baseimgname = bsys.basename(objtex) if bsys.exists(objtex) == 1: texfname = objtex + elif bsys.exists(bsys.join(self.importdir, objtex)): + texfname = bsys.join(self.importdir, objtex) else: if baseimgname.find('\\') > 0: baseimgname = bsys.basename(objtex.replace('\\','/')) diff --git a/release/scripts/vertexpaint_selfshadow_ao.py b/release/scripts/vertexpaint_selfshadow_ao.py index c083bc9e8b0..7a6f4f9176d 100644 --- a/release/scripts/vertexpaint_selfshadow_ao.py +++ b/release/scripts/vertexpaint_selfshadow_ao.py @@ -39,6 +39,7 @@ and optionaly blur the shading to remove artifacts from spesific edges. # -------------------------------------------------------------------------- from Blender import Scene, Draw, sys, Window, Mathutils, Mesh +import bpy import BPyMesh @@ -135,10 +136,10 @@ def vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_RADIUS, PREF_MIN_EDLEN, PRE Window.WaitCursor(0) def main(): - scn= Scene.GetCurrent() - ob= scn.getActiveObject() + sce= bpy.data.scenes.active + ob= sce.objects.active - if not ob or ob.getType() != 'Mesh': + if not ob or ob.type != 'Mesh': Draw.PupMenu('Error, no active mesh object, aborting.') return @@ -174,8 +175,8 @@ def main(): PREF_SHADOW_ONLY= PREF_SHADOW_ONLY.val PREF_SEL_ONLY= PREF_SEL_ONLY.val - if not me.faceUV: - me.faceUV= 1 + if not me.vertexColors: + me.vertexColors= 1 t= sys.time() vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_RADIUS, PREF_MIN_EDLEN, PREF_CLAMP_CONCAVE, PREF_CLAMP_CONVEX, PREF_SHADOW_ONLY, PREF_SEL_ONLY) diff --git a/source/blender/include/multires.h b/source/blender/include/multires.h index 493387f6e1f..bfa765e62ef 100644 --- a/source/blender/include/multires.h +++ b/source/blender/include/multires.h @@ -63,6 +63,9 @@ void multires_level_to_mesh(struct Object *ob, struct Mesh *me, const int render void multires_edge_level_update(void *ob, void *me); int multires_modifier_warning(); +/* after adding or removing vcolor layers, run this */ +void multires_load_cols(Mesh *me); + /* multires-firstlevel.c */ /* Generic */ void multires_update_first_level(struct Mesh *me, struct EditMesh *em); diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c index 888e14a59e5..0f6a8811ad6 100644 --- a/source/blender/python/api2_2x/Material.c +++ b/source/blender/python/api2_2x/Material.c @@ -3024,7 +3024,7 @@ static PyObject *Matr_oldsetMode( BPy_Material * self, PyObject * args ) "expected nothing, an integer or up to 22 string argument(s)" ) ); /* build tuple, call wrapper */ - value = PyInt_FromLong( (long)flag ); + value = Py_BuildValue("(i)", flag); error = EXPP_setterWrapper( (void *)self, value, (setter)Material_setMode ); Py_DECREF ( value ); return error; diff --git a/source/blender/python/api2_2x/doc/Mesh.py b/source/blender/python/api2_2x/doc/Mesh.py index 2b858ab7748..3f339b5aa8c 100644 --- a/source/blender/python/api2_2x/doc/Mesh.py +++ b/source/blender/python/api2_2x/doc/Mesh.py @@ -17,6 +17,7 @@ face's attributes (the vertex color): Example:: from Blender import * + import bpy editmode = Window.EditMode() # are we in edit mode? If so ... if editmode: Window.EditMode(0) # leave edit mode before getting the mesh @@ -25,7 +26,7 @@ Example:: coords=[ [-1,-1,-1], [1,-1,-1], [1,1,-1], [-1,1,-1], [0,0,1] ] faces= [ [3,2,1,0], [0,1,4], [1,2,4], [2,3,4], [3,0,4] ] - me = Mesh.New('myMesh') # create a new mesh + me = bpy.data.meshes.new('myMesh') # create a new mesh me.verts.extend(coords) # add vertices to mesh me.faces.extend(faces) # add faces to the mesh (also adds edges) @@ -35,7 +36,7 @@ Example:: me.faces[1].col[1].g = 255 me.faces[1].col[2].b = 255 - scn = Scene.GetCurrent() # link object to current scene + scn = bpy.data.scenes.active # link object to current scene ob = scn.objects.new(me, 'myObj') if editmode: Window.EditMode(1) # optional, just being nice @@ -518,7 +519,7 @@ class MFace: me= ob.getData(mesh=1) # thin wrapper doesn't copy mesh data like nmesh me.vertexColors= True # Enable face, vertex colors for f in me.faces: - for i, v in enumerate(f.v): + for i, v in enumerate(f): no= v.no col= f.col[i] col.r= int((no.x+1)*128) @@ -740,19 +741,9 @@ class Mesh: @type hide: boolean @ivar subDivLevels: The [display, rendering] subdivision levels in [1, 6]. @type subDivLevels: list of 2 ints - - @ivar faceUV: The mesh contains UV-mapped textured faces. Enabling faceUV - does not initialize the face colors like the Blender UI does; this must - be done in the script. B{Note}: if faceUV is set, L{vertexColors} cannot - be set. Furthermore, if vertexColors is already set when faceUV is set, - vertexColors is cleared. This is because the vertex color information - is stored with UV faces, so enabling faceUV implies enabling vertexColors. - In addition, faceUV cannot be set when the mesh has no faces defined - (this is the same behavior as the UI). Attempting to do so will throw - a RuntimeError exception. + @ivar faceUV: The mesh contains UV-mapped textured faces. @type faceUV: bool - @ivar vertexColors: The mesh contains vertex colors. See L{faceUV} for the - use of vertex colors when UV-mapped texture faces are enabled. + @ivar vertexColors: The mesh contains vertex colors. Set True to add vertex colors. @type vertexColors: bool @ivar vertexUV: The mesh contains "sticky" per-vertex UV coordinates. @type vertexUV: bool diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 65b299b9f96..3c995c4d19a 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -4090,6 +4090,8 @@ void do_meshbuts(unsigned short event) if(!mcol) shadeMeshMCol(ob, me); } + + if (me->mr) multires_load_cols(me); DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); BIF_undo_push("New Vertex Color"); diff --git a/source/blender/src/vpaint.c b/source/blender/src/vpaint.c index 1fbc8d43920..8c95dcd52cc 100644 --- a/source/blender/src/vpaint.c +++ b/source/blender/src/vpaint.c @@ -250,7 +250,9 @@ void make_vertexcol(int shade) /* single ob */ shadeMeshMCol(ob, me); else memset(me->mcol, 255, 4*sizeof(MCol)*me->totface); - + + if (me->mr) multires_load_cols(me); + DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); allqueue(REDRAWBUTSEDIT, 0);