Merged changes in the trunk up to revision 27178.

This commit is contained in:
2010-02-28 03:44:15 +00:00
239 changed files with 3895 additions and 2251 deletions

View File

@@ -276,15 +276,10 @@ IF(WIN32)
SET(PYTHON_LIB python31)
SET(PYTHON_LIBPATH ${PYTHON}/lib)
IF(CMAKE_CL_64)
SET(WITH_OPENAL OFF)
ELSE(CMAKE_CL_64)
#SET(WITH_OPENAL ON)
SET(OPENAL ${LIBDIR}/openal)
SET(OPENAL_INCLUDE_DIR ${OPENAL}/include)
SET(OPENAL_LIBRARY wrap_oal)
SET(OPENAL_LIBPATH ${OPENAL}/lib)
ENDIF(CMAKE_CL_64)
SET(OPENAL ${LIBDIR}/openal)
SET(OPENAL_INCLUDE_DIR ${OPENAL}/include)
SET(OPENAL_LIBRARY wrap_oal)
SET(OPENAL_LIBPATH ${OPENAL}/lib)
IF(WITH_JACK)
SET(JACK ${LIBDIR}/jack)
@@ -508,7 +503,7 @@ IF(APPLE)
SET(ZLIB /usr)
SET(ZLIB_INC "${ZLIB}/include")
SET(ZLIB_LIBRARIES z)
SET(ZLIB_LIBRARIES z bz2)
SET(FREETYPE ${LIBDIR}/freetype)
SET(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
@@ -522,7 +517,7 @@ IF(APPLE)
SET(FFMPEG ${LIBDIR}/ffmpeg)
SET(FFMPEG_INC ${FFMPEG}/include)
SET(FFMPEG_LIB avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore)
SET(FFMPEG_LIB avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg)
SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
SET(LIBSAMPLERATE ${LIBDIR}/samplerate)
@@ -689,4 +684,3 @@ ADD_SUBDIRECTORY(source/creator)
IF(WITH_PLAYER)
ADD_SUBDIRECTORY(source/blenderplayer)
ENDIF(WITH_PLAYER)

View File

@@ -611,18 +611,6 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
'${BF_FFMPEG_LIBPATH}/avutil-50.dll',
'${BF_FFMPEG_LIBPATH}/swscale-0.dll']
if env['OURPLATFORM'] != 'linuxcross':
#
# TODO: Does it mean we haven't got support of this codecs if
# we're using cross-compilation?
# Or in case of native compilation this libraries are
# unneccessary to?
#
dllsources += ['${LCGDIR}/ffmpeg/lib/libfaac-0.dll',
'${LCGDIR}/ffmpeg/lib/libfaad-2.dll',
'${LCGDIR}/ffmpeg/lib/libmp3lame-0.dll',
'${LCGDIR}/ffmpeg/lib/libx264-67.dll']
if env['WITH_BF_JACK']:
dllsources += ['${LCGDIR}/jack/lib/libjack.dll']
windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)

View File

@@ -82,7 +82,8 @@ WITH_BF_FFMPEG = True # -DWITH_FFMPEG
BF_FFMPEG = LIBDIR + '/ffmpeg'
BF_FFMPEG_INC = "${BF_FFMPEG}/include"
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
BF_FFMPEG_LIB = 'avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore'
BF_FFMPEG_LIB = 'avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg bz2'
#bz2 is a standard osx dynlib
# python 3.1 uses precompiled libraries in bf svn /lib by default
BF_PYTHON_VERSION = '3.1'

View File

@@ -2,11 +2,11 @@ LCGDIR = '#../lib/win64'
LIBDIR = '${LCGDIR}'
# enable ffmpeg support
WITH_BF_FFMPEG = False # -DWITH_FFMPEG
WITH_BF_FFMPEG = True # -DWITH_FFMPEG
BF_FFMPEG = LIBDIR +'/ffmpeg'
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
BF_FFMPEG_INC = '${BF_FFMPEG}/include ${BF_FFMPEG}/include/msvc '
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
BF_FFMPEG_LIB = 'avformat-52.lib avcodec-51.lib avdevice-52.lib avutil-49.lib swscale-0.lib'
BF_FFMPEG_LIB = 'avformat-52.lib avcodec-52.lib avdevice-52.lib avutil-50.lib swscale-0.lib'
BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_VERSION = '3.1'

View File

@@ -824,14 +824,14 @@ extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection);
* "unpack and run" path, then look for properly installed path, not including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
extern GHOST_TUns8* GHOST_getSystemDir();
extern const GHOST_TUns8* GHOST_getSystemDir();
/**
* Determine the base dir in which user configuration is stored, not including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
extern GHOST_TUns8* GHOST_getUserDir();
extern const GHOST_TUns8* GHOST_getUserDir();
#ifdef __cplusplus

View File

@@ -380,14 +380,14 @@ public:
* "unpack and run" path, then look for properly installed path, not including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
virtual GHOST_TUns8* getSystemDir() const = 0;
virtual const GHOST_TUns8* getSystemDir() const = 0;
/**
* Determine the base dir in which user configuration is stored, not including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
virtual GHOST_TUns8* getUserDir() const = 0;
virtual const GHOST_TUns8* getUserDir() const = 0;
protected:
/**

View File

@@ -855,13 +855,13 @@ void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection)
system->putClipboard(buffer, selection);
}
GHOST_TUns8* GHOST_getSystemDir()
const GHOST_TUns8* GHOST_getSystemDir()
{
GHOST_ISystem* system = GHOST_ISystem::getSystem();
return system->getSystemDir();
}
GHOST_TUns8* GHOST_getUserDir()
const GHOST_TUns8* GHOST_getUserDir()
{
GHOST_ISystem* system = GHOST_ISystem::getSystem();
return system->getUserDir();

View File

@@ -302,14 +302,14 @@ public:
* "unpack and run" path, then look for properly installed path, not including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
virtual GHOST_TUns8* getSystemDir() const = 0;
virtual const GHOST_TUns8* getSystemDir() const = 0;
/**
* Determine the base dir in which user configuration is stored, not including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
virtual GHOST_TUns8* getUserDir() const = 0;
virtual const GHOST_TUns8* getUserDir() const = 0;
protected:
/**

View File

@@ -809,7 +809,7 @@ OSStatus GHOST_SystemCarbon::handleTabletEvent(EventRef event)
}
err = noErr;
}
return err;
}
OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event)
@@ -1215,22 +1215,19 @@ void GHOST_SystemCarbon::putClipboard(GHOST_TInt8 *buffer, bool selection) const
}
}
GHOST_TUns8* GHOST_SystemCarbon::getSystemDir() const
const GHOST_TUns8* GHOST_SystemCarbon::getSystemDir() const
{
static GHOST_TUns8 sysPath[64];
strcpy((char*)sysPath,"/Library/Application Support/Blender");
return sysPath;
return (GHOST_TUns8*)"/Library/Application Support/Blender";
}
GHOST_TUns8* GHOST_SystemCarbon::getUserDir() const
const GHOST_TUns8* GHOST_SystemCarbon::getUserDir() const
{
static char usrPath[512] = "";
static char usrPath[256] = "";
char* env = getenv("HOME");
if (env) {
strcpy(usrPath, env);
strncpy(usrPath, env, 245);
usrPath[245]=0;
strcat(usrPath, "/Library/Application Support/Blender");
return (GHOST_TUns8*) usrPath;
}

View File

@@ -195,14 +195,14 @@ public:
* "unpack and run" path, then look for properly installed path, not including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
virtual GHOST_TUns8* getSystemDir() const;
virtual const GHOST_TUns8* getSystemDir() const;
/**
* Determine the base dir in which user configuration is stored, not including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
virtual GHOST_TUns8* getUserDir() const;
virtual const GHOST_TUns8* getUserDir() const;
protected:
/**

View File

@@ -218,14 +218,14 @@ public:
* "unpack and run" path, then look for properly installed path, not including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
virtual GHOST_TUns8* getSystemDir() const;
virtual const GHOST_TUns8* getSystemDir() const;
/**
* Determine the base dir in which user configuration is stored, not including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
virtual GHOST_TUns8* getUserDir() const;
virtual const GHOST_TUns8* getUserDir() const;
/**
* Handles a window event. Called by GHOST_WindowCocoa window delegate

View File

@@ -1714,7 +1714,7 @@ void GHOST_SystemCocoa::putClipboard(GHOST_TInt8 *buffer, bool selection) const
#pragma mark Base directories retrieval
GHOST_TUns8* GHOST_SystemCocoa::getSystemDir() const
const GHOST_TUns8* GHOST_SystemCocoa::getSystemDir() const
{
static GHOST_TUns8 tempPath[512] = "";
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@@ -1742,7 +1742,7 @@ GHOST_TUns8* GHOST_SystemCocoa::getSystemDir() const
return tempPath;
}
GHOST_TUns8* GHOST_SystemCocoa::getUserDir() const
const GHOST_TUns8* GHOST_SystemCocoa::getUserDir() const
{
static GHOST_TUns8 tempPath[512] = "";
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

View File

@@ -1095,12 +1095,12 @@ void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, bool selection) const
}
}
GHOST_TUns8* GHOST_SystemWin32::getSystemDir() const
const GHOST_TUns8* GHOST_SystemWin32::getSystemDir() const
{
return NULL;
}
GHOST_TUns8* GHOST_SystemWin32::getUserDir() const
const GHOST_TUns8* GHOST_SystemWin32::getUserDir() const
{
return NULL;
}

View File

@@ -193,14 +193,14 @@ public:
* "unpack and run" path, then look for properly installed path, not including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
GHOST_TUns8* getSystemDir() const;
virtual const GHOST_TUns8* getSystemDir() const;
/**
* Determine the base dir in which user configuration is stored, not including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
GHOST_TUns8* getUserDir() const;
virtual const GHOST_TUns8* getUserDir() const;
/**
* Creates a drag'n'drop event and pushes it immediately onto the event queue.

View File

@@ -1458,19 +1458,19 @@ void GHOST_SystemX11::putClipboard(GHOST_TInt8 *buffer, bool selection) const
}
}
GHOST_TUns8* GHOST_SystemX11::getSystemDir() const
const GHOST_TUns8* GHOST_SystemX11::getSystemDir() const
{
return (GHOST_TUns8*)"/usr/share/blender";
}
GHOST_TUns8* GHOST_SystemX11::getUserDir() const
const GHOST_TUns8* GHOST_SystemX11::getUserDir() const
{
char* path;
static char path[256];
char* env = getenv("HOME");
if(env) {
path = (char*) malloc(strlen(env) + 10); // "/.blender/"
strcat(path, env);
strcat(path, "/,blender/");
strncpy(path, env, 245);
path[245]=0;
strcat(path, "/.blender/");
return (GHOST_TUns8*) path;
} else {
return NULL;

View File

@@ -231,14 +231,14 @@ public:
* "unpack and run" path, then look for properly installed path, not including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
GHOST_TUns8* getSystemDir() const;
const GHOST_TUns8* getSystemDir() const;
/**
* Determine the base dir in which user configuration is stored, not including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
GHOST_TUns8* getUserDir() const;
const GHOST_TUns8* getUserDir() const;
/**
* Atom used for ICCCM, WM-spec and Motif.

View File

@@ -136,14 +136,14 @@ GHOST_WindowCarbon::GHOST_WindowCarbon(
&m_windowRef);
if ( err != noErr) {
fprintf(stderr," error creating window %i \n",err);
fprintf(stderr," error creating window %i \n",(int)err);
} else {
::SetWRefCon(m_windowRef,(SInt32)this);
setTitle(title);
err = InstallWindowEventHandler (m_windowRef, myWEventHandlerProc, GetEventTypeCount(kWEvents), kWEvents,NULL,NULL);
if ( err != noErr) {
fprintf(stderr," error creating handler %i \n",err);
fprintf(stderr," error creating handler %i \n",(int)err);
} else {
// ::TransitionWindow (m_windowRef,kWindowZoomTransitionEffect,kWindowShowTransitionAction,NULL);
::ShowWindow(m_windowRef);

View File

@@ -425,6 +425,10 @@
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath="..\..\..\source\blender\python\generic\BGL.h"
>
</File>
<File
RelativePath="..\..\..\source\blender\python\BPY_extern.h"
>

View File

@@ -250,6 +250,10 @@
RelativePath="..\..\..\source\blender\editors\include\ED_node.h"
>
</File>
<File
RelativePath="..\..\..\source\blender\editors\include\ED_numinput.h"
>
</File>
<File
RelativePath="..\..\..\source\blender\editors\include\ED_object.h"
>
@@ -599,6 +603,10 @@
RelativePath="..\..\..\source\blender\editors\util\editmode_undo.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\editors\util\numinput.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\editors\util\undo.c"
>
@@ -1163,10 +1171,6 @@
RelativePath="..\..\..\source\blender\editors\transform\transform_ndofinput.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\editors\transform\transform_numinput.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\editors\transform\transform_ops.c"
>
@@ -1287,6 +1291,10 @@
RelativePath="..\..\..\source\blender\editors\armature\poseSlide.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\editors\armature\poseUtils.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\editors\armature\reeb.c"
>

View File

@@ -42,7 +42,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\lib\windows\python\include\python3.1;..\..\..\..\lib\windows\ffmpeg\include;..\..\..\..\lib\windows\ffmpeg\include\msvc;..\..\..\..\lib\windows\pthreads\include;..\..\..\source\gameengine\Ketsji;..\..\..\source\gameengine\Expressions;..\..\..\source\gameengine\GameLogic;..\..\..\source\gameengine\SceneGraph;..\..\..\source\gameengine\Rasterizer;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\BlenderRoutines;..\..\..\source\blender\editors\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\blender\imbuf;..\..\..\source\blender\python;..\..\..\source\blender\gpu;..\..\..\source\kernel\gen_system;..\..\..\intern\string;..\..\..\intern\moto\include;..\..\..\intern\guardedalloc;..\..\..\intern\SoundSystem;..\..\..\extern\glew\include;..\..\..\..\build\msvc_9\intern\guardedalloc\include"
AdditionalIncludeDirectories="..\..\..\..\lib\windows\python\include\python3.1;..\..\..\..\lib\windows\ffmpeg\include;..\..\..\..\lib\windows\ffmpeg\include\msvc;..\..\..\..\lib\windows\pthreads\include;..\..\..\source\gameengine\Ketsji;..\..\..\source\gameengine\Expressions;..\..\..\source\gameengine\GameLogic;..\..\..\source\gameengine\SceneGraph;..\..\..\source\gameengine\Rasterizer;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\BlenderRoutines;..\..\..\source\blender\editors\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\blender\imbuf;..\..\..\source\blender\python;..\..\..\source\blender\python\generic;..\..\..\source\blender\gpu;..\..\..\source\kernel\gen_system;..\..\..\intern\string;..\..\..\intern\moto\include;..\..\..\intern\guardedalloc;..\..\..\intern\SoundSystem;..\..\..\extern\glew\include;..\..\..\..\build\msvc_9\intern\guardedalloc\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;WITH_FFMPEG;__STDC_CONSTANT_MACROS"
StringPooling="false"
BasicRuntimeChecks="3"

View File

@@ -50,7 +50,7 @@ for i in vertexgroup_vertex_indices:
Now for some reason the name does not 'stick' and we have to set it this way:
vertexgroup.name = 'NAME_OF_VERTEXGROUP'
Conversion to 2.50 also meant we could simply do away with our crude user interface.
Just definining the appropriate properties in the AddGear() operator will display the
properties in the Blender GUI with the added benefit of making it interactive: changing
@@ -65,7 +65,7 @@ we could no longer use deepcopy(zip(...)) but had to convert the zip object to a
first.
The code to actually implement the AddGear() function is mostly copied from add_mesh_torus()
(distributed with Blender).
(distributed with Blender).
Unresolved issues:
@@ -108,148 +108,148 @@ tv = [13,14,15,29,30,31] #vertices on a tooth
spokefaces=((0,1,2,5),(2,3,4,7),(5,2,7,6),(5,6,9,8),(6,7,10,9),(11,8,13,12),(8,9,10,13),(13,10,15,14))
def add_tooth(a,t,d,r,Ad,De,b,p,rack=0,crown=0.0):
"""
private function: calculate the vertex coords for a single side
section of a gear tooth. returns them as a list of lists.
"""
A=[a,a+t/4,a+t/2,a+3*t/4,a+t]
C=[cos(i) for i in A]
S=[sin(i) for i in A]
Ra=r+Ad
Rd=r-De
Rb=Rd-b
#Pressure angle calc
O =Ad*tan(p)
p =atan(O/Ra)
if r<0 : p = -p
if rack :
S =[sin(t/4)*I for I in range(-2,3)]
Sp=[0,sin(-t/4+p),0,sin(t/4-p)]
"""
private function: calculate the vertex coords for a single side
section of a gear tooth. returns them as a list of lists.
"""
v=[(Rb,r*S[I],d) for I in range(5)]
v.extend([(Rd,r*S[I],d) for I in range(5)])
v.extend([(r,r*S[I],d) for I in range(1,4)])
v.extend([(Ra,r*Sp[I],d) for I in range(1,4)])
else :
Cp=[0,cos(a+t/4+p),cos(a+t/2),cos(a+3*t/4-p)]
Sp=[0,sin(a+t/4+p),sin(a+t/2),sin(a+3*t/4-p)]
A=[a,a+t/4,a+t/2,a+3*t/4,a+t]
C=[cos(i) for i in A]
S=[sin(i) for i in A]
v=[(Rb*C[I],Rb*S[I],d) for I in range(5)]
v.extend([(Rd*C[I],Rd*S[I],d) for I in range(5)])
v.extend([(r*C[I],r*S[I],d+crown/3) for I in range(1,4)])
v.extend([(Ra*Cp[I],Ra*Sp[I],d+crown) for I in range(1,4)])
return v
Ra=r+Ad
Rd=r-De
Rb=Rd-b
#Pressure angle calc
O =Ad*tan(p)
p =atan(O/Ra)
if r<0 : p = -p
if rack :
S =[sin(t/4)*I for I in range(-2,3)]
Sp=[0,sin(-t/4+p),0,sin(t/4-p)]
v=[(Rb,r*S[I],d) for I in range(5)]
v.extend([(Rd,r*S[I],d) for I in range(5)])
v.extend([(r,r*S[I],d) for I in range(1,4)])
v.extend([(Ra,r*Sp[I],d) for I in range(1,4)])
else :
Cp=[0,cos(a+t/4+p),cos(a+t/2),cos(a+3*t/4-p)]
Sp=[0,sin(a+t/4+p),sin(a+t/2),sin(a+3*t/4-p)]
v=[(Rb*C[I],Rb*S[I],d) for I in range(5)]
v.extend([(Rd*C[I],Rd*S[I],d) for I in range(5)])
v.extend([(r*C[I],r*S[I],d+crown/3) for I in range(1,4)])
v.extend([(Ra*Cp[I],Ra*Sp[I],d+crown) for I in range(1,4)])
return v
def add_spoke2(a,t,d,r,De,b,s,w,l,gap=0,width=19):
"""
EXPERIMENTAL private function: calculate the vertex coords for a single side
section of a gearspoke. returns them as a list of lists.
"""
Rd=r-De
Rb=Rd-b
Rl=Rb
v =[]
ef =[]
ef2=[]
sf =[]
if not gap :
for N in range(width,1,-2) :
ef.append(len(v))
ts = t/4
tm = a + 2*ts
te = asin(w/Rb)
td = te - ts
t4 = ts+td*(width-N)/(width-3.0)
A=[tm+(i-int(N/2))*t4 for i in range(N)]
C=[cos(i) for i in A]
S=[sin(i) for i in A]
v.extend([ (Rb*I,Rb*J,d) for (I,J) in zip(C,S)])
ef2.append(len(v)-1)
Rb= Rb-s
n=0
for N in range(width,3,-2) :
sf.extend([(i+n,i+1+n,i+2+n,i+N+n) for i in range(0,N-1,2)])
sf.extend([(i+2+n,i+N+n,i+N+1+n,i+N+2+n) for i in range(0,N-3,2)])
n = n + N
return v,ef,ef2,sf
"""
EXPERIMENTAL private function: calculate the vertex coords for a single side
section of a gearspoke. returns them as a list of lists.
"""
Rd=r-De
Rb=Rd-b
Rl=Rb
v =[]
ef =[]
ef2=[]
sf =[]
if not gap :
for N in range(width,1,-2) :
ef.append(len(v))
ts = t/4
tm = a + 2*ts
te = asin(w/Rb)
td = te - ts
t4 = ts+td*(width-N)/(width-3.0)
A=[tm+(i-int(N/2))*t4 for i in range(N)]
C=[cos(i) for i in A]
S=[sin(i) for i in A]
v.extend([ (Rb*I,Rb*J,d) for (I,J) in zip(C,S)])
ef2.append(len(v)-1)
Rb= Rb-s
n=0
for N in range(width,3,-2) :
sf.extend([(i+n,i+1+n,i+2+n,i+N+n) for i in range(0,N-1,2)])
sf.extend([(i+2+n,i+N+n,i+N+1+n,i+N+2+n) for i in range(0,N-3,2)])
n = n + N
return v,ef,ef2,sf
def add_gear(N,r,Ad,De,b,p,D=1,skew=0,conangle=0,rack=0,crown=0.0, spoke=0,spbevel=0.1,spwidth=0.2,splength=1.0,spresol=9):
"""
"""
worm =0
if N<5 : (worm,N)=(N,24)
t =2*pi/N
if rack: N=1
p =rad(p)
conangle=rad(conangle)
skew =rad(skew)
scale = (r - 2*D*tan(conangle) )/r
f =[]
v =[]
tg=[] #vertexgroup of top vertices.
vg=[] #vertexgroup of valley vertices
M=[0]
if worm : (M,skew,D)=(range(32),rad(11.25),D/2)
for W in M:
fl=W*N*L*2
l=0 #number of vertices
for I in range(int(N)):
a=I*t
for(s,d,c,first) in ((W*skew,W*2*D-D,1,1),((W+1)*skew,W*2*D+D,scale,0)):
if worm and I%(int(N)/worm)!=0:
v.extend(add_tooth(a+s,t,d,r-De,0.0,0.0,b,p))
else:
v.extend(add_tooth(a+s,t,d,r*c,Ad*c,De*c,b*c,p,rack,crown))
if not worm or (W==0 and first) or (W==(len(M)-1) and not first) :
f.extend([ [j+l+fl for j in i]for i in dc(faces)])
l += L
"""
"""
worm =0
if N<5 : (worm,N)=(N,24)
t =2*pi/N
if rack: N=1
p =rad(p)
conangle=rad(conangle)
skew =rad(skew)
scale = (r - 2*D*tan(conangle) )/r
#print (len(f))
#print (dc(efc))
f.extend([ [j+I*L*2+fl for j in i] for i in dc(efc)])
#print (len(f))
tg.extend([i+I*L*2 for i in tv])
vg.extend([i+I*L*2 for i in vv])
# EXPERIMENTAL: add spokes
if not worm and spoke>0 :
fl=len(v)
for I in range(int(N)):
a=I*t
s=0 # for test
if I%spoke==0 :
for d in (-D,D) :
(sv,ef,ef2,sf) = add_spoke2(a+s,t,d,r*c,De*c,b*c,spbevel,spwidth,splength,0,spresol)
v.extend(sv)
f.extend([ [j+fl for j in i]for i in sf])
fl += len(sv)
d1 = fl-len(sv)
d2 = fl-2*len(sv)
f.extend([(i+d2,j+d2,j+d1,i+d1) for (i,j) in zip(ef[:-1],ef[1:])])
f.extend([(i+d2,j+d2,j+d1,i+d1) for (i,j) in zip(ef2[:-1],ef2[1:])])
else :
for d in (-D,D) :
(sv,ef,ef2,sf) = add_spoke2(a+s,t,d,r*c,De*c,b*c,spbevel,spwidth,splength,1,spresol)
v.extend(sv)
fl += len(sv)
d1 = fl-len(sv)
d2 = fl-2*len(sv)
#f.extend([(i+d2,i+1+d2,i+1+d1,i+d1) for (i) in (0,1,2,3)])
#f.extend([(i+d2,i+1+d2,i+1+d1,i+d1) for (i) in (5,6,7,8)])
return flatten(v), flatten(f), tg, vg
f =[]
v =[]
tg=[] #vertexgroup of top vertices.
vg=[] #vertexgroup of valley vertices
M=[0]
if worm : (M,skew,D)=(range(32),rad(11.25),D/2)
for W in M:
fl=W*N*L*2
l=0 #number of vertices
for I in range(int(N)):
a=I*t
for(s,d,c,first) in ((W*skew,W*2*D-D,1,1),((W+1)*skew,W*2*D+D,scale,0)):
if worm and I%(int(N)/worm)!=0:
v.extend(add_tooth(a+s,t,d,r-De,0.0,0.0,b,p))
else:
v.extend(add_tooth(a+s,t,d,r*c,Ad*c,De*c,b*c,p,rack,crown))
if not worm or (W==0 and first) or (W==(len(M)-1) and not first) :
f.extend([ [j+l+fl for j in i]for i in dc(faces)])
l += L
#print (len(f))
#print (dc(efc))
f.extend([ [j+I*L*2+fl for j in i] for i in dc(efc)])
#print (len(f))
tg.extend([i+I*L*2 for i in tv])
vg.extend([i+I*L*2 for i in vv])
# EXPERIMENTAL: add spokes
if not worm and spoke>0 :
fl=len(v)
for I in range(int(N)):
a=I*t
s=0 # for test
if I%spoke==0 :
for d in (-D,D) :
(sv,ef,ef2,sf) = add_spoke2(a+s,t,d,r*c,De*c,b*c,spbevel,spwidth,splength,0,spresol)
v.extend(sv)
f.extend([ [j+fl for j in i]for i in sf])
fl += len(sv)
d1 = fl-len(sv)
d2 = fl-2*len(sv)
f.extend([(i+d2,j+d2,j+d1,i+d1) for (i,j) in zip(ef[:-1],ef[1:])])
f.extend([(i+d2,j+d2,j+d1,i+d1) for (i,j) in zip(ef2[:-1],ef2[1:])])
else :
for d in (-D,D) :
(sv,ef,ef2,sf) = add_spoke2(a+s,t,d,r*c,De*c,b*c,spbevel,spwidth,splength,1,spresol)
v.extend(sv)
fl += len(sv)
d1 = fl-len(sv)
d2 = fl-2*len(sv)
#f.extend([(i+d2,i+1+d2,i+1+d1,i+d1) for (i) in (0,1,2,3)])
#f.extend([(i+d2,i+1+d2,i+1+d1,i+d1) for (i) in (5,6,7,8)])
return flatten(v), flatten(f), tg, vg
from bpy.props import *
@@ -307,7 +307,7 @@ class AddGear(bpy.types.Operator):
crown=self.properties.crown)
#print(len(verts_loc)/3,faces)
mesh = bpy.data.meshes.new("Gear")
mesh.add_geometry(int(len(verts_loc) / 3), 0, int(len(faces) / 4))
@@ -321,22 +321,21 @@ class AddGear(bpy.types.Operator):
ob.selected = False
mesh.update()
ob_new = bpy.data.objects.new('Gear','MESH')
ob_new.data = mesh
ob_new = bpy.data.objects.new('Gear', mesh)
tipgroup = ob_new.add_vertex_group('Tips')
# for some reason the name does not 'stick' and we have to set it this way:
tipgroup.name = 'Tips'
for i in tip_vertices:
ob_new.add_vertex_to_group(i, tipgroup, 1.0, 'ADD')
valleygroup = ob_new.add_vertex_group('Valleys')
# for some reason the name does not 'stick' and we have to set it this way:
valleygroup.name = 'Valleys'
for i in valley_vertices:
ob_new.add_vertex_to_group(i, valleygroup, 1.0, 'ADD')
scene.objects.link(ob_new)
scene.objects.active = ob_new
ob_new.selected = True
@@ -349,7 +348,7 @@ class AddGear(bpy.types.Operator):
# unfortunately the next line wont get us back to object mode but bombs
#bpy.ops.object.mode_set('OBJECT')
#print(4,bpy.context.mode)
ob_new.location = tuple(context.scene.cursor_location)
return {'FINISHED'}

View File

@@ -0,0 +1,51 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# blender 1 line description
"Raw Mesh IO (File > Import/Export > Raw Faces (.raw))"
import bpy
def menu_import(self, context):
from io_mesh_raw import import_raw
self.layout.operator(import_raw.RawImporter.bl_idname, text="Raw Faces (.raw)").path = "*.raw"
def menu_export(self, context):
from io_mesh_raw import export_raw
default_path = bpy.data.filename.replace(".blend", ".raw")
self.layout.operator(export_raw.RawExporter.bl_idname, text="Raw Faces (.raw)").path = default_path
def register():
from io_mesh_raw import import_raw, export_raw
bpy.types.register(import_raw.RawImporter)
bpy.types.register(export_raw.RawExporter)
bpy.types.INFO_MT_file_import.append(menu_import)
bpy.types.INFO_MT_file_export.append(menu_export)
def unregister():
from io_mesh_raw import import_raw, export_raw
bpy.types.unregister(import_raw.RawImporter)
bpy.types.unregister(export_raw.RawExporter)
bpy.types.INFO_MT_file_import.remove(menu_import)
bpy.types.INFO_MT_file_export.remove(menu_export)
if __name__ == "__main__":
register()

View File

@@ -0,0 +1,114 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
__author__ = ["Aurel Wildfellner"]
__version__ = '0.2'
__bpydoc__ = """\
This script exports a Mesh to a RAW triangle format file.
The raw triangle format is very simple; it has no verts or faces lists.
It's just a simple ascii text file with the vertices of each triangle
listed on each line. In addition, also quads can be exported as a line
of 12 values (this was the default before blender 2.5). Now default
settings will triangulate the mesh.
Usage:<br>
Execute this script from the "File->Export" menu. You can select
whether modifiers should be applied and if the mesh is triangulated.
"""
import bpy
def faceToTriangles(face):
triangles = []
if (len(face) == 4): #quad
triangles.append( [ face[0], face[1], face[2] ] )
triangles.append( [ face[2], face[3], face[0] ] )
else:
triangles.append(face)
return triangles
def faceValues(face, mesh, matrix):
fv = []
for verti in face.verts_raw:
fv.append(matrix * mesh.verts[verti].co)
return fv
def faceToLine(face):
line = ""
for v in face:
line += str(v[0]) + " " + str(v[1]) + " " + str(v[2]) + " "
return line[:-1] + "\n"
def export_raw(path, applyMods, triangulate):
faces = []
for obj in bpy.context.selected_objects:
if obj.type == 'MESH':
matrix = obj.matrix
if (applyMods):
me = obj.create_mesh(True, "PREVIEW")
else:
me = obj.data
for face in me.faces:
fv = faceValues(face, me, matrix)
if triangulate:
faces.extend(faceToTriangles(fv))
else:
faces.append(fv)
# write the faces to a file
file = open(path, "w")
for face in faces:
file.write(faceToLine(face))
file.close()
from bpy.props import *
class RawExporter(bpy.types.Operator):
'''Save Raw triangle mesh data'''
bl_idname = "export_mesh.raw"
bl_label = "Export RAW"
path = StringProperty(name="File Path", description="File path used for exporting the RAW file", maxlen= 1024, default= "")
filename = StringProperty(name="File Name", description="Name of the file.")
directory = StringProperty(name="Directory", description="Directory of the file.")
check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
apply_modifiers = BoolProperty(name="Apply Modifiers", description="Use transformed mesh data from each object", default=True)
triangulate = BoolProperty(name="Triangulate", description="Triangulate quads.", default=True)
def execute(self, context):
export_raw(self.properties.path, self.properties.apply_modifiers, self.properties.triangulate)
return {'FINISHED'}
def invoke(self, context, event):
wm = context.manager
wm.add_fileselect(self)
return {'RUNNING_MODAL'}
# package manages registering

View File

@@ -0,0 +1,142 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
__author__ = ["Anthony D'Agostino (Scorpius)", "Aurel Wildfellner"]
__version__ = '0.2'
__bpydoc__ = """\
This script imports Raw Triangle File format files to Blender.
The raw triangle format is very simple; it has no verts or faces lists.
It's just a simple ascii text file with the vertices of each triangle
listed on each line. In addition, a line with 12 values will be
imported as a quad. This may be in conflict with some other
applications, which use a raw format, but this is how it was
implemented back in blender 2.42.
Usage:<br>
Execute this script from the "File->Import" menu and choose a Raw file to
open.
Notes:<br>
Generates the standard verts and faces lists, but without duplicate
verts. Only *exact* duplicates are removed, there is no way to specify a
tolerance.
"""
import bpy
# move those to a utility modul
from import_scene_obj import unpack_face_list, unpack_list # TODO, make generic
def readMesh(filename, objName):
file = open(filename, "rb")
def line_to_face(line):
# Each triplet is an xyz float
line_split = []
try:
line_split = list(map(float, line.split()))
except:
return None
if len(line_split) == 9: # Tri
f1, f2, f3, f4, f5, f6, f7, f8, f9 = line_split
return [(f1, f2, f3), (f4, f5, f6), (f7, f8, f9)]
elif len(line_split) == 12: # Quad
f1, f2, f3, f4, f5, f6, f7, f8, f9, A, B, C = line_split
return [(f1, f2, f3), (f4, f5, f6), (f7, f8, f9), (A, B, C)]
else:
return None
faces = []
for line in file.readlines():
face = line_to_face(line)
if face:
faces.append(face)
file.close()
# Generate verts and faces lists, without duplicates
verts = []
coords = {}
index = 0
for f in faces:
for i, v in enumerate(f):
try:
f[i] = coords[v]
except:
f[i] = coords[v] = index
index += 1
verts.append(v)
mesh = bpy.data.meshes.new(objName)
mesh.add_geometry(int(len(verts)), 0, int(len(faces)))
mesh.verts.foreach_set("co", unpack_list(verts))
mesh.faces.foreach_set("verts_raw", unpack_face_list(faces))
mesh.faces.foreach_set("smooth", [False] * len(mesh.faces))
return mesh
def addMeshObj(mesh, objName):
scn = bpy.context.scene
for o in scn.objects:
o.selected = False
mesh.update()
nobj = bpy.data.objects.new(objName, mesh)
scn.objects.link(nobj)
nobj.selected = True
if scn.objects.active == None or scn.objects.active.mode == 'OBJECT':
scn.objects.active = nobj
from bpy.props import *
class RawImporter(bpy.types.Operator):
'''Load Raw triangle mesh data'''
bl_idname = "import_mesh.raw"
bl_label = "Import RAW"
path = StringProperty(name="File Path", description="File path used for importing the RAW file", maxlen=1024, default="")
filename = StringProperty(name="File Name", description="Name of the file.")
directory = StringProperty(name="Directory", description="Directory of the file.")
def execute(self, context):
#convert the filename to an object name
objName = bpy.utils.display_name(self.properties.filename)
mesh = readMesh(self.properties.path, objName)
addMeshObj(mesh, objName)
return {'FINISHED'}
def invoke(self, context, event):
wm = context.manager
wm.add_fileselect(self)
return {'RUNNING_MODAL'}
# package manages registering

View File

@@ -41,7 +41,7 @@ def write_pov(filename, scene=None, info_callback=None):
if not scene:
scene = bpy.data.scenes[0]
render = scene.render_data
render = scene.render
world = scene.world
def uniqueName(name, nameSeq):
@@ -602,7 +602,7 @@ def write_pov(filename, scene=None, info_callback=None):
def write_pov_ini(filename_ini, filename_pov, filename_image):
scene = bpy.data.scenes[0]
render = scene.render_data
render = scene.render
x = int(render.resolution_x * render.resolution_percentage * 0.01)
y = int(render.resolution_y * render.resolution_percentage * 0.01)
@@ -785,7 +785,7 @@ class PovrayRender(bpy.types.RenderEngine):
self.update_stats("", "POVRAY: Parsing File")
self._render()
r = scene.render_data
r = scene.render
# compute resolution
x = int(r.resolution_x * r.resolution_percentage * 0.01)
@@ -889,7 +889,7 @@ class RenderButtonsPanel(bpy.types.Panel):
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
def poll(self, context):
rd = context.scene.render_data
rd = context.scene.render
return (rd.use_game_engine == False) and (rd.engine in self.COMPAT_ENGINES)
@@ -906,7 +906,7 @@ class RENDER_PT_povray_radiosity(RenderButtonsPanel):
layout = self.layout
scene = context.scene
rd = scene.render_data
rd = scene.render
layout.active = scene.pov_radio_enable

View File

@@ -412,13 +412,13 @@ def write(filename, batch_objects = None, \
# XXX don't know what to do with this, probably do the same? (Arystan)
if BATCH_GROUP: #group
# group, so objects update properly, add a dummy scene.
sce = bpy.data.scenes.new()
sce.Layers = (1<<20) -1
bpy.data.scenes.active = sce
scene = bpy.data.scenes.new()
scene.Layers = (1<<20) -1
bpy.data.scenes.active = scene
for ob_base in data.objects:
sce.objects.link(ob_base)
scene.objects.link(ob_base)
sce.update(1)
scene.update(1)
# TODO - BUMMER! Armatures not in the group wont animate the mesh
@@ -450,8 +450,8 @@ def write(filename, batch_objects = None, \
if BATCH_GROUP:
# remove temp group scene
bpy.data.remove_scene(sce)
# bpy.data.scenes.unlink(sce)
bpy.data.remove_scene(scene)
# bpy.data.scenes.unlink(scene)
bpy.data.scenes.active = orig_sce
@@ -618,9 +618,9 @@ def write(filename, batch_objects = None, \
except:
return False
sce = context.scene
# sce = bpy.data.scenes.active
world = sce.world
scene = context.scene
# scene = bpy.data.scenes.active
world = scene.world
# ---------------------------- Write the header first
@@ -983,10 +983,10 @@ def write(filename, batch_objects = None, \
'''
Write a blender camera
'''
render = sce.render_data
render = scene.render
width = render.resolution_x
height = render.resolution_y
# render = sce.render
# render = scene.render
# width = render.sizeX
# height = render.sizeY
aspect = float(width)/height
@@ -1293,16 +1293,18 @@ def write(filename, batch_objects = None, \
file.write('\n\t}')
def copy_image(image):
rel = image.get_export_path(basepath, True)
base = os.path.basename(rel)
fn = bpy.utils.expandpath(image.filename)
fn_strip = os.path.basename(fn)
if EXP_IMAGE_COPY:
absp = image.get_export_path(basepath, False)
if not os.path.exists(absp):
shutil.copy(image.get_abs_filename(), absp)
rel = fn_strip
fn_abs_dest = os.path.join(basepath, fn_strip)
if not os.path.exists(fn_abs_dest):
shutil.copy(fn, fn_abs_dest)
else:
rel = os.path.relpath(fn, basepath)
return (rel, base)
return (rel, fn_strip)
# tex is an Image (Arystan)
def write_video(texname, tex):
@@ -2016,8 +2018,8 @@ def write(filename, batch_objects = None, \
# if EXP_OBS_SELECTED is false, use sceens objects
if not batch_objects:
if EXP_OBS_SELECTED: tmp_objects = context.selected_objects
# if EXP_OBS_SELECTED: tmp_objects = sce.objects.context
else: tmp_objects = sce.objects
# if EXP_OBS_SELECTED: tmp_objects = scene.objects.context
else: tmp_objects = scene.objects
else:
tmp_objects = batch_objects
@@ -2039,7 +2041,7 @@ def write(filename, batch_objects = None, \
# ob_base.makeDisplayList()
# This causes the makeDisplayList command to effect the mesh
sce.set_frame(sce.current_frame)
scene.set_frame(scene.current_frame)
# Blender.Set('curframe', Blender.Get('curframe'))
@@ -2214,7 +2216,7 @@ def write(filename, batch_objects = None, \
ob_base.make_display_list()
# ob_base.makeDisplayList()
# This causes the makeDisplayList command to effect the mesh
sce.set_frame(sce.current_frame)
scene.set_frame(scene.current_frame)
# Blender.Set('curframe', Blender.Get('curframe'))
del tmp_ob_type, tmp_objects
@@ -2689,8 +2691,8 @@ Connections: {''')
# Needed for scene footer as well as animation
render = sce.render_data
# render = sce.render
render = scene.render
# render = scene.render
# from the FBX sdk
#define KTIME_ONE_SECOND KTime (K_LONGLONG(46186158000))
@@ -2699,9 +2701,9 @@ Connections: {''')
return int(0.5 + ((t/fps) * 46186158000))
fps = float(render.fps)
start = sce.start_frame
start = scene.start_frame
# start = render.sFrame
end = sce.end_frame
end = scene.end_frame
# end = render.eFrame
if end < start: start, end = end, start
if start==end: ANIM_ENABLE = False
@@ -2711,7 +2713,7 @@ Connections: {''')
if ANIM_ENABLE and [tmp for tmp in ob_anim_lists if tmp]:
frame_orig = sce.current_frame
frame_orig = scene.current_frame
# frame_orig = Blender.Get('curframe')
if ANIM_OPTIMIZE:
@@ -2812,7 +2814,7 @@ Takes: {''')
if blenAction in my_bone.blenActionList:
ob.action = blenAction
# print '\t\tSetting Action!', blenAction
# sce.update(1)
# scene.update(1)
file.write('\n\t\tFileName: "Default_Take.tak"') # ??? - not sure why this is needed
file.write('\n\t\tLocalTime: %i,%i' % (fbx_time(act_start-1), fbx_time(act_end-1))) # ??? - not sure why this is needed
@@ -2832,7 +2834,7 @@ Takes: {''')
'''
i = act_start
while i <= act_end:
sce.set_frame(i)
scene.set_frame(i)
# Blender.Set('curframe', i)
for ob_generic in ob_anim_lists:
for my_ob in ob_generic:
@@ -2971,7 +2973,7 @@ Takes: {''')
file.write('\n}')
sce.set_frame(frame_orig)
scene.set_frame(frame_orig)
# Blender.Set('curframe', frame_orig)
else:
@@ -3463,6 +3465,7 @@ class ExportFBX(bpy.types.Operator):
# SMALL or COSMETICAL
# - find a way to get blender version, and put it in bpy.util?, old was Blender.Get('version')
def menu_func(self, context):
default_path = bpy.data.filename.replace(".blend", ".fbx")
self.layout.operator(ExportFBX.bl_idname, text="Autodesk FBX (.fbx)").path = default_path
@@ -3471,11 +3474,11 @@ def menu_func(self, context):
def register():
bpy.types.register(ExportFBX)
bpy.types.INFO_MT_file_export.append(menu_func)
def unregister():
bpy.types.unregister(ExportFBX)
bpy.types.INFO_MT_file_export.remove(menu_func)
if __name__ == "__main__":
register()

View File

@@ -190,7 +190,7 @@ def menu_func(self, context):
def register():
bpy.types.register(ExportMDD)
bpy.types.INFO_MT_file_export.append(menu_func)
def unregister():
bpy.types.unregister(ExportMDD)
bpy.types.INFO_MT_file_export.remove(menu_func)

View File

@@ -44,6 +44,7 @@ will be exported as mesh data.
# import math
import os
import time
import shutil
import bpy
import Mathutils
@@ -76,12 +77,15 @@ def write_mtl(scene, filename, copy_images):
dest_dir = os.path.dirname(filename)
def copy_image(image):
rel = image.get_export_path(dest_dir, True)
fn = bpy.utils.expandpath(image.filename)
fn_strip = os.path.basename(fn)
if copy_images:
abspath = image.get_export_path(dest_dir, False)
if not os.path.exists(abs_path):
shutil.copy(image.get_abs_filename(), abs_path)
rel = fn_strip
fn_abs_dest = os.path.join(dest_dir, fn_strip)
if not os.path.exists(fn_abs_dest):
shutil.copy(fn, fn_abs_dest)
else:
rel = fn
return rel
@@ -447,8 +451,7 @@ def write(filename, objects, scene,
break
if has_quads:
newob = bpy.data.objects.new('temp_object', 'MESH')
newob.data = me
newob = bpy.data.objects.new('temp_object', me)
# if we forget to set Object.data - crash
scene.objects.link(newob)
newob.convert_to_triface(scene)
@@ -967,7 +970,7 @@ def menu_func(self, context):
def register():
bpy.types.register(ExportOBJ)
bpy.types.INFO_MT_file_export.append(menu_func)
def unregister():
bpy.types.unregister(ExportOBJ)
bpy.types.INFO_MT_file_export.remove(menu_func)

View File

@@ -321,11 +321,11 @@ def menu_func(self, context):
def register():
bpy.types.register(ExportPLY)
bpy.types.INFO_MT_file_export.append(menu_func)
def unregister():
bpy.types.unregister(ExportPLY)
bpy.types.INFO_MT_file_export.remove(menu_func)
if __name__ == "__main__":
register()

View File

@@ -228,7 +228,7 @@ class x3d_class:
'''
def writeViewpoint(self, ob, mat, scene):
context = scene.render_data
context = scene.render
# context = scene.render
ratio = float(context.resolution_x)/float(context.resolution_y)
# ratio = float(context.imageSizeY())/float(context.imageSizeX())
@@ -794,7 +794,7 @@ class x3d_class:
pic = tex.image
# using .expandpath just in case, os.path may not expect //
basename = os.path.basename(pic.get_abs_filename())
basename = os.path.basename(bpy.utils.expandpath(pic.filename))
pic = alltextures[i].image
# pic = alltextures[i].getImage()
@@ -1251,7 +1251,7 @@ def menu_func(self, context):
def register():
bpy.types.register(ExportX3D)
bpy.types.INFO_MT_file_export.append(menu_func)
def unregister():
bpy.types.unregister(ExportX3D)
bpy.types.INFO_MT_file_export.remove(menu_func)

View File

@@ -295,7 +295,7 @@ def bvh_node_dict2objects(context, bvh_nodes, IMPORT_START_FRAME=1, IMPORT_LOOP=
objects = []
def add_ob(name):
ob = scn.objects.new('Empty')
ob = scn.objects.new('Empty', None)
objects.append(ob)
return ob
@@ -352,8 +352,7 @@ def bvh_node_dict2armature(context, bvh_nodes, ROT_MODE='XYZ', IMPORT_START_FRAM
scn.set_frame(IMPORT_START_FRAME)
arm_data = bpy.data.armatures.new("MyBVH")
arm_ob = bpy.data.objects.new("MyBVH", 'ARMATURE')
arm_ob.data = arm_data
arm_ob = bpy.data.objects.new("MyBVH", arm_data)
scn.objects.link(arm_ob)

View File

@@ -293,12 +293,12 @@ def skip_to_end(file, skip_chunk):
def add_texture_to_material(image, texture, material, mapto):
#print('assigning %s to %s' % (texture, material))
if mapto not in ("COLOR", "SPECULARITY", "ALPHA", "NORMAL"):
print('/tError: Cannot map to "%s"\n\tassuming diffuse color. modify material "%s" later.' % (mapto, material.name))
mapto = "COLOR"
if image:
if image:
texture.image = image
# if image: texture.setImage(image) # double check its an image.
@@ -413,13 +413,12 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
# targetFace.uv = [contextMeshUV[vindex] for vindex in myContextMesh_facels[i]]
if img:
uf.image = img
# to get this image to show up in 'Textured' shading mode
uf.tex = True
uf.tex = True
# bmesh.transform(contextMatrix)
ob = bpy.data.objects.new(tempName, 'MESH')
ob.data = bmesh
ob = bpy.data.objects.new(tempName, bmesh)
SCN.objects.link(ob)
# ob = SCN_OBJECTS.new(bmesh, tempName)
'''
@@ -638,8 +637,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
x,y,z = struct.unpack('<3f', temp_data)
new_chunk.bytes_read += STRUCT_SIZE_3FLOAT
ob = bpy.data.objects.new("Lamp", 'LAMP')
ob.data = bpy.data.lamps.new("Lamp")
ob = bpy.data.objects.new("Lamp", bpy.data.lamps.new("Lamp"))
SCN.objects.link(ob)
contextLamp[1]= ob.data
@@ -1017,7 +1015,7 @@ class IMPORT_OT_autodesk_3ds(bpy.types.Operator):
path = StringProperty(name="File Path", description="File path used for importing the 3DS file", maxlen= 1024, default= "")
filename = StringProperty(name="File Name", description="Name of the file.")
directory = StringProperty(name="Directory", description="Directory of the file.")
# size_constraint = FloatProperty(name="Size Constraint", description="Scale the model by 10 until it reacehs the size constraint. Zero Disables.", min=0.0, max=1000.0, soft_min=0.0, soft_max=1000.0, default=10.0),
# search_images = BoolProperty(name="Image Search", description="Search subdirectories for any assosiated images (Warning, may be slow)", default=True),
# apply_matrix = BoolProperty(name="Transform Fix", description="Workaround for object transformations importing incorrectly", default=False),
@@ -1038,7 +1036,7 @@ menu_func = lambda self, context: self.layout.operator(IMPORT_OT_autodesk_3ds.bl
def register():
bpy.types.register(IMPORT_OT_autodesk_3ds)
bpy.types.INFO_MT_file_import.append(menu_func)
def unregister():
bpy.types.unregister(IMPORT_OT_autodesk_3ds)
bpy.types.INFO_MT_file_import.remove(menu_func)

View File

@@ -863,10 +863,8 @@ def create_mesh(scn, new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_l
me.update()
# me.calcNormals()
ob= bpy.data.objects.new("Mesh", 'MESH')
ob.data= me
ob= bpy.data.objects.new("Mesh", me)
scn.objects.link(ob)
# ob= scn.objects.new(me)
new_objects.append(ob)
# Create the vertex groups. No need to have the flag passed here since we test for the
@@ -1629,7 +1627,7 @@ menu_func = lambda self, context: self.layout.operator(IMPORT_OT_obj.bl_idname,
def register():
bpy.types.register(IMPORT_OT_obj)
bpy.types.INFO_MT_file_import.append(menu_func)
def unregister():
bpy.types.unregister(IMPORT_OT_obj)
bpy.types.INFO_MT_file_import.remove(menu_func)

View File

@@ -0,0 +1,157 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ***** END GPL LICENCE BLOCK *****
# <pep8 compliant>
# mdd importer by Bill L.Nieuwendorp
# conversion to blender 2.5: Ivo Grigull (loolarge)
#
# Warning if the vertex order or vertex count differs from the
# origonal model the mdd was Baked out from their will be Strange
# behavior
#
# vertex animation to ShapeKeys with ipo and gives the frame a value of 1.0
# A modifier to read mdd files would be Ideal but thats for another day :)
#
# Please send any fixes,updates,bugs to Slow67_at_Gmail.com
# Bill Niewuendorp
import bpy
from struct import unpack
def mdd_import(filepath, ob, scene, PREF_START_FRAME=0, PREF_JUMP=1):
print('\n\nimporting mdd "%s"' % filepath)
bpy.ops.object.mode_set(mode='OBJECT')
file = open(filepath, 'rb')
frames, points = unpack(">2i", file.read(8))
time = unpack((">%df" % frames), file.read(frames * 4))
print('\tpoints:%d frames:%d' % (points,frames))
# If target object doesn't have Basis shape key, create it.
try:
num_keys = len( ob.data.shape_keys.keys )
except:
basis = ob.add_shape_key()
basis.name = "Basis"
ob.data.update()
scene.current_frame = PREF_START_FRAME
def UpdateMesh(ob, fr):
# Insert new shape key
new_shapekey = ob.add_shape_key()
new_shapekey.name = ("frame_%.4d" % fr)
new_shapekey_name = new_shapekey.name
ob.active_shape_key_index = len(ob.data.shape_keys.keys)-1
index = len(ob.data.shape_keys.keys)-1
ob.shape_key_lock = True
verts = ob.data.shape_keys.keys[ len(ob.data.shape_keys.keys)-1 ].data
for v in verts:
# 12 is the size of 3 floats
x,y,z= unpack('>3f', file.read(12))
v.co[:] = x,z,y
#me.update()
ob.shape_key_lock = False
# insert keyframes
shape_keys = ob.data.shape_keys
scene.current_frame -= 1
ob.data.shape_keys.keys[index].value = 0.0
shape_keys.keys[len(ob.data.shape_keys.keys)-1].keyframe_insert("value")
scene.current_frame += 1
ob.data.shape_keys.keys[index].value = 1.0
shape_keys.keys[len(ob.data.shape_keys.keys)-1].keyframe_insert("value")
scene.current_frame += 1
ob.data.shape_keys.keys[index].value = 0.0
shape_keys.keys[len(ob.data.shape_keys.keys)-1].keyframe_insert("value")
ob.data.update()
for i in range(frames):
UpdateMesh(ob, i)
from bpy.props import *
class importMDD(bpy.types.Operator):
'''Import MDD vertex keyframe file to shape keys'''
bl_idname = "import.mdd"
bl_label = "Import MDD"
# get first scene to get min and max properties for frames, fps
minframe = 1
maxframe = 300000
minfps = 1
maxfps = 120
# List of operator properties, the attributes will be assigned
# to the class instance from the operator settings before calling.
path = StringProperty(name="File Path", description="File path used for importing the MDD file", maxlen=1024)
#fps = IntProperty(name="Frames Per Second", description="Number of frames/second", min=minfps, max=maxfps, default=25)
start_frame = IntProperty(name="Start Frame", description="Start frame for inserting animation", min=minframe, max=maxframe, default=0)
def poll(self, context):
ob = context.active_object
return (ob and ob.type == 'MESH')
def execute(self, context):
if not self.properties.path:
raise Exception("filename not set")
mdd_import( self.properties.path, bpy.context.active_object, context.scene, self.properties.start_frame, 1)
return {'FINISHED'}
def invoke(self, context, event):
wm = context.manager
wm.add_fileselect(self)
return {'RUNNING_MODAL'}
def menu_func(self, context):
self.layout.operator(importMDD.bl_idname, text="Lightwave Point Cache (.mdd)")
def register():
bpy.types.register(importMDD)
bpy.types.INFO_MT_file_import.append(menu_func)
def unregister():
bpy.types.unregister(importMDD)
bpy.types.INFO_MT_file_import.remove(menu_func)
if __name__ == "__main__":
register()

View File

@@ -44,4 +44,4 @@ def unregister():
bpy.types.unregister(ui.NetRenderJob)
bpy.types.unregister(ui.NetRenderSettings)
bpy.types.unregister(ui.NetRenderSlave)

View File

@@ -113,14 +113,18 @@ def clientSendJob(conn, scene, anim = False):
# LIBRARIES
###########################
for lib in bpy.data.libraries:
job.addFile(bpy.utils.expandpath(lib.filename))
file_path = bpy.utils.expandpath(lib.filename)
if os.path.exists(file_path):
job.addFile(file_path)
###########################
# IMAGES
###########################
for image in bpy.data.images:
if image.source == "FILE" and not image.packed_file:
job.addFile(bpy.utils.expandpath(image.filename))
file_path = bpy.utils.expandpath(image.filename)
if os.path.exists(file_path):
job.addFile(file_path)
###########################
# FLUID + POINT CACHE
@@ -201,7 +205,7 @@ class NetworkRenderEngine(bpy.types.RenderEngine):
def render_slave(self, scene):
slave.render_slave(self, scene.network_render, scene.render_data.threads)
slave.render_slave(self, scene.network_render, scene.render.threads)
def render_client(self, scene):
netsettings = scene.network_render
@@ -250,7 +254,7 @@ class NetworkRenderEngine(bpy.types.RenderEngine):
conn.close()
return
r = scene.render_data
r = scene.render
x= int(r.resolution_x*r.resolution_percentage*0.01)
y= int(r.resolution_y*r.resolution_percentage*0.01)

View File

@@ -17,7 +17,7 @@
# ##### END GPL LICENSE BLOCK #####
import sys, os
import http, http.client, http.server, urllib, socket
import http, http.client, http.server, urllib, socket, socketserver, threading
import subprocess, shutil, time, hashlib
import select # for select.error
@@ -80,7 +80,7 @@ class MRenderJob(netrender.model.RenderJob):
def initInfo(self):
if not self.resolution:
self.resolution = tuple(getFileInfo(self.files[0].filepath, ["bpy.context.scene.render_data.resolution_x", "bpy.context.scene.render_data.resolution_y", "bpy.context.scene.render_data.resolution_percentage"]))
self.resolution = tuple(getFileInfo(self.files[0].filepath, ["bpy.context.scene.render.resolution_x", "bpy.context.scene.render.resolution_y", "bpy.context.scene.render.resolution_percentage"]))
def save(self):
if self.save_path:
@@ -860,7 +860,7 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
else: # invalid url
self.send_head(http.client.NO_CONTENT)
class RenderMasterServer(http.server.HTTPServer):
class RenderMasterServer(socketserver.ThreadingMixIn, http.server.HTTPServer):
def __init__(self, address, handler_class, path):
super().__init__(address, handler_class)
self.jobs = []

View File

@@ -372,7 +372,7 @@ class netclientdownload(bpy.types.Operator):
def execute(self, context):
netsettings = context.scene.network_render
rd = context.scene.render_data
rd = context.scene.render
conn = clientConnection(netsettings.server_address, netsettings.server_port, self.report)

View File

@@ -83,7 +83,7 @@ class RenderButtonsPanel(bpy.types.Panel):
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
def poll(self, context):
rd = context.scene.render_data
rd = context.scene.render
return (rd.use_game_engine==False) and (rd.engine in self.COMPAT_ENGINES)
# Setting panel, use in the scene for now.
@@ -136,7 +136,7 @@ class RENDER_PT_network_slave_settings(RenderButtonsPanel):
layout = self.layout
scene = context.scene
rd = scene.render_data
rd = scene.render
netsettings = scene.network_render
layout.prop(netsettings, "slave_clear")

View File

@@ -197,12 +197,12 @@ def thumbnail(filename):
return thumbname
if bpy:
sce = bpy.data.scenes[0]
sce.render_data.file_format = "JPEG"
sce.render_data.quality = 90
scene = bpy.data.scenes[0] # FIXME, this is dodgy!
scene.render.file_format = "JPEG"
scene.render.quality = 90
bpy.ops.image.open(path = filename)
img = bpy.data.images[imagename]
img.save(thumbname, scene = sce)
img.save_render(thumbname, scene=scene)
try:
process = subprocess.Popen(["convert", thumbname, "-resize", "300x300", thumbname])

View File

@@ -27,6 +27,7 @@ op_call = ops_module.call
op_as_string = ops_module.as_string
op_get_rna = ops_module.get_rna
class bpy_ops(object):
'''
Fake module like class.

View File

@@ -48,10 +48,11 @@ def _test_import(module_name, loaded_modules):
if _bpy.app.debug:
print("time %s %.4f" % (module_name, time.time() - t))
loaded_modules.add(mod.__name__) # should match mod.__name__ too
return mod
def modules_from_path(path, loaded_modules):
"""
Load all modules in a path and return them as a list.
@@ -65,9 +66,9 @@ def modules_from_path(path, loaded_modules):
"""
import traceback
import time
modules = []
for f in sorted(_os.listdir(path)):
if f.endswith(".py"):
# python module
@@ -77,10 +78,10 @@ def modules_from_path(path, loaded_modules):
mod = _test_import(f, loaded_modules)
else:
mod = None
if mod:
modules.append(mod)
return modules
_loaded = [] # store loaded modules for reloading.
@@ -90,7 +91,7 @@ _bpy_types = __import__("bpy_types") # keep for comparisons, never ever reload t
def load_scripts(reload_scripts=False, refresh_scripts=False):
"""
Load scripts and run each modules register function.
:arg reload_scripts: Causes all scripts to have their unregister method called before loading.
:type reload_scripts: bool
:arg refresh_scripts: only load scripts which are not already loaded as modules.
@@ -102,7 +103,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
t_main = time.time()
loaded_modules = set()
if refresh_scripts:
original_modules = _sys.modules.values()
@@ -121,7 +122,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
return reload(mod)
except:
traceback.print_exc()
def test_register(mod):
if refresh_scripts and mod in original_modules:
@@ -141,7 +142,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
else:
print("\nWarning! '%s' has no register function, this is now a requirement for registerable scripts." % mod.__file__)
_loaded.append(mod)
if reload_scripts:
# reload modules that may not be directly included
for type_class_name in dir(_bpy.types):
@@ -155,7 +156,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
for module_name in sorted(loaded_modules):
print("Reloading:", module_name)
test_reload(_sys.modules[module_name])
# loop over and unload all scripts
_loaded.reverse()
for mod in _loaded:
@@ -167,7 +168,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
traceback.print_exc()
_loaded[:] = []
for base_path in script_paths(user = False):
for base_path in script_paths(user=False):
for path_subdir in ("ui", "op", "io", "cfg"):
path = _os.path.join(base_path, path_subdir)
if _os.path.isdir(path):
@@ -182,20 +183,20 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
path = _os.path.join(user_path, path_subdir)
if _os.path.isdir(path):
sys_path_ensure(path)
for mod in modules_from_path(path, loaded_modules):
test_register(mod)
# load extensions
used_ext = {ext.module for ext in _bpy.context.user_preferences.extensions}
paths = script_paths("extensions")
# load addons
used_ext = {ext.module for ext in _bpy.context.user_preferences.addons}
paths = script_paths("addons")
for path in paths:
sys_path_ensure(path)
for module_name in sorted(used_ext):
mod = _test_import(module_name, loaded_modules)
test_register(mod)
if reload_scripts:
import gc
print("gc.collect() -> %d" % gc.collect())
@@ -262,16 +263,18 @@ def display_name(name):
_scripts = _os.path.join(_os.path.dirname(__file__), _os.path.pardir, _os.path.pardir)
_scripts = (_os.path.normpath(_scripts), )
def user_script_path():
path = _bpy.context.user_preferences.filepaths.python_scripts_directory
if path:
path = _os.path.normpath(path)
return path
else:
return None
def script_paths(subdir = None, user = True):
def script_paths(subdir=None, user=True):
"""
Returns a list of valid script paths from the home directory and user preferences.
@@ -284,7 +287,7 @@ def script_paths(subdir = None, user = True):
user_script_path = _bpy.context.user_preferences.filepaths.python_scripts_directory
else:
user_script_path = None
for path in home_paths("scripts") + (user_script_path, ):
if path:
path = _os.path.normpath(path)

View File

@@ -182,8 +182,7 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
try:
obj = scene.objects[name]
except KeyError:
obj = bpy.data.objects.new(name, type='ARMATURE')
obj.data = bpy.data.armatures.new(name)
obj = bpy.data.objects.new(name, bpy.data.armatures.new(name))
scene.objects.link(obj)
obj.data.pose_position = 'POSE'
@@ -487,9 +486,8 @@ def generate_test(context, metarig_type="", GENERATE_FINAL=True):
scene = context.scene
def create_empty_armature(name):
obj_new = bpy.data.objects.new(name, 'ARMATURE')
armature = bpy.data.armatures.new(name)
obj_new.data = armature
obj_new = bpy.data.objects.new(name, armature)
scene.objects.link(obj_new)
scene.objects.active = obj_new
for obj in scene.objects:

View File

@@ -130,6 +130,9 @@ def ik(obj, bone_definition, base_names, options):
# keep the foot_ik as the parent
ik_chain.toe_e.connected = False
# Foot uses pose space, not local space, for translation
ik_chain.foot_e.local_location = False
# must be after disconnecting the toe
ik_chain.foot_e.align_orientation(mt_chain.toe_e)
@@ -259,6 +262,8 @@ def ik(obj, bone_definition, base_names, options):
con = ik.foot_roll_01_p.constraints.new('COPY_ROTATION')
con.target = obj
con.subtarget = ik.foot_roll
con.target_space = 'LOCAL'
con.owner_space = 'LOCAL'
# IK

View File

@@ -197,23 +197,23 @@ def deform(obj, definitions, base_names, options):
con = pb[lip4].constraints.new('COPY_TRANSFORMS')
con.target = obj
con.subtarget = definitions[5]
con = pb[lip5].constraints.new('COPY_TRANSFORMS')
con.target = obj
con.subtarget = definitions[6]
con = pb[lip6].constraints.new('COPY_TRANSFORMS')
con.target = obj
con.subtarget = definitions[7]
con = pb[lip7].constraints.new('COPY_TRANSFORMS')
con.target = obj
con.subtarget = definitions[8]
con = pb[lip8].constraints.new('COPY_TRANSFORMS')
con.target = obj
con.subtarget = definitions[9]
# Constraint mouth corner spread bones
con = pb[spread_l_1].constraints.new('DAMPED_TRACK')
con.target = obj
@@ -234,12 +234,12 @@ def deform(obj, definitions, base_names, options):
con = pb[spread_r_2].constraints.new('COPY_TRANSFORMS')
con.target = obj
con.subtarget = spread_r_1
con = pb[spread_r_2].constraints.new('DAMPED_TRACK')
con.target = obj
con.subtarget = lip8
# Corrective shape keys for the corners of the mouth.
bpy.ops.object.mode_set(mode='EDIT')

View File

@@ -24,7 +24,7 @@ from rigify_utils import copy_bone_simple
from rna_prop_ui import rna_idprop_ui_prop_get
#METARIG_NAMES = ("cpy",)
RIG_TYPE = "shape_key_transforms"
RIG_TYPE = "shape_key_control"
def addget_shape_key(obj, name="Key"):
@@ -88,8 +88,11 @@ def metarig_definition(obj, orig_bone_name):
def main(obj, definitions, base_names, options):
""" A rig that drives shape keys with the local transforms of a single bone.
""" A rig that drives shape keys with the local transforms and/or custom
properties of a single bone.
A different shape can be driven by the negative value of a transform as
well by giving a comma-separated list of two shapes.
Required options:
mesh: name of mesh object(s) to add/get shapekeys to/from
(if multiple objects, make a comma-separated list)
@@ -100,14 +103,17 @@ def main(obj, definitions, base_names, options):
rot_<x/y/z>_fac: default multiplier of the bone influence on the shape key
scale_<x/y/z>: name of the shape key to tie to scale of the bone
scale_<x/y/z>_fac: default multiplier of the bone influence on the shape key
shape_key_sliders: comma-separated list of custom properties to create sliders out of for driving shape keys
<custom_prop>: for each property listed in shape_key_sliders, specify a shape key for it to drive
"""
bpy.ops.object.mode_set(mode='EDIT')
eb = obj.data.edit_bones
pb = obj.pose.bones
org_bone = definitions[0]
# Options
req_options = ["mesh"]
for option in req_options:
@@ -115,11 +121,11 @@ def main(obj, definitions, base_names, options):
raise RigifyError("'%s' rig type requires a '%s' option (bone: %s)" % (RIG_TYPE, option, base_names[definitions[0]]))
meshes = options["mesh"].replace(" ", "").split(",")
bone = copy_bone_simple(obj.data, org_bone, base_names[org_bone], parent=True).name
bpy.ops.object.mode_set(mode='OBJECT')
# Set rotation mode and axis locks
pb[bone].rotation_mode = pb[org_bone].rotation_mode
pb[bone].lock_location = tuple(pb[org_bone].lock_location)
@@ -127,10 +133,10 @@ def main(obj, definitions, base_names, options):
pb[bone].lock_rotation_w = pb[org_bone].lock_rotation_w
pb[bone].lock_rotations_4d = pb[org_bone].lock_rotations_4d
pb[bone].lock_scale = tuple(pb[org_bone].lock_scale)
# List of rig options for specifying shape keys
# Append '_fac' to the end for the name of the correspond 'factor default'
# option for that shape
# Append '_fac' to the end for the name of the corresponding 'factor
# default' option for that shape
shape_key_options = ["loc_x",
"loc_y",
"loc_z",
@@ -140,7 +146,7 @@ def main(obj, definitions, base_names, options):
"scale_x",
"scale_y",
"scale_z"]
driver_paths = {"loc_x":".location[0]",
"loc_y":".location[1]",
"loc_z":".location[2]",
@@ -153,76 +159,146 @@ def main(obj, definitions, base_names, options):
"scale_x":".scale[0]",
"scale_y":".scale[1]",
"scale_z":".scale[2]"}
# Create the shape keys and drivers
# Create the shape keys and drivers for transforms
shape_info = []
for option in shape_key_options:
if option in options:
shape_name = options[option]
var_name = bone + "_" + option
# Different paths for euler vs quat
if option in shape_key_options[3:6] and pb[bone].rotation_mode == 'QUATERNION':
shape_names = options[option].replace(" ", "").split(",")
var_name = bone.replace(".","").replace("-","_") + "_" + option
# Different RNA paths for euler vs quat
if option in (shape_key_options[3:6]+shape_key_options[12:15]) \
and pb[bone].rotation_mode == 'QUATERNION':
var_path = driver_paths['q' + option]
else:
var_path = driver_paths[option]
fac_name = option + "_factor"
if (option+"_fac") in options:
fac_default = options[option+"_fac"]
fac = options[option+"_fac"]
else:
fac_default = 1.0
# Different expressions for loc/rot/scale
if option in shape_key_options[:3]:
expression = var_name + " * " + fac_name
elif option in shape_key_options[:6]:
# Different expressions for euler vs quats
if pb[bone].rotation_mode == 'QUATERNION':
expression = "2 * asin(" + var_name + ") * " + fac_name
else:
expression = var_name + " * " + fac_name
else:
expression = "(1.0 - " + var_name + ") * " + fac_name + " * -2"
create_shape_and_driver(obj, bone, meshes, shape_name, var_name, var_path, fac_name, fac_default, expression)
fac = 1.0
# Positive
if shape_names[0] != "":
# Different expressions for loc/rot/scale and positive/negative
if option in shape_key_options[:3]:
# Location
expression = var_name + " * " + str(fac)
elif option in shape_key_options[3:6]:
# Rotation
# Different expressions for euler vs quats
if pb[bone].rotation_mode == 'QUATERNION':
expression = "2 * asin(" + var_name + ") * " + str(fac)
else:
expression = var_name + " * " + str(fac)
elif option in shape_key_options[6:9]:
# Scale
expression = "(1.0 - " + var_name + ") * " + str(fac) + " * -2"
shape_name = shape_names[0]
create_shape_and_driver(obj, bone, meshes, shape_name, var_name, var_path, expression)
# Negative
if shape_names[0] != "" and len(shape_names) > 1:
# Different expressions for loc/rot/scale and positive/negative
if option in shape_key_options[:3]:
# Location
expression = var_name + " * " + str(fac) + " * -1"
elif option in shape_key_options[3:6]:
# Rotation
# Different expressions for euler vs quats
if pb[bone].rotation_mode == 'QUATERNION':
expression = "-2 * asin(" + var_name + ") * " + str(fac)
else:
expression = var_name + " * " + str(fac) + " * -1"
elif option in shape_key_options[6:9]:
# Scale
expression = "(1.0 - " + var_name + ") * " + str(fac) + " * 2"
shape_name = shape_names[1]
create_shape_and_driver(obj, bone, meshes, shape_name, var_name, var_path, expression)
# Create the shape keys and drivers for custom-property sliders
if "shape_key_sliders" in options:
# Get the slider names
slider_names = options["shape_key_sliders"].replace(" ", "").split(",")
if slider_names[0] != "":
# Loop through the slider names and check if they have
# shape keys specified for them, and if so, set them up.
for slider_name in slider_names:
if slider_name in options:
shape_names = options[slider_name].replace(" ", "").split(",")
# Set up the custom property on the bone
prop = rna_idprop_ui_prop_get(pb[bone], slider_name, create=True)
pb[bone][slider_name] = 0.0
prop["min"] = 0.0
prop["max"] = 1.0
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
if len(shape_names) > 1:
prop["min"] = -1.0
prop["soft_min"] = -1.0
# Add the shape drivers
# Positive
if shape_names[0] != "":
# Set up the variables for creating the shape key driver
shape_name = shape_names[0]
var_name = slider_name.replace(".", "_").replace("-", "_")
var_path = '["' + slider_name + '"]'
if slider_name + "_fac" in options:
fac = options[slider_name + "_fac"]
else:
fac = 1.0
expression = var_name + " * " + str(fac)
# Create the shape key driver
create_shape_and_driver(obj, bone, meshes, shape_name, var_name, var_path, expression)
# Negative
if shape_names[0] != "" and len(shape_names) > 1:
# Set up the variables for creating the shape key driver
shape_name = shape_names[1]
var_name = slider_name.replace(".", "_").replace("-", "_")
var_path = '["' + slider_name + '"]'
if slider_name + "_fac" in options:
fac = options[slider_name + "_fac"]
else:
fac = 1.0
expression = var_name + " * " + str(fac) + " * -1"
# Create the shape key driver
create_shape_and_driver(obj, bone, meshes, shape_name, var_name, var_path, expression)
# Org bone copy transforms of control bone
con = pb[org_bone].constraints.new('COPY_TRANSFORMS')
con.target = obj
con.subtarget = bone
return (None,)
def create_shape_and_driver(obj, bone, meshes, shape_name, var_name, var_path, fac_name, fac_default, expression):
def create_shape_and_driver(obj, bone, meshes, shape_name, var_name, var_path, expression):
""" Creates/gets a shape key and sets up a driver for it.
obj = armature object
bone = driving bone name
meshes = list of meshes to create the shapekey/driver on
shape_name = name of the shape key
var_name = name of the driving variable
var_path = path to the property on the bone to drive with
fac_name = name of the "factor" custom property on the bone
fac_default = default starting value of the factor property
expression = python expression for the driver
"""
pb = obj.pose.bones
bpy.ops.object.mode_set(mode='OBJECT')
# Set up the "factor" custom property on the bone
prop = rna_idprop_ui_prop_get(pb[bone], fac_name, create=True)
pb[bone][fac_name] = fac_default
prop["min"] = -1000.0
prop["max"] = 1000.0
prop["soft_min"] = -1000.0
prop["soft_max"] = 1000.0
for mesh_name in meshes:
mesh_obj = bpy.data.objects[mesh_name]
# Add/get the shape key
shape = addget_shape_key(mesh_obj, name=shape_name)
# Add/get the shape key driver
fcurve, a = addget_shape_key_driver(mesh_obj, name=shape_name)
# Set up the driver
driver = fcurve.driver
driver.type = 'SCRIPTED'
@@ -234,23 +310,11 @@ def create_shape_and_driver(obj, bone, meshes, shape_name, var_name, var_path, f
else:
var = driver.variables.new()
var.name = var_name
# Get the fac variable, or create it if it doesn't already exist
if fac_name in driver.variables:
var_fac = driver.variables[fac_name]
else:
var_fac = driver.variables.new()
var_fac.name = fac_name
# Set up the variable
var.type = "SINGLE_PROP"
var.targets[0].id_type = 'OBJECT'
var.targets[0].id = obj
var.targets[0].data_path = 'pose.bones["' + bone + '"]' + var_path
# Set up the fac variable
var_fac.type = "SINGLE_PROP"
var_fac.targets[0].id_type = 'OBJECT'
var_fac.targets[0].id = obj
var_fac.targets[0].data_path = 'pose.bones["' + bone + '"]["' + fac_name + '"]'

View File

@@ -41,7 +41,7 @@ def metarig_template():
#bone.tail[:] = 0.0000, -0.0306, -0.0159
#bone.roll = 0.0000
#bone.connected = False
#bpy.ops.object.mode_set(mode='OBJECT')
#pbone = obj.pose.bones['tail.01']
#pbone['type'] = 'tail_spline_ik'
@@ -72,13 +72,13 @@ def main(obj, bone_definitions, base_names, options):
bb = obj.data.bones
eb = obj.data.edit_bones
pb = obj.pose.bones
# Create bones for hinge/free
# hinge 1 sticks with the parent
# hinge 2 is the parent of the tail controls
hinge1 = copy_bone_simple(arm, bone_definitions[0], "MCH-%s.hinge1" % base_names[bone_definitions[0]], parent=True).name
hinge2 = copy_bone_simple(arm, bone_definitions[0], "MCH-%s.hinge2" % base_names[bone_definitions[0]], parent=False).name
# Create tail control bones
bones = []
i = 0
@@ -90,10 +90,10 @@ def main(obj, bone_definitions, base_names, options):
eb[bone].local_location = False
i = 1
bones += [bone]
bpy.ops.object.mode_set(mode='OBJECT')
# Rotation mode and axis locks
for bone, org_bone in zip(bones, bone_definitions):
pb[bone].rotation_mode = pb[org_bone].rotation_mode
@@ -102,7 +102,7 @@ def main(obj, bone_definitions, base_names, options):
pb[bone].lock_rotation = tuple(pb[org_bone].lock_rotation)
pb[bone].lock_rotation_w = pb[org_bone].lock_rotation_w
pb[bone].lock_scale = tuple(pb[org_bone].lock_scale)
# Add custom properties
pb[bones[0]]["hinge"] = 0.0
prop = rna_idprop_ui_prop_get(pb[bones[0]], "hinge", create=True)
@@ -110,31 +110,31 @@ def main(obj, bone_definitions, base_names, options):
prop["max"] = 1.0
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
pb[bones[0]]["free"] = 0.0
prop = rna_idprop_ui_prop_get(pb[bones[0]], "free", create=True)
prop["min"] = 0.0
prop["max"] = 1.0
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
# Add constraints
for bone, org_bone in zip(bones, bone_definitions):
con = pb[org_bone].constraints.new('COPY_TRANSFORMS')
con.target = obj
con.subtarget = bone
con_f = pb[hinge2].constraints.new('COPY_LOCATION')
con_f.target = obj
con_f.subtarget = hinge1
con_h = pb[hinge2].constraints.new('COPY_TRANSFORMS')
con_h.target = obj
con_h.subtarget = hinge1
# Add drivers
bone_path = pb[bones[0]].path_to_id()
driver_fcurve = con_f.driver_add("influence", 0)
driver = driver_fcurve.driver
driver.type = 'AVERAGE'
@@ -147,7 +147,7 @@ def main(obj, bone_definitions, base_names, options):
mod.poly_order = 1
mod.coefficients[0] = 1.0
mod.coefficients[1] = -1.0
driver_fcurve = con_h.driver_add("influence", 0)
driver = driver_fcurve.driver
driver.type = 'AVERAGE'
@@ -160,7 +160,7 @@ def main(obj, bone_definitions, base_names, options):
mod.poly_order = 1
mod.coefficients[0] = 1.0
mod.coefficients[1] = -1.0
return None

View File

@@ -164,10 +164,6 @@ class WM_OT_properties_edit(bpy.types.Operator):
max = rna_max
description = StringProperty(name="Tip", default="")
# the class instance is not persistant, need to store in the class
# not ideal but changes as the op runs.
_last_prop = ['']
def execute(self, context):
path = self.properties.path
value = self.properties.value
@@ -179,9 +175,6 @@ class WM_OT_properties_edit(bpy.types.Operator):
except:
value_eval = value
if type(value_eval) == str:
value_eval = '"' + value_eval + '"'
# First remove
item = eval("context.%s" % path)
@@ -192,7 +185,7 @@ class WM_OT_properties_edit(bpy.types.Operator):
# Reassign
exec_str = "item['%s'] = %s" % (prop, value_eval)
exec_str = "item['%s'] = %s" % (prop, repr(value_eval))
# print(exec_str)
exec(exec_str)
self._last_prop[:] = [prop]
@@ -212,7 +205,7 @@ class WM_OT_properties_edit(bpy.types.Operator):
def invoke(self, context, event):
self._last_prop[:] = [self.properties.property]
self._last_prop = [self.properties.property]
item = eval("context.%s" % self.properties.path)

View File

@@ -130,8 +130,7 @@ class AddTorus(bpy.types.Operator):
ob.selected = False
mesh.update()
ob_new = bpy.data.objects.new("Torus", 'MESH')
ob_new.data = mesh
ob_new = bpy.data.objects.new("Torus", mesh)
scene.objects.link(ob_new)
ob_new.selected = True
@@ -166,10 +165,10 @@ def register():
bpy.types.register(AddTorus)
bpy.types.INFO_MT_mesh_add.append(menu_func)
def unregister():
bpy.types.unregister(AddTorus)
bpy.types.INFO_MT_mesh_add.remove(menu_func)
if __name__ == "__main__":
register()

View File

@@ -166,7 +166,7 @@ def autocomplete(context):
# Separate automplete output by command prompts
if scrollback != '':
bpy.ops.console.scrollback_append(text=sc.prompt + current_line.line, type='INPUT')
bpy.ops.console.scrollback_append(text=sc.prompt + current_line.line, type='INPUT')
# Now we need to copy back the line from blender back into the
# text editor. This will change when we dont use the text editor
@@ -201,12 +201,14 @@ def banner(context):
return {'FINISHED'}
def register():
pass
def unregister():
pass
if __name__ == "__main__":
register()

View File

@@ -81,9 +81,9 @@ def banner(context):
def register():
pass
def unregister():
pass
if __name__ == "__main__":
register()

View File

@@ -5,19 +5,19 @@ from Mathutils import *
def main(context):
def cleanupEulCurve(fcv):
keys = []
for k in fcv.keyframe_points:
keys.append([k.handle1.copy(), k.co.copy(), k.handle2.copy()])
keys.append([k.handle1.copy(), k.co.copy(), k.handle2.copy()])
print(keys)
for i in range(len(keys)):
cur = keys[i]
prev = keys[i-1] if i > 0 else None
next = keys[i+1] if i < len(keys)-1 else None
if prev == None:
continue
th = pi
if abs(prev[1][1] - cur[1][1]) >= th: # more than 180 degree jump
fac = pi*2
@@ -31,13 +31,13 @@ def main(context):
cur[0][1] -= fac
cur[1][1] -= fac
cur[2][1] -= fac
for i in range(len(keys)):
for x in range(2):
fcv.keyframe_points[i].handle1[x] = keys[i][0][x]
fcv.keyframe_points[i].co[x] = keys[i][1][x]
fcv.keyframe_points[i].handle2[x] = keys[i][2][x]
flist = bpy.context.active_object.animation_data.action.fcurves
for f in flist:
if f.selected and f.data_path.endswith("rotation_euler"):
@@ -45,7 +45,7 @@ def main(context):
class DiscontFilterOp(bpy.types.Operator):
"""Fixes the most common causes of gimbal lock in the fcurves of the active bone"""
bl_idname = "graph.discont_filter"
bl_idname = "graph.euler_filter"
bl_label = "Filter out discontinuities in the active fcurves"
def poll(self, context):
@@ -63,4 +63,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -38,16 +38,16 @@ class SaveDirty(bpy.types.Operator):
self.report({'WARNING'}, "Path used by more then one image: " + path)
else:
unique_paths.add(path)
image.save(path=path)
image.save()
return {'FINISHED'}
def register():
bpy.types.register(SaveDirty)
def unregister():
bpy.types.unregister(SaveDirty)
if __name__ == "__main__":
register()

View File

@@ -185,6 +185,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -192,4 +193,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -96,6 +96,48 @@ class SelectCamera(bpy.types.Operator):
return {'FINISHED'}
class SelectHierarchy(bpy.types.Operator):
'''Select object relative to the active objects position in the hierarchy'''
bl_idname = "object.select_hierarchy"
bl_label = "Select Hierarchy"
bl_register = True
bl_undo = True
direction = EnumProperty(items=(
('PARENT', "Parent", ""),
('CHILD', "Child", "")),
name="Direction",
description="Direction to select in the hierarchy",
default='PARENT')
extend = BoolProperty(name="Extend", description="Extend the existing selection", default=False)
def poll(self, context):
return context.object
def execute(self, context):
obj = context.object
if self.properties.direction == 'PARENT':
parent = obj.parent
if not parent:
return {'CANCELLED'}
obj_act = parent
else:
children = obj.children
if len(children) != 1:
return {'CANCELLED'}
obj_act = children[0]
if not self.properties.extend:
# obj.selected = False
bpy.ops.object.select_all(action='DESELECT')
obj_act.selected = True
context.scene.objects.active = obj_act
return {'FINISHED'}
class SubdivisionSet(bpy.types.Operator):
'''Sets a Subdivision Surface Level (1-5)'''
@@ -336,7 +378,7 @@ class ShapeTransfer(bpy.types.Operator):
self.report({'ERROR'}, "Expected one other selected mesh object to copy from")
return {'CANCELLED'}
ob_act, objects = objects[0], [ob_act]
if ob_act.type != 'MESH':
self.report({'ERROR'}, "Other object is not a mesh.")
return {'CANCELLED'}
@@ -344,7 +386,7 @@ class ShapeTransfer(bpy.types.Operator):
if ob_act.active_shape_key is None:
self.report({'ERROR'}, "Other object has no shape key")
return {'CANCELLED'}
return self._main(ob_act, objects, self.properties.mode, self.properties.use_clamp)
return self._main(ob_act, objects, self.properties.mode, self.properties.use_clamp)
class JoinUVs(bpy.types.Operator):
'''Copy UV Layout to objects with matching geometry'''
@@ -424,7 +466,7 @@ class MakeDupliFace(bpy.types.Operator):
# scale = matrix.median_scale
trans = matrix.translation_part()
rot = matrix.rotation_part() # also contains scale
return [(rot * b) + trans for b in base_tri]
scene = bpy.context.scene
linked = {}
@@ -444,22 +486,20 @@ class MakeDupliFace(bpy.types.Operator):
mesh.faces.foreach_set("verts_raw", faces)
mesh.update() # generates edge data
# pick an object to use
# pick an object to use
obj = objects[0]
ob_new = bpy.data.objects.new(mesh.name, 'MESH')
ob_new.data = mesh
ob_new = bpy.data.objects.new(mesh.name, mesh)
base = scene.objects.link(ob_new)
base.layers[:] = obj.layers
ob_inst = bpy.data.objects.new(data.name, obj.type)
ob_inst.data = data
ob_inst = bpy.data.objects.new(data.name, data)
base = scene.objects.link(ob_inst)
base.layers[:] = obj.layers
for obj in objects:
scene.objects.unlink(obj)
ob_new.dupli_type = 'FACES'
ob_inst.parent = ob_new
ob_new.use_dupli_faces_scale = True
@@ -473,6 +513,7 @@ class MakeDupliFace(bpy.types.Operator):
classes = [
SelectPattern,
SelectCamera,
SelectHierarchy,
SubdivisionSet,
ShapeTransfer,
JoinUVs,

View File

@@ -28,42 +28,42 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to):
Left_Up_Front_SEL = [[],[],[]]
Right_Down_Back_SEL = [[],[],[]]
flag_first = True
for obj in bpy.context.selected_objects:
if obj.type == 'MESH':
bb_world = [obj.matrix * Vector(v[:]) for v in obj.bound_box]
Left_Up_Front = bb_world[1]
Right_Down_Back = bb_world[7]
# Active Center
if obj == bpy.context.active_object:
center_active_x = ( Left_Up_Front[0] + Right_Down_Back[0] ) / 2
center_active_y = ( Left_Up_Front[1] + Right_Down_Back[1] ) / 2
center_active_z = ( Left_Up_Front[2] + Right_Down_Back[2] ) / 2
size_active_x = ( Right_Down_Back[0] - Left_Up_Front[0] ) / 2
size_active_y = ( Right_Down_Back[1] - Left_Up_Front[1] ) / 2
size_active_z = ( Left_Up_Front[2] - Right_Down_Back[2] ) / 2
# Selection Center
if flag_first:
flag_first = False
Left_Up_Front_SEL[0] = Left_Up_Front[0]
Left_Up_Front_SEL[1] = Left_Up_Front[1]
Left_Up_Front_SEL[2] = Left_Up_Front[2]
Right_Down_Back_SEL[0] = Right_Down_Back[0]
Right_Down_Back_SEL[1] = Right_Down_Back[1]
Right_Down_Back_SEL[2] = Right_Down_Back[2]
else:
# X axis
if Left_Up_Front[0] < Left_Up_Front_SEL[0]:
@@ -74,7 +74,7 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to):
# Z axis
if Left_Up_Front[2] > Left_Up_Front_SEL[2]:
Left_Up_Front_SEL[2] = Left_Up_Front[2]
# X axis
if Right_Down_Back[0] > Right_Down_Back_SEL[0]:
Right_Down_Back_SEL[0] = Right_Down_Back[0]
@@ -84,7 +84,7 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to):
# Z axis
if Right_Down_Back[2] < Right_Down_Back_SEL[2]:
Right_Down_Back_SEL[2] = Right_Down_Back[2]
center_sel_x = ( Left_Up_Front_SEL[0] + Right_Down_Back_SEL[0] ) / 2
center_sel_y = ( Left_Up_Front_SEL[1] + Right_Down_Back_SEL[1] ) / 2
center_sel_z = ( Left_Up_Front_SEL[2] + Right_Down_Back_SEL[2] ) / 2
@@ -93,143 +93,144 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to):
for obj in bpy.context.selected_objects:
if obj.type == 'MESH':
loc_world = obj.location
bb_world = [obj.matrix * Vector(v[:]) for v in obj.bound_box]
Left_Up_Front = bb_world[1]
Right_Down_Back = bb_world[7]
center_x = ( Left_Up_Front[0] + Right_Down_Back[0] ) / 2
center_y = ( Left_Up_Front[1] + Right_Down_Back[1] ) / 2
center_z = ( Left_Up_Front[2] + Right_Down_Back[2] ) / 2
positive_x = Right_Down_Back[0]
positive_y = Right_Down_Back[1]
positive_z = Left_Up_Front[2]
negative_x = Left_Up_Front[0]
negative_y = Left_Up_Front[1]
negative_z = Right_Down_Back[2]
obj_loc = obj.location
if align_x:
# Align Mode
if relative_to == 'OPT_4': # Active relative
if align_mode == 'OPT_1':
obj_x = obj_loc[0] - negative_x - size_active_x
elif align_mode == 'OPT_3':
obj_x = obj_loc[0] - positive_x + size_active_x
else: # Everything else relative
if align_mode == 'OPT_1':
obj_x = obj_loc[0] - negative_x
elif align_mode == 'OPT_3':
obj_x = obj_loc[0] - positive_x
if align_mode == 'OPT_2': # All relative
obj_x = obj_loc[0] - center_x
# Relative To
if relative_to == 'OPT_1':
loc_x = obj_x
elif relative_to == 'OPT_2':
loc_x = obj_x + cursor[0]
elif relative_to == 'OPT_3':
loc_x = obj_x + center_sel_x
elif relative_to == 'OPT_4':
loc_x = obj_x + center_active_x
obj.location[0] = loc_x
if align_y:
# Align Mode
if relative_to == 'OPT_4': # Active relative
if align_mode == 'OPT_1':
obj_y = obj_loc[1] - negative_y - size_active_y
elif align_mode == 'OPT_3':
obj_y = obj_loc[1] - positive_y + size_active_y
else: # Everything else relative
if align_mode == 'OPT_1':
obj_y = obj_loc[1] - negative_y
elif align_mode == 'OPT_3':
obj_y = obj_loc[1] - positive_y
if align_mode == 'OPT_2': # All relative
obj_y = obj_loc[1] - center_y
# Relative To
if relative_to == 'OPT_1':
loc_y = obj_y
elif relative_to == 'OPT_2':
loc_y = obj_y + cursor[1]
elif relative_to == 'OPT_3':
loc_y = obj_y + center_sel_y
elif relative_to == 'OPT_4':
loc_y = obj_y + center_active_y
obj.location[1] = loc_y
if align_z:
# Align Mode
if relative_to == 'OPT_4': # Active relative
if align_mode == 'OPT_1':
obj_z = obj_loc[2] - negative_z - size_active_z
elif align_mode == 'OPT_3':
obj_z = obj_loc[2] - positive_z + size_active_z
else: # Everything else relative
if align_mode == 'OPT_1':
obj_z = obj_loc[2] - negative_z
elif align_mode == 'OPT_3':
obj_z = obj_loc[2] - positive_z
if align_mode == 'OPT_2': # All relative
obj_z = obj_loc[2] - center_z
# Relative To
if relative_to == 'OPT_1':
loc_z = obj_z
elif relative_to == 'OPT_2':
loc_z = obj_z + cursor[2]
elif relative_to == 'OPT_3':
loc_z = obj_z + center_sel_z
elif relative_to == 'OPT_4':
loc_z = obj_z + center_active_z
obj.location[2] = loc_z
from bpy.props import *
class AlignObjects(bpy.types.Operator):
'''Align Objects'''
bl_idname = "object.align"
@@ -265,8 +266,11 @@ class AlignObjects(bpy.types.Operator):
align_z = BoolProperty(name="Align Z",
description="Align in the Z axis", default=False)
def poll(self, context):
return context.mode == 'OBJECT'
def execute(self, context):
align_mode = self.properties.align_mode
relative_to = self.properties.relative_to
align_x = self.properties.align_x
@@ -288,6 +292,7 @@ def register():
bpy.types.register(AlignObjects)
bpy.types.VIEW3D_MT_transform.append(menu_func)
def unregister():
bpy.types.unregister(AlignObjects)
bpy.types.VIEW3D_MT_transform.remove(menu_func)

View File

@@ -144,10 +144,10 @@ def register():
bpy.types.register(RandomizeLocRotSize)
bpy.types.VIEW3D_MT_transform.append(menu_func)
def unregister():
bpy.types.unregister(RandomizeLocRotSize)
bpy.types.VIEW3D_MT_transform.remove(menu_func)
if __name__ == "__main__":
register()

View File

@@ -75,16 +75,16 @@ class AddPresetRender(AddPresetBase):
name = AddPresetBase.name
preset_values = [
"bpy.context.scene.render_data.resolution_x",
"bpy.context.scene.render_data.resolution_y",
"bpy.context.scene.render_data.pixel_aspect_x",
"bpy.context.scene.render_data.pixel_aspect_y",
"bpy.context.scene.render_data.fps",
"bpy.context.scene.render_data.fps_base",
"bpy.context.scene.render_data.resolution_percentage",
"bpy.context.scene.render_data.fields",
"bpy.context.scene.render_data.field_order",
"bpy.context.scene.render_data.fields_still",
"bpy.context.scene.render.resolution_x",
"bpy.context.scene.render.resolution_y",
"bpy.context.scene.render.pixel_aspect_x",
"bpy.context.scene.render.pixel_aspect_y",
"bpy.context.scene.render.fps",
"bpy.context.scene.render.fps_base",
"bpy.context.scene.render.resolution_percentage",
"bpy.context.scene.render.fields",
"bpy.context.scene.render.field_order",
"bpy.context.scene.render.fields_still",
]
preset_subdir = "render"
@@ -170,6 +170,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -177,4 +178,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -68,8 +68,8 @@ class PlayRenderedAnim(bpy.types.Operator):
bl_undo = False
def execute(self, context):
sce = context.scene
rd = sce.render_data
scene = context.scene
rd = scene.render
prefs = context.user_preferences
preset = prefs.filepaths.animation_player_preset
@@ -86,7 +86,7 @@ class PlayRenderedAnim(bpy.types.Operator):
file = ''.join([(c if file_b[i] == c else "#") for i, c in enumerate(file_a)])
else:
# works for movies and images
file = rd.frame_path(frame=sce.start_frame)
file = rd.frame_path(frame=scene.start_frame)
cmd = [player_path]
# extra options, fps controls etc.
@@ -97,7 +97,7 @@ class PlayRenderedAnim(bpy.types.Operator):
opts = [file, "-playback_speed", str(rd.fps)]
cmd.extend(opts)
elif preset == 'FRAMECYCLER':
opts = [file, "%d-%d" % (sce.start_frame, sce.end_frame)]
opts = [file, "%d-%d" % (scene.start_frame, scene.end_frame)]
cmd.extend(opts)
elif preset == 'RV':
opts = ["-fps", str(rd.fps), "-play", "[ %s ]" % file]
@@ -112,12 +112,13 @@ class PlayRenderedAnim(bpy.types.Operator):
pass
#raise OSError("Couldn't find an external animation player.")
return('FINISHED',)
return {'FINISHED'}
def register():
bpy.types.register(PlayRenderedAnim)
def unregister():
bpy.types.unregister(PlayRenderedAnim)

View File

@@ -39,7 +39,7 @@ class ExportUVLayout(bpy.types.Operator):
name="Format",
description="File format to export the UV layout to",
default='SVG')
def poll(self, context):
obj = context.active_object
return (obj and obj.type == 'MESH')
@@ -71,18 +71,18 @@ class ExportUVLayout(bpy.types.Operator):
mesh = obj.data
uv_layer = mesh.active_uv_texture.data
uv_layer_len = len(uv_layer)
if not self.properties.export_all:
local_image = Ellipsis
if context.tool_settings.uv_local_view:
space_data = self._space_image(context)
if space_data:
local_image = space_data.image
faces = mesh.faces
for i in range(uv_layer_len):
uv_elem = uv_layer[i]
# context checks
@@ -90,16 +90,13 @@ class ExportUVLayout(bpy.types.Operator):
#~ uv = uv_elem.uv
#~ if False not in uv_elem.uv_selected[:len(uv)]:
#~ yield (i, uv)
# just write what we see.
yield (i, uv_layer[i].uv)
else:
# all, simple
for i in range(uv_layer_len):
yield (i, uv_layer[i].uv)
def execute(self, context):
# for making an XML compatible string
@@ -116,7 +113,7 @@ class ExportUVLayout(bpy.types.Operator):
faces = mesh.faces
mode = self.properties.mode
file = open(self.properties.path, "w")
fw = file.write
@@ -129,13 +126,13 @@ class ExportUVLayout(bpy.types.Operator):
fw(' xmlns="http://www.w3.org/2000/svg" version="1.1">\n')
desc = "%s, %s, %s (Blender %s)" % (basename(bpy.data.filename), obj.name, mesh.name, bpy.app.version_string)
fw('<desc>%s</desc>\n' % escape(desc))
# svg colors
fill_settings = []
fill_default = 'fill="grey"'
for mat in mesh.materials if mesh.materials else [None]:
if mat:
fill_settings.append('fill="rgb(%d, %d, %d)"' % tuple(int(c*255) for c in mat.diffuse_color))
fill_settings.append('fill="rgb(%d, %d, %d)"' % tuple(int(c * 255) for c in mat.diffuse_color))
else:
fill_settings.append(fill_default)
@@ -144,10 +141,10 @@ class ExportUVLayout(bpy.types.Operator):
fill = fill_settings[faces[i].material_index]
except IndexError:
fill = fill_default
fw('<polygon %s fill-opacity="0.5" stroke="black" stroke-width="1px" \n' % fill)
fw(' points="')
for j, uv in enumerate(uvs):
x, y = uv[0], 1.0 - uv[1]
fw('%.3f,%.3f ' % (x * image_width, y * image_height))
@@ -172,15 +169,15 @@ class ExportUVLayout(bpy.types.Operator):
fw('1 setlinejoin\n')
fw('1 setlinecap\n')
fw('newpath\n')
for i, uvs in self._face_uv_iter(context):
for j, uv in enumerate(uvs):
x, y = uv[0], uv[1]
if j==0:
if j == 0:
fw('%.5f %.5f moveto\n' % (x * image_width, y * image_height))
else:
fw('%.5f %.5f lineto\n' % (x * image_width, y * image_height))
fw('closepath\n')
fw('stroke\n')
fw('showpage\n')
@@ -206,10 +203,10 @@ def register():
bpy.types.register(ExportUVLayout)
bpy.types.IMAGE_MT_uvs.append(menu_func)
def unreguster():
bpy.types.unregister(ExportUVLayout)
bpy.types.IMAGE_MT_uvs.remove(menu_func)
if __name__ == "__main__":
register()

View File

@@ -1143,11 +1143,11 @@ menu_func = (lambda self, context: self.layout.operator(SmartProject.bl_idname,
def register():
bpy.types.register(SmartProject)
bpy.types.VIEW3D_MT_uv_map.append(menu_func)
def unregister():
bpy.types.unregister(SmartProject)
bpy.types.VIEW3D_MT_uv_map.remove(menu_func)
if __name__ == "__main__":
register()

View File

@@ -178,9 +178,9 @@ class VertexPaintDirt(bpy.types.Operator):
def register():
bpy.types.register(VertexPaintDirt)
def unregister():
bpy.types.unregister(VertexPaintDirt)
if __name__ == "__main__":
register()

View File

@@ -297,33 +297,29 @@ doc_new = StringProperty(name="Edit Description",
description="", maxlen=1024, default="")
class WM_OT_context_modal_mouse(bpy.types.Operator):
'''Adjust arbitrary values with mouse input'''
bl_idname = "wm.context_modal_mouse"
bl_label = "Context Modal Mouse"
path_iter = StringProperty(description="The path relative to the context, must point to an iterable.")
path_item = StringProperty(description="The path from each iterable to the value (int or float)")
input_scale = FloatProperty(default=0.01, description="Scale the mouse movement by this value before applying the delta")
invert = BoolProperty(default=False, description="Invert the mouse input")
initial_x = IntProperty(options={'HIDDEN'})
_values = {}
def _values_store(self, context):
path_iter = self.properties.path_iter
path_item = self.properties.path_item
self._values.clear()
values = self._values
self._values = values = {}
for item in getattr(context, path_iter):
try:
value_orig = eval("item." + path_item)
except:
continue
# check this can be set, maybe this is library data.
try:
exec("item.%s = %s" % (path_item, value_orig))
@@ -332,15 +328,17 @@ class WM_OT_context_modal_mouse(bpy.types.Operator):
values[item] = value_orig
def _values_delta(self, delta):
delta *= self.properties.input_scale
if self.properties.invert:
delta = -delta
delta = - delta
path_item = self.properties.path_item
for item, value_orig in self._values.items():
exec("item.%s = %s" % (path_item, value_orig + delta))
if type(value_orig) == int:
exec("item.%s = int(%d)" % (path_item, round(value_orig + delta)))
else:
exec("item.%s = %f" % (path_item, value_orig + delta))
def _values_restore(self):
path_item = self.properties.path_item
@@ -348,7 +346,7 @@ class WM_OT_context_modal_mouse(bpy.types.Operator):
exec("item.%s = %s" % (path_item, value_orig))
self._values.clear()
def _values_clear(self):
self._values.clear()
@@ -363,10 +361,10 @@ class WM_OT_context_modal_mouse(bpy.types.Operator):
self._values_clear()
return {'FINISHED'}
elif event_type in ('RIGHTMOUSE', 'ESCAPE'):
elif event_type in ('RIGHTMOUSE', 'ESC'):
self._values_restore()
return {'FINISHED'}
return {'RUNNING_MODAL'}
def invoke(self, context, event):
@@ -530,11 +528,13 @@ classes = [
rna_prop_ui.WM_OT_properties_add,
rna_prop_ui.WM_OT_properties_remove]
def register():
register = bpy.types.register
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -542,4 +542,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -1,7 +1,7 @@
bpy.context.scene.render_data.resolution_x = 1920
bpy.context.scene.render_data.resolution_y = 1080
bpy.context.scene.render_data.resolution_percentage = 100
bpy.context.scene.render_data.pixel_aspect_x = 1
bpy.context.scene.render_data.pixel_aspect_y = 1
bpy.context.scene.render_data.fps = 24
bpy.context.scene.render_data.fps_base = 1
bpy.context.scene.render.resolution_x = 1920
bpy.context.scene.render.resolution_y = 1080
bpy.context.scene.render.resolution_percentage = 100
bpy.context.scene.render.pixel_aspect_x = 1
bpy.context.scene.render.pixel_aspect_y = 1
bpy.context.scene.render.fps = 24
bpy.context.scene.render.fps_base = 1

View File

@@ -1,7 +1,7 @@
bpy.context.scene.render_data.resolution_x = 1280
bpy.context.scene.render_data.resolution_y = 720
bpy.context.scene.render_data.resolution_percentage = 100
bpy.context.scene.render_data.pixel_aspect_x = 1
bpy.context.scene.render_data.pixel_aspect_y = 1
bpy.context.scene.render_data.fps = 24
bpy.context.scene.render_data.fps_base = 1
bpy.context.scene.render.resolution_x = 1280
bpy.context.scene.render.resolution_y = 720
bpy.context.scene.render.resolution_percentage = 100
bpy.context.scene.render.pixel_aspect_x = 1
bpy.context.scene.render.pixel_aspect_y = 1
bpy.context.scene.render.fps = 24
bpy.context.scene.render.fps_base = 1

View File

@@ -1,7 +1,7 @@
bpy.context.scene.render_data.resolution_x = 720
bpy.context.scene.render_data.resolution_y = 480
bpy.context.scene.render_data.resolution_percentage = 100
bpy.context.scene.render_data.pixel_aspect_x = 10
bpy.context.scene.render_data.pixel_aspect_y = 11
bpy.context.scene.render_data.fps = 30
bpy.context.scene.render_data.fps_base = 1.001
bpy.context.scene.render.resolution_x = 720
bpy.context.scene.render.resolution_y = 480
bpy.context.scene.render.resolution_percentage = 100
bpy.context.scene.render.pixel_aspect_x = 10
bpy.context.scene.render.pixel_aspect_y = 11
bpy.context.scene.render.fps = 30
bpy.context.scene.render.fps_base = 1.001

View File

@@ -1,7 +1,7 @@
bpy.context.scene.render_data.resolution_x = 720
bpy.context.scene.render_data.resolution_y = 576
bpy.context.scene.render_data.resolution_percentage = 100
bpy.context.scene.render_data.pixel_aspect_x = 54
bpy.context.scene.render_data.pixel_aspect_y = 51
bpy.context.scene.render_data.fps = 25
bpy.context.scene.render_data.fps_base = 1
bpy.context.scene.render.resolution_x = 720
bpy.context.scene.render.resolution_y = 576
bpy.context.scene.render.resolution_percentage = 100
bpy.context.scene.render.pixel_aspect_x = 54
bpy.context.scene.render.pixel_aspect_y = 51
bpy.context.scene.render.fps = 25
bpy.context.scene.render.fps_base = 1

View File

@@ -1,7 +1,7 @@
bpy.context.scene.render_data.resolution_x = 720
bpy.context.scene.render_data.resolution_y = 576
bpy.context.scene.render_data.resolution_percentage = 100
bpy.context.scene.render_data.pixel_aspect_x = 64
bpy.context.scene.render_data.pixel_aspect_y = 45
bpy.context.scene.render_data.fps = 25
bpy.context.scene.render_data.fps_base = 1
bpy.context.scene.render.resolution_x = 720
bpy.context.scene.render.resolution_y = 576
bpy.context.scene.render.resolution_percentage = 100
bpy.context.scene.render.pixel_aspect_x = 64
bpy.context.scene.render.pixel_aspect_y = 45
bpy.context.scene.render.fps = 25
bpy.context.scene.render.fps_base = 1

View File

@@ -4,7 +4,7 @@ class ModalOperator(bpy.types.Operator):
'''Move an object with the mouse, example.'''
bl_idname = "object.modal_operator"
bl_label = "Simple Modal Operator"
first_mouse_x = IntProperty()
first_value = FloatProperty()
@@ -16,10 +16,10 @@ class ModalOperator(bpy.types.Operator):
elif event.type == 'LEFTMOUSE':
return {'FINISHED'}
elif event.type in ('RIGHTMOUSE', 'ESCAPE'):
elif event.type in ('RIGHTMOUSE', 'ESC'):
context.object.location.x = self.properties.first_value
return {'CANCELLED'}
return {'RUNNING_MODAL'}
def invoke(self, context, event):
@@ -36,4 +36,4 @@ class ModalOperator(bpy.types.Operator):
bpy.types.register(ModalOperator)
if __name__ == "__main__":
bpy.ops.object.modal_operator()
bpy.ops.object.modal_operator()

View File

@@ -29,6 +29,7 @@ class MotionPathButtonsPanel(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_label = "Motion Paths"
bl_default_closed = True
def draw_settings(self, context, avs, wide_ui, bones=False):
layout = self.layout
@@ -68,6 +69,7 @@ class OnionSkinButtonsPanel(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_label = "Onion Skinning"
bl_default_closed = True
def draw(self, context):
layout = self.layout
@@ -101,7 +103,6 @@ class OnionSkinButtonsPanel(bpy.types.Panel):
################################################
# Specific Panels for DataTypes
class OBJECT_PT_motion_paths(MotionPathButtonsPanel):
#bl_label = "Object Motion Paths"
bl_context = "object"
@@ -128,9 +129,23 @@ class OBJECT_PT_motion_paths(MotionPathButtonsPanel):
col = split.column()
col.operator("object.paths_clear", text="Clear Paths")
class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel):
#bl_label = "Object Onion Skinning"
bl_context = "object"
def poll(self, context):
return (context.object)
def draw(self, context):
layout = self.layout
ob = context.object
wide_ui = context.region.width > narrowui
self.draw_settings(context, ob.animation_visualisation, wide_ui)
class DATA_PT_motion_paths(MotionPathButtonsPanel):
#bl_label = "Bone Motion Paths"
#bl_label = "Bones Motion Paths"
bl_context = "data"
def poll(self, context):
@@ -156,19 +171,39 @@ class DATA_PT_motion_paths(MotionPathButtonsPanel):
col = split.column()
col.operator("pose.paths_clear", text="Clear Paths")
class DATA_PT_onion_skinning(OnionSkinButtonsPanel):
#bl_label = "Bones Onion Skinning"
bl_context = "data"
classes = [
OBJECT_PT_motion_paths,
DATA_PT_motion_paths]
def poll(self, context):
# XXX: include posemode check?
return (context.object) and (context.armature)
# OBJECT_PT_onion_skinning
# DATA_PT_onion_skinning
def draw(self, context):
layout = self.layout
ob = context.object
wide_ui = context.region.width > narrowui
self.draw_settings(context, ob.pose.animation_visualisation, wide_ui, bones=True)
# NOTE:
# The specialised panel types defined here (i.e. OBJECT_PT_*, etc.)
# aren't registered here, but are rather imported to (and registered)
# in the files defining the contexts where they reside. Otherwise,
# these panels appear at the top of the lists by default.
#
# However, we keep these empty register funcs here just in case
# something will need them again one day, and also to make
# it easier to maintain these scripts.
classes = []
def register():
register = bpy.types.register
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -176,4 +211,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -253,6 +253,9 @@ class DATA_PT_iksolver_itasc(DataButtonsPanel):
row.prop(itasc, "dampmax", text="Damp", slider=True)
row.prop(itasc, "dampeps", text="Eps", slider=True)
# import generic panels from other files
from properties_animviz import DATA_PT_motion_paths, DATA_PT_onion_skinning
classes = [
DATA_PT_context_arm,
DATA_PT_skeleton,
@@ -261,13 +264,18 @@ classes = [
DATA_PT_ghost,
DATA_PT_iksolver_itasc,
DATA_PT_motion_paths,
#DATA_PT_onion_skinning,
DATA_PT_custom_props_arm]
def register():
register = bpy.types.register
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -275,4 +283,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -351,6 +351,7 @@ classes = [
menu_func = (lambda self, context: self.layout.menu("INFO_MT_armature_metarig_add", icon='OUTLINER_OB_ARMATURE'))
import space_info # ensure the menu is loaded first
def register():
register = bpy.types.register
for cls in classes:
@@ -358,13 +359,13 @@ def register():
space_info.INFO_MT_armature_add.append(menu_func)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
unregister(cls)
bpy.types.INFO_MT_armature_add.remove(menu_func)
if __name__ == "__main__":
register()

View File

@@ -398,11 +398,13 @@ classes = [
BONE_PT_custom_props]
def register():
register = bpy.types.register
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -410,4 +412,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -163,6 +163,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -170,4 +171,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -401,6 +401,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -408,4 +409,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -51,11 +51,13 @@ class DATA_PT_empty(DataButtonsPanel):
classes = [
DATA_PT_empty]
def register():
register = bpy.types.register
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -63,4 +65,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -411,6 +411,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -418,4 +419,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -108,6 +108,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -115,4 +116,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -28,7 +28,7 @@ class MESH_MT_vertex_group_specials(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.operator("object.vertex_group_sort", icon='SORTALPHA')
layout.operator("object.vertex_group_copy", icon='COPY_ID')
layout.operator("object.vertex_group_copy_to_linked", icon='LINK_AREA')
@@ -227,7 +227,7 @@ class DATA_PT_shape_keys(DataButtonsPanel):
subsub.prop(ob, "shape_key_lock", text="")
subsub.prop(kb, "mute", text="")
sub.prop(ob, "shape_key_edit_mode", text="")
sub = row.row()
sub.operator("object.shape_key_clear", icon='X', text="")
@@ -325,6 +325,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -332,4 +333,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -149,6 +149,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -156,4 +157,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -739,6 +739,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -746,4 +747,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -29,7 +29,7 @@ class PhysicsButtonsPanel(bpy.types.Panel):
def poll(self, context):
ob = context.active_object
rd = context.scene.render_data
rd = context.scene.render
return ob and ob.game and (rd.engine == 'BLENDER_GAME')
@@ -166,7 +166,7 @@ class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel):
def poll(self, context):
game = context.object.game
rd = context.scene.render_data
rd = context.scene.render
return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC')) and (rd.engine == 'BLENDER_GAME')
def draw_header(self, context):
@@ -202,7 +202,7 @@ class RenderButtonsPanel(bpy.types.Panel):
bl_context = "render"
def poll(self, context):
rd = context.scene.render_data
rd = context.scene.render
return (rd.engine == 'BLENDER_GAME')
@@ -357,13 +357,13 @@ class RENDER_PT_game_performance(RenderButtonsPanel):
col.prop(gs, "show_debug_properties", text="Debug Properties")
col.prop(gs, "show_framerate_profile", text="Framerate and Profile")
col.prop(gs, "show_physics_visualization", text="Physics Visualization")
col.prop(gs, "deprecation_warnings")
col.prop(gs, "use_deprecation_warnings")
if wide_ui:
col = split.column()
col.label(text="Render:")
col.prop(gs, "all_frames")
col.prop(gs, "display_lists")
col.prop(gs, "use_frame_rate")
col.prop(gs, "use_display_lists")
class RENDER_PT_game_sound(RenderButtonsPanel):
@@ -389,8 +389,8 @@ class WorldButtonsPanel(bpy.types.Panel):
bl_context = "world"
def poll(self, context):
rd = context.scene.render_data
return (rd.engine == 'BLENDER_GAME')
scene = context.scene
return (scene.render.engine == 'BLENDER_GAME') and (scene.world is not None)
class WORLD_PT_game_context_world(WorldButtonsPanel):
@@ -398,7 +398,7 @@ class WORLD_PT_game_context_world(WorldButtonsPanel):
bl_show_header = False
def poll(self, context):
rd = context.scene.render_data
rd = context.scene.render
return (context.scene) and (rd.use_game_engine)
def draw(self, context):
@@ -533,6 +533,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -540,4 +541,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -62,7 +62,7 @@ class MaterialButtonsPanel(bpy.types.Panel):
def poll(self, context):
mat = context.material
engine = context.scene.render_data.engine
engine = context.scene.render.engine
return mat and (engine in self.COMPAT_ENGINES)
@@ -83,7 +83,7 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel):
# An exception, dont call the parent poll func because
# this manages materials for all engine types
engine = context.scene.render_data.engine
engine = context.scene.render.engine
return (context.material or context.object) and (engine in self.COMPAT_ENGINES)
def draw(self, context):
@@ -149,7 +149,7 @@ class MATERIAL_PT_shading(MaterialButtonsPanel):
def poll(self, context):
mat = active_node_mat(context.material)
engine = context.scene.render_data.engine
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES)
def draw(self, context):
@@ -188,7 +188,7 @@ class MATERIAL_PT_strand(MaterialButtonsPanel):
def poll(self, context):
mat = context.material
engine = context.scene.render_data.engine
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES)
def draw(self, context):
@@ -260,7 +260,7 @@ class MATERIAL_PT_options(MaterialButtonsPanel):
def poll(self, context):
mat = active_node_mat(context.material)
engine = context.scene.render_data.engine
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES)
def draw(self, context):
@@ -306,7 +306,7 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel):
def poll(self, context):
mat = active_node_mat(context.material)
engine = context.scene.render_data.engine
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
def draw(self, context):
@@ -336,13 +336,14 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel):
sub.prop(mat, "shadow_ray_bias", text="Ray Bias")
col.prop(mat, "cast_approximate")
class MATERIAL_PT_diffuse(MaterialButtonsPanel):
bl_label = "Diffuse"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
def poll(self, context):
mat = active_node_mat(context.material)
engine = context.scene.render_data.engine
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
def draw(self, context):
@@ -413,7 +414,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel):
def poll(self, context):
mat = active_node_mat(context.material)
engine = context.scene.render_data.engine
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
def draw(self, context):
@@ -483,7 +484,7 @@ class MATERIAL_PT_sss(MaterialButtonsPanel):
def poll(self, context):
mat = active_node_mat(context.material)
engine = context.scene.render_data.engine
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
def draw_header(self, context):
@@ -535,7 +536,7 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel):
def poll(self, context):
mat = active_node_mat(context.material)
engine = context.scene.render_data.engine
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
def draw_header(self, context):
@@ -594,7 +595,7 @@ class MATERIAL_PT_transp(MaterialButtonsPanel):
def poll(self, context):
mat = active_node_mat(context.material)
engine = context.scene.render_data.engine
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
def draw_header(self, context):
@@ -661,7 +662,7 @@ class MATERIAL_PT_transp_game(MaterialButtonsPanel):
def poll(self, context):
mat = active_node_mat(context.material)
engine = context.scene.render_data.engine
engine = context.scene.render.engine
return mat and (engine in self.COMPAT_ENGINES)
def draw_header(self, context):
@@ -695,7 +696,7 @@ class MATERIAL_PT_halo(MaterialButtonsPanel):
def poll(self, context):
mat = context.material
engine = context.scene.render_data.engine
engine = context.scene.render.engine
return mat and (mat.type == 'HALO') and (engine in self.COMPAT_ENGINES)
def draw(self, context):
@@ -745,7 +746,7 @@ class MATERIAL_PT_flare(MaterialButtonsPanel):
def poll(self, context):
mat = context.material
engine = context.scene.render_data.engine
engine = context.scene.render.engine
return mat and (mat.type == 'HALO') and (engine in self.COMPAT_ENGINES)
def draw_header(self, context):
@@ -781,7 +782,7 @@ class VolumeButtonsPanel(bpy.types.Panel):
def poll(self, context):
mat = context.material
engine = context.scene.render_data.engine
engine = context.scene.render.engine
return mat and (mat.type == 'VOLUME') and (engine in self.COMPAT_ENGINES)
@@ -947,6 +948,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -954,4 +956,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -304,6 +304,8 @@ class OBJECT_PT_animation(ObjectButtonsPanel):
row.prop(ob, "track_override_parent", text="Override Parent")
row.active = (ob.parent is not None)
# import generic panels from other files
from properties_animviz import OBJECT_PT_motion_paths, OBJECT_PT_onion_skinning
classes = [
OBJECT_PT_context_object,
@@ -314,6 +316,9 @@ classes = [
OBJECT_PT_display,
OBJECT_PT_duplication,
OBJECT_PT_animation,
OBJECT_PT_motion_paths,
#OBJECT_PT_onion_skinning,
OBJECT_PT_custom_props]
@@ -323,6 +328,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -330,4 +336,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -466,7 +466,6 @@ class ConstraintButtonsPanel(bpy.types.Panel):
self.space_template(layout, con, wide_ui)
#def SCRIPT(self, context, layout, con):
def ACTION(self, context, layout, con, wide_ui):
@@ -765,6 +764,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -772,4 +772,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -231,6 +231,7 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel):
sub.prop(cloth, "mass")
sub.prop(cloth, "bending_stiffness", text="Bending")
sub.prop(cloth, "internal_friction", slider=True)
sub.prop(cloth, "collider_friction", slider=True)
col = split.column()
@@ -1023,6 +1024,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -1030,4 +1032,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -47,7 +47,7 @@ class PhysicButtonsPanel(bpy.types.Panel):
def poll(self, context):
ob = context.object
rd = context.scene.render_data
rd = context.scene.render
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
@@ -244,6 +244,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -251,4 +252,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -215,9 +215,9 @@ def basic_force_field_falloff_ui(self, context, field):
def register():
pass
def unregister():
pass
if __name__ == "__main__":
register()

View File

@@ -32,7 +32,7 @@ class PhysicButtonsPanel(bpy.types.Panel):
bl_context = "physics"
def poll(self, context):
rd = context.scene.render_data
rd = context.scene.render
return (context.object) and (not rd.use_game_engine)
@@ -174,7 +174,7 @@ class PHYSICS_PT_collision(PhysicButtonsPanel):
def poll(self, context):
ob = context.object
rd = context.scene.render_data
rd = context.scene.render
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
def draw(self, context):
@@ -253,6 +253,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -260,4 +261,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -29,7 +29,7 @@ class PhysicButtonsPanel(bpy.types.Panel):
def poll(self, context):
ob = context.object
rd = context.scene.render_data
rd = context.scene.render
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
@@ -304,6 +304,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -311,4 +312,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -33,7 +33,7 @@ class PhysicButtonsPanel(bpy.types.Panel):
def poll(self, context):
ob = context.object
rd = context.scene.render_data
rd = context.scene.render
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
@@ -253,6 +253,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -260,4 +261,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -37,7 +37,7 @@ class PhysicButtonsPanel(bpy.types.Panel):
def poll(self, context):
ob = context.object
rd = context.scene.render_data
rd = context.scene.render
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
@@ -296,6 +296,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -303,4 +304,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -36,7 +36,7 @@ class RenderButtonsPanel(bpy.types.Panel):
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
def poll(self, context):
rd = context.scene.render_data
rd = context.scene.render
return (context.scene and rd.use_game_engine is False) and (rd.engine in self.COMPAT_ENGINES)
@@ -47,7 +47,7 @@ class RENDER_PT_render(RenderButtonsPanel):
def draw(self, context):
layout = self.layout
rd = context.scene.render_data
rd = context.scene.render
wide_ui = context.region.width > narrowui
split = layout.split()
@@ -71,7 +71,7 @@ class RENDER_PT_layers(RenderButtonsPanel):
layout = self.layout
scene = context.scene
rd = scene.render_data
rd = scene.render
wide_ui = context.region.width > narrowui
row = layout.row()
@@ -204,7 +204,7 @@ class RENDER_PT_shading(RenderButtonsPanel):
def draw(self, context):
layout = self.layout
rd = context.scene.render_data
rd = context.scene.render
wide_ui = context.region.width > narrowui
split = layout.split()
@@ -230,7 +230,7 @@ class RENDER_PT_performance(RenderButtonsPanel):
def draw(self, context):
layout = self.layout
rd = context.scene.render_data
rd = context.scene.render
wide_ui = context.region.width > narrowui
split = layout.split()
@@ -250,7 +250,7 @@ class RENDER_PT_performance(RenderButtonsPanel):
col = split.column()
col.label(text="Memory:")
sub = col.column()
sub.enabled = not (rd.use_border or rd.full_sample)
sub.enabled = not (rd.use_border or rd.full_sample)
sub.prop(rd, "save_buffers")
sub = col.column()
sub.active = rd.use_compositing
@@ -274,7 +274,7 @@ class RENDER_PT_post_processing(RenderButtonsPanel):
def draw(self, context):
layout = self.layout
rd = context.scene.render_data
rd = context.scene.render
wide_ui = context.region.width > narrowui
split = layout.split()
@@ -323,7 +323,7 @@ class RENDER_PT_output(RenderButtonsPanel):
def draw(self, context):
layout = self.layout
rd = context.scene.render_data
rd = context.scene.render
wide_ui = context.region.width > narrowui
layout.prop(rd, "output_path", text="")
@@ -389,7 +389,7 @@ class RENDER_PT_output(RenderButtonsPanel):
elif rd.file_format == 'QUICKTIME_CARBON':
split = layout.split()
split.operator("scene.render_data_set_quicktime_codec")
split.operator("scene.render_set_quicktime_codec")
elif rd.file_format == 'QUICKTIME_QTKIT':
split = layout.split()
@@ -404,13 +404,13 @@ class RENDER_PT_encoding(RenderButtonsPanel):
COMPAT_ENGINES = {'BLENDER_RENDER'}
def poll(self, context):
rd = context.scene.render_data
rd = context.scene.render
return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA')
def draw(self, context):
layout = self.layout
rd = context.scene.render_data
rd = context.scene.render
wide_ui = context.region.width > narrowui
split = layout.split()
@@ -453,7 +453,7 @@ class RENDER_PT_encoding(RenderButtonsPanel):
sub = layout.column()
if rd.ffmpeg_format not in ('MP3'):
sub.prop(rd, "ffmpeg_audio_codec", text="Audio Codec")
sub.prop(rd, "ffmpeg_audio_codec", text="Audio Codec")
sub.separator()
@@ -473,14 +473,14 @@ class RENDER_PT_antialiasing(RenderButtonsPanel):
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw_header(self, context):
rd = context.scene.render_data
rd = context.scene.render
self.layout.prop(rd, "antialiasing", text="")
def draw(self, context):
layout = self.layout
rd = context.scene.render_data
rd = context.scene.render
wide_ui = context.region.width > narrowui
layout.active = rd.antialiasing
@@ -488,7 +488,7 @@ class RENDER_PT_antialiasing(RenderButtonsPanel):
col = split.column()
col.row().prop(rd, "antialiasing_samples", expand=True)
sub = col.row()
sub = col.row()
sub.enabled = not rd.use_border
sub.prop(rd, "full_sample")
@@ -496,7 +496,7 @@ class RENDER_PT_antialiasing(RenderButtonsPanel):
col = split.column()
col.prop(rd, "pixel_filter", text="")
col.prop(rd, "filter_size", text="Size")
class RENDER_PT_motion_blur(RenderButtonsPanel):
bl_label = "Full Sample Motion Blur"
@@ -504,19 +504,20 @@ class RENDER_PT_motion_blur(RenderButtonsPanel):
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw_header(self, context):
rd = context.scene.render_data
rd = context.scene.render
self.layout.prop(rd, "motion_blur", text="")
def draw(self, context):
layout = self.layout
rd = context.scene.render_data
rd = context.scene.render
layout.active = rd.motion_blur
row = layout.row()
row.prop(rd, "motion_blur_samples")
class RENDER_PT_dimensions(RenderButtonsPanel):
bl_label = "Dimensions"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -525,7 +526,7 @@ class RENDER_PT_dimensions(RenderButtonsPanel):
layout = self.layout
scene = context.scene
rd = scene.render_data
rd = scene.render
wide_ui = context.region.width > narrowui
row = layout.row().split()
@@ -571,14 +572,14 @@ class RENDER_PT_stamp(RenderButtonsPanel):
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw_header(self, context):
rd = context.scene.render_data
rd = context.scene.render
self.layout.prop(rd, "render_stamp", text="")
def draw(self, context):
layout = self.layout
rd = context.scene.render_data
rd = context.scene.render
wide_ui = context.region.width > narrowui
layout.active = rd.render_stamp
@@ -619,7 +620,7 @@ class RENDER_PT_bake(RenderButtonsPanel):
def draw(self, context):
layout = self.layout
rd = context.scene.render_data
rd = context.scene.render
wide_ui = context.region.width > narrowui
layout.operator("object.bake_image", icon='RENDER_STILL')
@@ -679,6 +680,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -686,4 +688,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -102,7 +102,7 @@ class SCENE_PT_keying_sets(SceneButtonsPanel):
col = row.column()
col.prop(ks, "name")
col.prop(ks, "absolute")
subcol = col.column()
subcol.operator_context = 'INVOKE_DEFAULT'
op = subcol.operator("anim.keying_set_export", text="Export to File")
@@ -192,13 +192,13 @@ class SCENE_PT_simplify(SceneButtonsPanel):
def draw_header(self, context):
scene = context.scene
rd = scene.render_data
rd = scene.render
self.layout.prop(rd, "use_simplify", text="")
def draw(self, context):
layout = self.layout
scene = context.scene
rd = scene.render_data
rd = scene.render
wide_ui = context.region.width > narrowui
layout.active = rd.use_simplify
@@ -208,7 +208,7 @@ class SCENE_PT_simplify(SceneButtonsPanel):
col = split.column()
col.prop(rd, "simplify_subdivision", text="Subdivision")
col.prop(rd, "simplify_child_particles", text="Child Particles")
col.prop(rd, "simplify_triangulate")
if wide_ui:
@@ -242,83 +242,83 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
scene = context.scene
ks = scene.active_keying_set
f.write("# Keying Set: %s\n" % ks.name)
f.write("import bpy\n\n")
f.write("scene= bpy.data.scenes[0]\n\n")
# Add KeyingSet and set general settings
# Add KeyingSet and set general settings
f.write("# Keying Set Level declarations\n")
f.write("ks= scene.add_keying_set(name=\"%s\")\n" % ks.name)
if ks.absolute is False:
f.write("ks.absolute = False\n")
f.write("\n")
f.write("ks.insertkey_needed = %s\n" % ks.insertkey_needed)
f.write("ks.insertkey_visual = %s\n" % ks.insertkey_visual)
f.write("ks.insertkey_xyz_to_rgb = %s\n" % ks.insertkey_xyz_to_rgb)
f.write("\n")
# generate and write set of lookups for id's used in paths
id_to_paths_cache = {} # cache for syncing ID-blocks to bpy paths + shorthands
for ksp in ks.paths:
if ksp.id is None:
continue;
continue
if ksp.id in id_to_paths_cache:
continue;
continue
# - idtype_list is used to get the list of id-datablocks from bpy.data.*
# since this info isn't available elsewhere
# - id.bl_rna.name gives a name suitable for UI,
# - id.bl_rna.name gives a name suitable for UI,
# with a capitalised first letter, but we need
# the plural form that's all lower case
idtype_list = ksp.id.bl_rna.name.lower() + "s"
id_bpy_path = "bpy.data.%s[\"%s\"]" % (idtype_list, ksp.id.name)
# shorthand ID for the ID-block (as used in the script)
short_id = "id_%d" % len(id_to_paths_cache)
# store this in the cache now
id_to_paths_cache[ksp.id] = [short_id, id_bpy_path]
f.write("# ID's that are commonly used\n")
for id_pair in id_to_paths_cache.values():
f.write("%s = %s\n" % (id_pair[0], id_pair[1]))
f.write("\n")
# write paths
f.write("# Path Definitions\n")
f.write("# Path Definitions\n")
for ksp in ks.paths:
f.write("ksp = ks.add_destination(")
# id-block + RNA-path
if ksp.id:
# find the relevant shorthand from the cache
id_bpy_path = id_to_paths_cache[ksp.id][0]
else:
id_bpy_path = "None" # XXX...
id_bpy_path = "None" # XXX...
f.write("%s, '%s'" % (id_bpy_path, ksp.data_path))
# array index settings (if applicable)
if ksp.entire_array is False:
f.write(", entire_array=False, array_index=%d" % ksp.array_index)
# grouping settings (if applicable)
# NOTE: the current default is KEYINGSET, but if this changes, change this code too
if ksp.grouping == 'NAMED':
f.write(", grouping_method='%s', group_name=\"%s\"" % (ksp.grouping, ksp.group))
elif ksp.grouping != 'KEYINGSET':
f.write(", grouping_method='%s'" % ksp.grouping)
# finish off
f.write(")\n")
f.write("\n")
f.close()
@@ -337,7 +337,7 @@ classes = [
SCENE_PT_keying_set_paths,
SCENE_PT_physics,
SCENE_PT_simplify,
SCENE_PT_custom_props,
ANIM_OT_keying_set_export]
@@ -348,6 +348,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -355,4 +356,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -991,6 +991,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -998,4 +999,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -30,7 +30,7 @@ class WorldButtonsPanel(bpy.types.Panel):
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
def poll(self, context):
rd = context.scene.render_data
rd = context.scene.render
return (context.world) and (not rd.use_game_engine) and (rd.engine in self.COMPAT_ENGINES)
@@ -48,7 +48,7 @@ class WORLD_PT_context_world(WorldButtonsPanel):
COMPAT_ENGINES = {'BLENDER_RENDER'}
def poll(self, context):
rd = context.scene.render_data
rd = context.scene.render
return (not rd.use_game_engine) and (rd.engine in self.COMPAT_ENGINES)
def draw(self, context):
@@ -287,6 +287,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -294,4 +295,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -62,6 +62,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -69,4 +70,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -218,6 +218,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -225,4 +226,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -205,6 +205,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -212,4 +213,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -74,6 +74,7 @@ def register():
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
@@ -81,4 +82,3 @@ def unregister():
if __name__ == "__main__":
register()

Some files were not shown because too many files have changed in this diff Show More