forked from bartvdbraak/blender
fixes from 2.4x
This commit is contained in:
parent
3237a56b5d
commit
c6785e3292
@ -679,6 +679,8 @@ class AC3DImport:
|
|||||||
baseimgname = bsys.basename(objtex)
|
baseimgname = bsys.basename(objtex)
|
||||||
if bsys.exists(objtex) == 1:
|
if bsys.exists(objtex) == 1:
|
||||||
texfname = objtex
|
texfname = objtex
|
||||||
|
elif bsys.exists(bsys.join(self.importdir, objtex)):
|
||||||
|
texfname = bsys.join(self.importdir, objtex)
|
||||||
else:
|
else:
|
||||||
if baseimgname.find('\\') > 0:
|
if baseimgname.find('\\') > 0:
|
||||||
baseimgname = bsys.basename(objtex.replace('\\','/'))
|
baseimgname = bsys.basename(objtex.replace('\\','/'))
|
||||||
|
@ -39,6 +39,7 @@ and optionaly blur the shading to remove artifacts from spesific edges.
|
|||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
|
|
||||||
from Blender import Scene, Draw, sys, Window, Mathutils, Mesh
|
from Blender import Scene, Draw, sys, Window, Mathutils, Mesh
|
||||||
|
import bpy
|
||||||
import BPyMesh
|
import BPyMesh
|
||||||
|
|
||||||
|
|
||||||
@ -135,10 +136,10 @@ def vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_RADIUS, PREF_MIN_EDLEN, PRE
|
|||||||
Window.WaitCursor(0)
|
Window.WaitCursor(0)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
scn= Scene.GetCurrent()
|
sce= bpy.data.scenes.active
|
||||||
ob= scn.getActiveObject()
|
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.')
|
Draw.PupMenu('Error, no active mesh object, aborting.')
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -174,8 +175,8 @@ def main():
|
|||||||
PREF_SHADOW_ONLY= PREF_SHADOW_ONLY.val
|
PREF_SHADOW_ONLY= PREF_SHADOW_ONLY.val
|
||||||
PREF_SEL_ONLY= PREF_SEL_ONLY.val
|
PREF_SEL_ONLY= PREF_SEL_ONLY.val
|
||||||
|
|
||||||
if not me.faceUV:
|
if not me.vertexColors:
|
||||||
me.faceUV= 1
|
me.vertexColors= 1
|
||||||
|
|
||||||
t= sys.time()
|
t= sys.time()
|
||||||
vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_RADIUS, PREF_MIN_EDLEN, PREF_CLAMP_CONCAVE, PREF_CLAMP_CONVEX, PREF_SHADOW_ONLY, PREF_SEL_ONLY)
|
vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_RADIUS, PREF_MIN_EDLEN, PREF_CLAMP_CONCAVE, PREF_CLAMP_CONVEX, PREF_SHADOW_ONLY, PREF_SEL_ONLY)
|
||||||
|
@ -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);
|
void multires_edge_level_update(void *ob, void *me);
|
||||||
int multires_modifier_warning();
|
int multires_modifier_warning();
|
||||||
|
|
||||||
|
/* after adding or removing vcolor layers, run this */
|
||||||
|
void multires_load_cols(Mesh *me);
|
||||||
|
|
||||||
/* multires-firstlevel.c */
|
/* multires-firstlevel.c */
|
||||||
/* Generic */
|
/* Generic */
|
||||||
void multires_update_first_level(struct Mesh *me, struct EditMesh *em);
|
void multires_update_first_level(struct Mesh *me, struct EditMesh *em);
|
||||||
|
@ -3024,7 +3024,7 @@ static PyObject *Matr_oldsetMode( BPy_Material * self, PyObject * args )
|
|||||||
"expected nothing, an integer or up to 22 string argument(s)" ) );
|
"expected nothing, an integer or up to 22 string argument(s)" ) );
|
||||||
/* build tuple, call wrapper */
|
/* build tuple, call wrapper */
|
||||||
|
|
||||||
value = PyInt_FromLong( (long)flag );
|
value = Py_BuildValue("(i)", flag);
|
||||||
error = EXPP_setterWrapper( (void *)self, value, (setter)Material_setMode );
|
error = EXPP_setterWrapper( (void *)self, value, (setter)Material_setMode );
|
||||||
Py_DECREF ( value );
|
Py_DECREF ( value );
|
||||||
return error;
|
return error;
|
||||||
|
@ -17,6 +17,7 @@ face's attributes (the vertex color):
|
|||||||
|
|
||||||
Example::
|
Example::
|
||||||
from Blender import *
|
from Blender import *
|
||||||
|
import bpy
|
||||||
|
|
||||||
editmode = Window.EditMode() # are we in edit mode? If so ...
|
editmode = Window.EditMode() # are we in edit mode? If so ...
|
||||||
if editmode: Window.EditMode(0) # leave edit mode before getting the mesh
|
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] ]
|
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] ]
|
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.verts.extend(coords) # add vertices to mesh
|
||||||
me.faces.extend(faces) # add faces to the mesh (also adds edges)
|
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[1].g = 255
|
||||||
me.faces[1].col[2].b = 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')
|
ob = scn.objects.new(me, 'myObj')
|
||||||
|
|
||||||
if editmode: Window.EditMode(1) # optional, just being nice
|
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= ob.getData(mesh=1) # thin wrapper doesn't copy mesh data like nmesh
|
||||||
me.vertexColors= True # Enable face, vertex colors
|
me.vertexColors= True # Enable face, vertex colors
|
||||||
for f in me.faces:
|
for f in me.faces:
|
||||||
for i, v in enumerate(f.v):
|
for i, v in enumerate(f):
|
||||||
no= v.no
|
no= v.no
|
||||||
col= f.col[i]
|
col= f.col[i]
|
||||||
col.r= int((no.x+1)*128)
|
col.r= int((no.x+1)*128)
|
||||||
@ -740,19 +741,9 @@ class Mesh:
|
|||||||
@type hide: boolean
|
@type hide: boolean
|
||||||
@ivar subDivLevels: The [display, rendering] subdivision levels in [1, 6].
|
@ivar subDivLevels: The [display, rendering] subdivision levels in [1, 6].
|
||||||
@type subDivLevels: list of 2 ints
|
@type subDivLevels: list of 2 ints
|
||||||
|
@ivar faceUV: The mesh contains UV-mapped textured faces.
|
||||||
@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.
|
|
||||||
@type faceUV: bool
|
@type faceUV: bool
|
||||||
@ivar vertexColors: The mesh contains vertex colors. See L{faceUV} for the
|
@ivar vertexColors: The mesh contains vertex colors. Set True to add vertex colors.
|
||||||
use of vertex colors when UV-mapped texture faces are enabled.
|
|
||||||
@type vertexColors: bool
|
@type vertexColors: bool
|
||||||
@ivar vertexUV: The mesh contains "sticky" per-vertex UV coordinates.
|
@ivar vertexUV: The mesh contains "sticky" per-vertex UV coordinates.
|
||||||
@type vertexUV: bool
|
@type vertexUV: bool
|
||||||
|
@ -4091,6 +4091,8 @@ void do_meshbuts(unsigned short event)
|
|||||||
shadeMeshMCol(ob, me);
|
shadeMeshMCol(ob, me);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (me->mr) multires_load_cols(me);
|
||||||
|
|
||||||
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
|
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
|
||||||
BIF_undo_push("New Vertex Color");
|
BIF_undo_push("New Vertex Color");
|
||||||
allqueue(REDRAWVIEW3D, 0);
|
allqueue(REDRAWVIEW3D, 0);
|
||||||
|
@ -251,6 +251,8 @@ void make_vertexcol(int shade) /* single ob */
|
|||||||
else
|
else
|
||||||
memset(me->mcol, 255, 4*sizeof(MCol)*me->totface);
|
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);
|
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
|
||||||
|
|
||||||
allqueue(REDRAWBUTSEDIT, 0);
|
allqueue(REDRAWBUTSEDIT, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user