Merge from trunk: 15912:16031

This commit is contained in:
Ian Thompson 2008-08-09 10:12:59 +00:00
parent d7f64d43dd
commit ed972db1a3
76 changed files with 3666 additions and 1559 deletions

@ -183,9 +183,9 @@ IF(UNIX)
SET(LLIBS "-lXi -lutil -lc -lm -lpthread -lstdc++")
IF(WITH_OPENMP)
SET(LLIBS "${LLIBS} -lgomp ")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp ")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp ")
SET(LLIBS "${LLIBS} -lgomp")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
ENDIF(WITH_OPENMP)

@ -184,15 +184,16 @@ if env['WITH_BF_OPENMP'] == 1:
env['CPPFLAGS'].append('/openmp')
env['CXXFLAGS'].append('/openmp')
else:
if env['CC'] == 'icc':
if env['CC'][-3:] == 'icc': # to be able to handle CC=/opt/bla/icc case
env.Append(LINKFLAGS=['-openmp', '-static-intel'])
env['CCFLAGS'].append('-openmp')
env['CPPFLAGS'].append('-openmp')
env['CXXFLAGS'].append('-openmp')
else:
env['CCFLAGS'].append('-fopenmp')
env['CPPFLAGS'].append('-fopenmp')
env['CXXFLAGS'].append('-fopenmp')
env.Append(CCFLAGS=['-fopenmp'])
env.Append(CPPFLAGS=['-fopenmp'])
env.Append(CXXFLAGS=['-fopenmp'])
# env.Append(LINKFLAGS=['-fprofile-generate'])
#check for additional debug libnames

@ -139,7 +139,7 @@ BF_OPENJPEG_LIB = ''
BF_OPENJPEG_INC = '${BF_OPENJPEG}/include'
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
WITH_BF_REDCODE = 'true'
WITH_BF_REDCODE = 'false'
BF_REDCODE = '#extern/libredcode'
BF_REDCODE_LIB = ''
# Uncomment the following two lines to use system's ffmpeg

@ -8,7 +8,7 @@ incs += ' ../../source/blender/makesdna ../../intern/guardedalloc'
incs += ' ../../source/blender/blenlib'
if (env['OURPLATFORM'] == 'win32-mingw'):
env.BlenderLib ('blender_bop', sources, Split(incs) , [], libtype=['common','intern'], priority = [5,50] )
env.BlenderLib ('blender_bop', sources, Split(incs) , [], libtype=['common','intern'], priority = [30,85] )
else:
env.BlenderLib ('blender_bop', sources, Split(incs) , [], libtype='common', priority = 5 )

@ -37,7 +37,7 @@
#include "BOP_Chrono.h"
#if defined(BOP_ORIG_MERGE) && defined(BOP_NEW_MERGE)
#include "../../source/blender/blenkernel/BKE_global.h"
#include "../../../source/blender/blenkernel/BKE_global.h"
#endif
BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC,

@ -278,6 +278,9 @@ ECHO Done
<File
RelativePath="..\..\intern\BOP_Merge.cpp">
</File>
<File
RelativePath="..\..\intern\BOP_Merge2.cpp">
</File>
<File
RelativePath="..\..\intern\BOP_Mesh.cpp">
</File>
@ -330,9 +333,15 @@ ECHO Done
<File
RelativePath="..\..\intern\BOP_Merge.h">
</File>
<File
RelativePath="..\..\intern\BOP_Merge2.h">
</File>
<File
RelativePath="..\..\intern\BOP_Mesh.h">
</File>
<File
RelativePath="..\..\intern\BOP_Misc.h">
</File>
<File
RelativePath="..\..\intern\BOP_Segment.h">
</File>

@ -6,7 +6,7 @@ sources = env.Glob('intern/*.cpp')
incs = 'intern ../container ../moto/include ../memutil'
if (env['OURPLATFORM'] == 'win32-mingw'):
env.BlenderLib ('blender_BSP', sources, Split(incs), [], libtype=['common','intern'], priority=[26,26] )
env.BlenderLib ('blender_BSP', sources, Split(incs), [], libtype=['common','intern'], priority=[26,69] )
else:
env.BlenderLib ('blender_BSP', sources, Split(incs), [], libtype='core', priority=26 )

@ -118,6 +118,114 @@
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="BlenderPlayer Debug|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\bsp\include;..\..\..\..\build\msvc_7\intern\bmfont\include;..\..\..\..\build\msvc_7\intern\iksolver\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\lib\windows\ffmpeg\include;..\..\..\source\blender;..\..\..\source\blender\avi;..\..\..\source\blender\img;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\include;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenloader;..\..\..\source\blender\renderconverter;..\..\..\source\blender\render\extern\include;..\..\..\source\blender\radiosity\extern\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\SoundSystem"
PreprocessorDefinitions="_DEBUG,WIN32,_LIB;WITH_FFMPEG"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
DisableLanguageExtensions="FALSE"
DefaultCharIsUnsigned="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="..\..\..\..\build\msvc_7\source\blender\python\debug\BPY_python.pch"
AssemblerListingLocation="..\..\..\..\build\msvc_7\source\blender\python\debug\"
ObjectFile="..\..\..\..\build\msvc_7\source\blender\python\debug\"
ProgramDataBaseFileName="..\..\..\..\build\msvc_7\source\blender\python\debug\"
WarningLevel="4"
SuppressStartupBanner="TRUE"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="3"
CompileAs="0"
DisableSpecificWarnings="4100"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\..\..\..\build\msvc_7\libs\debug\BPY_python.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="BlenderPlayer Release|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\bsp\include;..\..\..\..\build\msvc_7\intern\bmfont\include;..\..\..\..\build\msvc_7\intern\iksolver\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender;..\..\..\source\blender\avi;..\..\..\source\blender\img;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\include;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenloader;..\..\..\source\blender\renderconverter;..\..\..\source\blender\render\extern\include;..\..\..\source\blender\radiosity\extern\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\SoundSystem;..\..\..\..\lib\windows\ffmpeg\include"
PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
DefaultCharIsUnsigned="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="..\..\..\..\build\msvc_7\source\blender\python\BPY_python.pch"
AssemblerListingLocation="..\..\..\..\build\msvc_7\source\blender\python\"
ObjectFile="..\..\..\..\build\msvc_7\source\blender\python\"
ProgramDataBaseFileName="..\..\..\..\build\msvc_7\source\blender\python\"
WarningLevel="3"
SuppressStartupBanner="TRUE"
Detect64BitPortabilityProblems="FALSE"
CompileAs="0"
DisableSpecificWarnings="4100"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\..\..\..\build\msvc_7\libs\BPY_python.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>

@ -152,6 +152,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GP_ghost", "..\gameengine\g
{E109F1A5-FDD3-4F56-A1C4-96867EEA4C5B} = {E109F1A5-FDD3-4F56-A1C4-96867EEA4C5B}
{727F90AC-ABE6-40BF-8937-C2F2F1D13DEA} = {727F90AC-ABE6-40BF-8937-C2F2F1D13DEA}
{E90C7BC2-CF30-4A60-A8F2-0050D592E358} = {E90C7BC2-CF30-4A60-A8F2-0050D592E358}
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA} = {5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}
{32CC75E2-EE85-45E6-8E3D-513F58464F43} = {32CC75E2-EE85-45E6-8E3D-513F58464F43}
{9A307EE5-CD77-47BC-BD87-62508C7E19D8} = {9A307EE5-CD77-47BC-BD87-62508C7E19D8}
{AB590CED-F71F-4A17-A89B-18583ECD633D} = {AB590CED-F71F-4A17-A89B-18583ECD633D}
@ -248,6 +249,8 @@ Global
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{F78B7FC9-DE32-465E-9F26-BB0B6B7A2EAF}.3D Plugin Debug.ActiveCfg = Blender Debug|Win32
{F78B7FC9-DE32-465E-9F26-BB0B6B7A2EAF}.3D Plugin Release.ActiveCfg = Blender Release|Win32
@ -387,8 +390,10 @@ Global
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.Blender Debug.Build.0 = Blender Debug|Win32
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.Blender Release.ActiveCfg = Blender Release|Win32
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.Blender Release.Build.0 = Blender Release|Win32
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.BlenderPlayer Debug.ActiveCfg = Blender Debug|Win32
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.BlenderPlayer Release.ActiveCfg = Blender Release|Win32
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.BlenderPlayer Debug.ActiveCfg = BlenderPlayer Debug|Win32
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.BlenderPlayer Debug.Build.0 = BlenderPlayer Debug|Win32
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.BlenderPlayer Release.ActiveCfg = BlenderPlayer Release|Win32
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.BlenderPlayer Release.Build.0 = BlenderPlayer Release|Win32
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.Debug.ActiveCfg = Blender Debug|Win32
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.Debug.Build.0 = Blender Debug|Win32
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.Release.ActiveCfg = Blender Release|Win32

@ -365,6 +365,9 @@
<File
RelativePath="..\..\..\source\blender\blenkernel\intern\brush.c">
</File>
<File
RelativePath="..\..\..\source\blender\blenkernel\intern\bvhutils.c">
</File>
<File
RelativePath="..\..\..\source\blender\blenkernel\intern\CCGSubSurf.c">
</File>
@ -576,6 +579,9 @@
<File
RelativePath="..\..\..\source\blender\blenkernel\BKE_brush.h">
</File>
<File
RelativePath="..\..\..\source\blender\blenkernel\BKE_bvhutils.h">
</File>
<File
RelativePath="..\..\..\source\blender\blenkernel\BKE_cdderivedmesh.h">
</File>

@ -126,7 +126,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\python\api2_2x"
PreprocessorDefinitions="JANCODEPANCO;WIN32;_LIB;EXP_PYTHON_EMBEDDING;_DEBUG;USE_SUMO_SOLID;WITH_GLEXT"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@ -179,7 +179,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\python\api2_2x"
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;USE_SUMO_SOLID;WITH_GLEXT"
StringPooling="TRUE"
RuntimeLibrary="0"
@ -232,11 +232,12 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\python\api2_2x"
PreprocessorDefinitions="JANCODEPANCO;WIN32;_LIB;EXP_PYTHON_EMBEDDING;_DEBUG;USE_SUMO_SOLID;WITH_GLEXT"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
DefaultCharIsUnsigned="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="..\..\..\..\build\msvc_7\source\gameengine\ketsji\debug\KX_ketsji.pch"
AssemblerListingLocation="..\..\..\..\build\msvc_7\source\gameengine\ketsji\debug\"
@ -284,7 +285,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\python\api2_2x"
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;USE_SUMO_SOLID;WITH_GLEXT"
StringPooling="TRUE"
RuntimeLibrary="0"

@ -171,6 +171,7 @@
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_7\source\gameengine\physics\sumo\debug\PHY_Sumo.pch"
AssemblerListingLocation="..\..\..\..\..\..\build\msvc_7\source\gameengine\physics\sumo\debug\"

@ -525,8 +525,8 @@ class FaceDesc:
def __init__(self):
self.vertex_index_lst = []
self.mface = None
self.texture_index = -1
self.material_index = -1
self.texture_index = 65535
self.material_index = 65535
self.color_index = 127
self.renderstyle = 0
self.twoside = 0
@ -979,8 +979,14 @@ class FLTNode(Node):
self.header.fw.write_char(0) # Reserved
self.header.fw.write_char(alpha) # Template
self.header.fw.write_short(-1) # Detail tex pat index
self.header.fw.write_short(face_desc.texture_index) # Tex pattern index
self.header.fw.write_short(face_desc.material_index) # material index
if face_desc.texture_index == -1:
self.header.fw.write_ushort(65535)
else:
self.header.fw.write_ushort(face_desc.texture_index) # Tex pattern index
if face_desc.material_index == -1:
self.header.fw.write_ushort(65535)
else:
self.header.fw.write_ushort(face_desc.material_index) # material index
self.header.fw.write_short(0) # SMC code
self.header.fw.write_short(0) # Feature code
self.header.fw.write_int(0) # IR material code
@ -1015,7 +1021,10 @@ class FLTNode(Node):
self.header.fw.write_ushort(8 + (mtex * 8)) # Length
self.header.fw.write_uint(uvmask) # UV mask
for i in xrange(mtex):
self.header.fw.write_ushort(face_desc.images[i]) # Tex pattern index
if face_desc.images[i] == -1:
self.header.fw.write_ushort(65535)
else:
self.header.fw.write_ushort(face_desc.images[i]) # Tex pattern index
self.header.fw.write_ushort(0) # Tex effect
self.header.fw.write_ushort(0) # Tex Mapping index
self.header.fw.write_ushort(0) # Tex data. User defined
@ -1070,7 +1079,7 @@ class FLTNode(Node):
if self.opcode == 63 and options.state['externalspath']:
try:
exportdict['3t200!filename'] = os.path.join(options.state['externalspath'],self.object.DupGroup.name+'.flt')
exportdict['3t200!filename'] = os.path.join(options.state['externalspath'],self.object.DupGroup.name+'.flt').replace("\\", "/")
self.header.xrefnames.append(self.object.DupGroup.name)
except:
pass
@ -1092,7 +1101,7 @@ class FLTNode(Node):
write_prop(self.header.fw,ftype,self.object.properties['FLT']['EXT'][propname],length)
#write extension data
for i in xrange(datalen):
self.header.fw.write_char(self.object.properties['FLT']['EXT']['data'][i])
self.header.fw.write_uchar(struct.unpack('>B', struct.pack('>B', self.object.properties['FLT']['EXT']['data'][i]))[0])
self.write_pop_extension()
@ -1180,8 +1189,8 @@ class Database(Node):
desc = self.GRR.request_vertex_desc(i)
self.fw.write_short(70) # Vertex with color normal and uv opcode.
self.fw.write_ushort(64) # Length of record
self.fw.write_ushort(0) # Color name index
self.fw.write_short(0x20000000) # Flags
self.fw.write_ushort(0) # Color name index
self.fw.write_short(1 << 14) # Frozen Normal
self.fw.write_double(desc.x)
self.fw.write_double(desc.y)
self.fw.write_double(desc.z)
@ -1245,7 +1254,7 @@ class Database(Node):
cpalette = defaultp.pal
count = len(cpalette)
for i in xrange(count):
color = struct.unpack('>BBBB',struct.pack('>I',cpalette[i]))
color = struct.unpack('>BBBB',struct.pack('>i',cpalette[i]))
self.fw.write_uchar(color[3]) # alpha
self.fw.write_uchar(color[2]) # b
self.fw.write_uchar(color[1]) # g

@ -25,7 +25,7 @@ http://wiki.blender.org/index.php/Scripts/Manual/FLTools
"""
# --------------------------------------------------------------------------
# flt_palettemanager.py version 0.1 2005/04/08
# flt_palettemanager.py version 1.0 2005/04/08
# --------------------------------------------------------------------------
# ***** BEGIN GPL LICENSE BLOCK *****
#
@ -55,6 +55,75 @@ import flt_properties
import flt_defaultp as defaultp
from flt_properties import *
def RGBtoHSV( r, g, b):
minc = min( r, g, b )
maxc = max( r, g, b )
v = maxc
delta = maxc - minc
if( max != 0 ):
s = delta / maxc
else:
s = 0
h = -1
return (h,s,v)
if( r == maxc ):
h = ( g - b ) / delta
elif( g == maxc ):
h = 2 + ( b - r ) / delta
else:
h = 4 + ( r - g ) / delta
h *= 60
if( h < 0 ):
h += 360
return(h,s,v)
def HSVtoRGB(h,s,v):
if( s == 0 ):
return (v,v,v)
h /= 60
i = math.floor( h)
f = h - i
p = v * ( 1 - s )
q = v * ( 1 - s * f )
t = v * ( 1 - s * ( 1 - f ) )
if i == 0:
r = v
g = t
b = p
elif i == 1:
r = q
g = v
b = p
elif i== 2:
r = p
g = v
b = t
elif i==3:
r = p
g = q
b = v
elif i==4:
r = t
g = p
b = v
else:
r = v
g = p
b = q
return(r,g,b)
palette_size = 12
palette_x = 0
@ -68,6 +137,14 @@ cinc = 1.0 / 1024.0
cstep = 0.0
picker = None
ptt = ""
ts1=None
ts2=None
ts3=None
ts4=None
ts5=None
for i in xrange(1024):
colors.append([cstep,cstep,cstep])
cstep = cstep + cinc
@ -128,7 +205,7 @@ def event(evt,val):
Draw.Redraw(1)
#copy current color and intensity to selected faces.
elif evt == Draw.CKEY:
elif evt == Draw.VKEY:
if Blender.Window.EditMode():
Blender.Window.EditMode(0)
@ -136,7 +213,7 @@ def event(evt,val):
state = update_state()
#retrieve color from palette
color = struct.unpack('>BBBB',struct.pack('>I',colors[curswatch]))
color = struct.unpack('>BBBB',struct.pack('>i',colors[curswatch]))
actmesh = state["activeMesh"]
if actmesh:
if(Blender.Window.GetKeyQualifiers() != Blender.Window.Qual["CTRL"]):
@ -182,7 +259,7 @@ def event(evt,val):
Blender.Window.RedrawAll()
#grab color and intensity from active face
elif evt == Draw.VKEY:
elif evt == Draw.CKEY:
if Blender.Window.EditMode():
Blender.Window.EditMode(0)
editmode = 1
@ -211,6 +288,23 @@ def event(evt,val):
Blender.Window.EditMode(1)
Blender.Window.RedrawAll()
elif evt == Draw.GKEY:
if Blender.Window.EditMode():
Blender.Window.EditMode(0)
editmode =1
state = update_state()
actmesh = state["activeMesh"]
activeFace = state["activeFace"]
if activeFace and "FLT_COL" in actmesh.faces.properties:
(index,intensity) = unpack_face_index(activeFace.getProperty("FLT_COL"))
for face in actmesh.faces:
(index2, intensity2) = unpack_face_index(face.getProperty("FLT_COL"))
if index == index2:
face.sel = 1
elif evt == Draw.ESCKEY:
Draw.Exit()
@ -225,11 +319,11 @@ def update_all():
for object in state["activeScene"].objects:
if object.type == "Mesh":
mesh = object.getData(mesh=True)
if 'FLT_COL' in mesh.faces.properties:
if 'FLT_COL' in mesh.faces.properties and "FLT_Fcol" in mesh.getColorLayerNames():
mesh.activeColorLayer = "FLT_Fcol"
for face in mesh.faces:
(index,intensity) = unpack_face_index(face.getProperty('FLT_COL'))
color = struct.unpack('>BBBB',struct.pack('>I',colors[index]))
color = struct.unpack('>BBBB',struct.pack('>i',colors[index]))
#update the vertex colors for this face
for col in face.col:
col.r = int(color[0] * intensity)
@ -284,8 +378,13 @@ def draw_palette():
global colors
global curint
global curswatch
global picker
global picker
global ts1
global ts2
global ts3
global ts4
global ts5
state = update_state()
init_pal()
@ -297,7 +396,7 @@ def draw_palette():
for x in xrange(32):
ypos = palette_y
for y in xrange(32):
color = struct.unpack('>BBBB',struct.pack('>I',colors[cid]))
color = struct.unpack('>BBBB',struct.pack('>i',colors[cid]))
glColor3f(color[0]/255.0,color[1]/255.0,color[2]/255.0)
glBegin(GL_POLYGON)
glVertex2i(xpos,ypos)
@ -328,7 +427,7 @@ def draw_palette():
xpos = xpos + ssize
#draw intensity gradient
color = struct.unpack('>BBBB',struct.pack('>I',colors[curswatch]))
color = struct.unpack('>BBBB',struct.pack('>i',colors[curswatch]))
color = [color[0]/255.0,color[1]/255.0,color[2]/255.0]
colsteps = [color[0]/255.0,color[1]/255.0,color[2]/255.0]
stripwidth = (palette_size * 32.0) / 256
@ -355,15 +454,15 @@ def draw_palette():
xpos = ((palette_size*32) * (1.0 - curint)) + palette_x
glColor3f(1.0,1.0,1.0)
glBegin(GL_LINE_LOOP)
glVertex2i(xpos-6,grady-1)
glVertex2i(xpos+6,grady-1)
glVertex2i(xpos+6,grady+palette_size+1)
glVertex2i(xpos-6,grady+palette_size+1)
glVertex2i(int(xpos-6),int(grady-1))
glVertex2i(int(xpos+6),int(grady-1))
glVertex2i(int(xpos+6),int(grady+palette_size+1))
glVertex2i(int(xpos-6),int(grady+palette_size+1))
#glVertex2i(xpos-6,grady+7)
glEnd()
#draw color picker
color = struct.unpack('>BBBB',struct.pack('>I',colors[curswatch]))
color = struct.unpack('>BBBB',struct.pack('>i',colors[curswatch]))
pickcol = (color[0]/255.0,color[1]/255.0,color[2]/255.0)
picker = Blender.Draw.ColorPicker(1,highlight[0][0]+1,highlight[0][1]+1,ssize-2,ssize-2,pickcol,ptt)
@ -377,6 +476,24 @@ def draw_palette():
glVertex2i(highlight[0][0],highlight[0][1])
glEnd()
#draw text string explanations
xpos = palette_size*32+20
ypos = palette_size*32+10
glRasterPos2d(xpos,ypos)
ts1 = Blender.Draw.Text("FLT Palette Manager V 1.0")
ypos = ypos - 20
glRasterPos2d(xpos,ypos)
ts3 = Blender.Draw.Text("CKEY - Copy Active Face Color*")
ypos = ypos - 20
glRasterPos2d(xpos,ypos)
ts2 = Blender.Draw.Text("VKEY - Paste Color to Selected Faces")
ypos = ypos - 20
glRasterPos2d(xpos,ypos)
ts4 = Blender.Draw.Text("GKEY - Select Faces With Same Color")
ypos = ypos - 15
glRasterPos2d(xpos,ypos)
ts5 = Blender.Draw.Text("(*Requires mesh with UV coordinates)", 'small')
def gui():
glClearColor(0.5,0.5,0.5,1.0)
glClear(GL_COLOR_BUFFER_BIT)
@ -385,4 +502,4 @@ def gui():
init_pal()
Draw.Register(gui,event,but_event)

File diff suppressed because it is too large Load Diff

@ -25,7 +25,7 @@ It removes very low weighted verts from the current group with a weight option.
# 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
@ -51,13 +51,14 @@ def weightClean(me, PREF_THRESH, PREF_KEEP_SINGLE, PREF_OTHER_GROUPS):
for wd in vWeightDict:
l = len(wd)
if not PREF_KEEP_SINGLE or l > 1:
# cant use iteritems because the dict is having items removed
for group in wd.keys():
w= wd[group]
if w <= PREF_THRESH:
# small weight, remove.
del wd[group]
rem_count +=1
l-=1
l-=1
if PREF_KEEP_SINGLE and l == 1:
break
@ -117,4 +118,4 @@ def main():
Draw.PupMenu('Removed %i verts from groups' % rem_count)
if __name__=='__main__':
main()
main()

@ -0,0 +1,98 @@
/**
*
* $Id$
*
* ***** 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.
*
* The Original Code is Copyright (C) 2006 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): André Pinto
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef BKE_BVHUTILS_H
#define BKE_BVHUTILS_H
#include "BLI_kdopbvh.h"
/*
* This header encapsulates necessary code to buld a BVH
*/
struct DerivedMesh;
struct MVert;
struct MFace;
/*
* struct that kepts basic information about a BVHTree build from a mesh
*/
typedef struct BVHTreeFromMesh
{
struct BVHTree *tree;
/* default callbacks to bvh nearest and raycast */
BVHTree_NearestPointCallback nearest_callback;
BVHTree_RayCastCallback raycast_callback;
/* Mesh represented on this BVHTree */
struct DerivedMesh *mesh;
/* Vertex array, so that callbacks have instante access to data */
struct MVert *vert;
struct MFace *face;
/* radius for raycast */
float sphere_radius;
} BVHTreeFromMesh;
/*
* Builds a bvh tree where nodes are the vertexs of the given mesh.
* Configures BVHTreeFromMesh.
*
* The tree is build in mesh space coordinates, this means special care must be made on queries
* so that the coordinates and rays are first translated on the mesh local coordinates.
* Reason for this is that later bvh_from_mesh_* might use a cache system and so it becames possible to reuse
* a BVHTree.
*
* free_bvhtree_from_mesh should be called when the tree is no longer needed.
*/
void bvhtree_from_mesh_verts(struct BVHTreeFromMesh *data, struct DerivedMesh *mesh, float epsilon, int tree_type, int axis);
/*
* Builds a bvh tree where nodes are the faces of the given mesh.
* Configures BVHTreeFromMesh.
*
* The tree is build in mesh space coordinates, this means special care must be made on queries
* so that the coordinates and rays are first translated on the mesh local coordinates.
* Reason for this is that later bvh_from_mesh_* might use a cache system and so it becames possible to reuse
* a BVHTree.
*
* free_bvhtree_from_mesh should be called when the tree is no longer needed.
*/
void bvhtree_from_mesh_faces(struct BVHTreeFromMesh *data, struct DerivedMesh *mesh, float epsilon, int tree_type, int axis);
/*
* Frees data allocated by a call to bvhtree_from_mesh_*.
*/
void free_bvhtree_from_mesh(struct BVHTreeFromMesh *data);
#endif

@ -73,6 +73,7 @@ void BKE_free_envmap(struct EnvMap *env);
struct EnvMap *BKE_add_envmap(void);
struct EnvMap *BKE_copy_envmap(struct EnvMap *env);
int BKE_texture_dependsOnTime(const struct Tex *texture);
#endif

@ -117,10 +117,14 @@ float BPY_pydriver_eval(struct IpoDriver *driver)
{
return 0;
}
/*
int EXPP_dict_set_item_str(struct PyObject *dict, char *key, struct PyObject *value)
{
return 0;
}
*/
void Node_SetStack(struct BPy_Node *self, struct bNodeStack **stack, int type){}
void InitNode(struct BPy_Node *self, struct bNode *node){}
void Node_SetShi(struct BPy_Node *self, struct ShadeInput *shi){}

@ -734,9 +734,8 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Object *par, float par_
ParticleCacheKey *cache;
ParticleSystemModifierData *psmd;
float ctime, pa_time, scale = 1.0f;
float tmat[4][4], mat[4][4], obrotmat[4][4], pamat[4][4], size=0.0;
float tmat[4][4], mat[4][4], pamat[4][4], size=0.0;
float (*obmat)[4], (*oldobmat)[4];
float xvec[3] = {-1.0, 0.0, 0.0}, q[4];
int lay, a, b, k, step_nbr = 0, counter, hair = 0;
int totpart, totchild, totgroup=0, pa_num;
@ -898,14 +897,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Object *par, float par_
/* to give ipos in object correct offset */
where_is_object_time(ob, ctime-pa_time);
if(!hair) {
vectoquat(xvec, ob->trackflag, ob->upflag, q);
QuatToMat4(q, obrotmat);
obrotmat[3][3]= 1.0f;
Mat4MulMat4(mat, obrotmat, pamat);
}
else
Mat4CpyMat4(mat, pamat);
Mat4CpyMat4(mat, pamat);
Mat4MulMat4(tmat, obmat, mat);
Mat4MulFloat3((float *)tmat, size*scale);

@ -0,0 +1,433 @@
/**
*
* $Id$
*
* ***** 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.
*
* The Original Code is Copyright (C) Blender Foundation.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): André Pinto.
*
* ***** END GPL LICENSE BLOCK *****
*/
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "BKE_bvhutils.h"
#include "DNA_object_types.h"
#include "DNA_modifier_types.h"
#include "DNA_meshdata_types.h"
#include "BKE_DerivedMesh.h"
#include "BKE_utildefines.h"
#include "BKE_deform.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_displist.h"
#include "BKE_global.h"
#include "BLI_arithb.h"
/* Math stuff for ray casting on mesh faces and for nearest surface */
static float nearest_point_in_tri_surface(const float *point, const float *v0, const float *v1, const float *v2, float *nearest);
#define ISECT_EPSILON 1e-6
static float ray_tri_intersection(const BVHTreeRay *ray, const float m_dist, const float *v0, const float *v1, const float *v2)
{
float dist;
if(RayIntersectsTriangle((float*)ray->origin, (float*)ray->direction, (float*)v0, (float*)v1, (float*)v2, &dist, NULL))
return dist;
return FLT_MAX;
}
static float sphereray_tri_intersection(const BVHTreeRay *ray, float radius, const float m_dist, const float *v0, const float *v1, const float *v2)
{
float idist;
float p1[3];
float plane_normal[3], hit_point[3];
CalcNormFloat((float*)v0, (float*)v1, (float*)v2, plane_normal);
VECADDFAC( p1, ray->origin, ray->direction, m_dist);
if(SweepingSphereIntersectsTriangleUV((float*)ray->origin, p1, radius, (float*)v0, (float*)v1, (float*)v2, &idist, hit_point))
{
return idist * m_dist;
}
return FLT_MAX;
}
/*
* This calculates the distance from point to the plane
* Distance is negative if point is on the back side of plane
*/
static float point_plane_distance(const float *point, const float *plane_point, const float *plane_normal)
{
float pp[3];
VECSUB(pp, point, plane_point);
return INPR(pp, plane_normal);
}
static float choose_nearest(const float v0[2], const float v1[2], const float point[2], float closest[2])
{
float d[2][2], sdist[2];
VECSUB2D(d[0], v0, point);
VECSUB2D(d[1], v1, point);
sdist[0] = d[0][0]*d[0][0] + d[0][1]*d[0][1];
sdist[1] = d[1][0]*d[1][0] + d[1][1]*d[1][1];
if(sdist[0] < sdist[1])
{
if(closest)
VECCOPY2D(closest, v0);
return sdist[0];
}
else
{
if(closest)
VECCOPY2D(closest, v1);
return sdist[1];
}
}
/*
* calculates the closest point between point-tri (2D)
* returns that tri must be right-handed
* Returns square distance
*/
static float closest_point_in_tri2D(const float point[2], /*const*/ float tri[3][2], float closest[2])
{
float edge_di[2];
float v_point[2];
float proj[2]; //point projected over edge-dir, edge-normal (witouth normalized edge)
const float *v0 = tri[2], *v1;
float edge_slen, d; //edge squared length
int i;
const float *nearest_vertex = NULL;
//for each edge
for(i=0, v0=tri[2], v1=tri[0]; i < 3; v0=tri[i++], v1=tri[i])
{
VECSUB2D(edge_di, v1, v0);
VECSUB2D(v_point, point, v0);
proj[1] = v_point[0]*edge_di[1] - v_point[1]*edge_di[0]; //dot product with edge normal
//point inside this edge
if(proj[1] < 0)
continue;
proj[0] = v_point[0]*edge_di[0] + v_point[1]*edge_di[1];
//closest to this edge is v0
if(proj[0] < 0)
{
if(nearest_vertex == NULL || nearest_vertex == v0)
nearest_vertex = v0;
else
{
//choose nearest
return choose_nearest(nearest_vertex, v0, point, closest);
}
i++; //We can skip next edge
continue;
}
edge_slen = edge_di[0]*edge_di[0] + edge_di[1]*edge_di[1]; //squared edge len
//closest to this edge is v1
if(proj[0] > edge_slen)
{
if(nearest_vertex == NULL || nearest_vertex == v1)
nearest_vertex = v1;
else
{
return choose_nearest(nearest_vertex, v1, point, closest);
}
continue;
}
//nearest is on this edge
d= proj[1] / edge_slen;
closest[0] = point[0] - edge_di[1] * d;
closest[1] = point[1] + edge_di[0] * d;
return proj[1]*proj[1]/edge_slen;
}
if(nearest_vertex)
{
VECSUB2D(v_point, nearest_vertex, point);
VECCOPY2D(closest, nearest_vertex);
return v_point[0]*v_point[0] + v_point[1]*v_point[1];
}
else
{
VECCOPY(closest, point); //point is already inside
return 0.0f;
}
}
/*
* Returns the square of the minimum distance between the point and a triangle surface
* If nearest is not NULL the nearest surface point is written on it
*/
static float nearest_point_in_tri_surface(const float *point, const float *v0, const float *v1, const float *v2, float *nearest)
{
//Lets solve the 2D problem (closest point-tri)
float normal_dist, plane_sdist, plane_offset;
float du[3], dv[3], dw[3]; //orthogonal axis (du=(v0->v1), dw=plane normal)
float p_2d[2], tri_2d[3][2], nearest_2d[2];
CalcNormFloat((float*)v0, (float*)v1, (float*)v2, dw);
//point-plane distance and calculate axis
normal_dist = point_plane_distance(point, v0, dw);
// OPTIMIZATION
// if we are only interested in nearest distance if its closer than some distance already found
// we can:
// if(normal_dist*normal_dist >= best_dist_so_far) return FLOAT_MAX;
//
VECSUB(du, v1, v0);
Normalize(du);
Crossf(dv, dw, du);
plane_offset = INPR(v0, dw);
//project stuff to 2d
tri_2d[0][0] = INPR(du, v0);
tri_2d[0][1] = INPR(dv, v0);
tri_2d[1][0] = INPR(du, v1);
tri_2d[1][1] = INPR(dv, v1);
tri_2d[2][0] = INPR(du, v2);
tri_2d[2][1] = INPR(dv, v2);
p_2d[0] = INPR(du, point);
p_2d[1] = INPR(dv, point);
//we always have a right-handed tri
//this should always happen because of the way normal is calculated
plane_sdist = closest_point_in_tri2D(p_2d, tri_2d, nearest_2d);
//project back to 3d
if(nearest)
{
nearest[0] = du[0]*nearest_2d[0] + dv[0] * nearest_2d[1] + dw[0] * plane_offset;
nearest[1] = du[1]*nearest_2d[0] + dv[1] * nearest_2d[1] + dw[1] * plane_offset;
nearest[2] = du[2]*nearest_2d[0] + dv[2] * nearest_2d[1] + dw[2] * plane_offset;
}
return plane_sdist + normal_dist*normal_dist;
}
/*
* BVH from meshs callbacks
*/
// Callback to bvh tree nearest point. The tree must bust have been built using bvhtree_from_mesh_faces.
// userdata must be a BVHMeshCallbackUserdata built from the same mesh as the tree.
static void mesh_faces_nearest_point(void *userdata, int index, const float *co, BVHTreeNearest *nearest)
{
const BVHTreeFromMesh *data = (BVHTreeFromMesh*) userdata;
MVert *vert = data->vert;
MFace *face = data->face + index;
float *t0, *t1, *t2, *t3;
t0 = vert[ face->v1 ].co;
t1 = vert[ face->v2 ].co;
t2 = vert[ face->v3 ].co;
t3 = face->v4 ? vert[ face->v4].co : NULL;
do
{
float nearest_tmp[3], dist;
float vec[3][3];
// only insert valid triangles / quads with area > 0
VECSUB(vec[0], t2, t1);
VECSUB(vec[1], t0, t1);
Crossf(vec[2], vec[0], vec[1]);
if(INPR(vec[2], vec[2]) >= FLT_EPSILON)
{
dist = nearest_point_in_tri_surface(co,t0, t1, t2, nearest_tmp);
if(dist < nearest->dist)
{
nearest->index = index;
nearest->dist = dist;
VECCOPY(nearest->co, nearest_tmp);
CalcNormFloat((float*)t0, (float*)t1, (float*)t2, nearest->no); //TODO.. (interpolate normals from the vertexs coordinates?
}
}
t1 = t2;
t2 = t3;
t3 = NULL;
} while(t2);
}
// Callback to bvh tree raycast. The tree must bust have been built using bvhtree_from_mesh_faces.
// userdata must be a BVHMeshCallbackUserdata built from the same mesh as the tree.
static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit)
{
const BVHTreeFromMesh *data = (BVHTreeFromMesh*) userdata;
MVert *vert = data->vert;
MFace *face = data->face + index;
float *t0, *t1, *t2, *t3;
t0 = vert[ face->v1 ].co;
t1 = vert[ face->v2 ].co;
t2 = vert[ face->v3 ].co;
t3 = face->v4 ? vert[ face->v4].co : NULL;
do
{
float dist;
if(data->sphere_radius == 0.0f)
dist = ray_tri_intersection(ray, hit->dist, t0, t1, t2);
else
dist = sphereray_tri_intersection(ray, data->sphere_radius, hit->dist, t0, t1, t2);
if(dist >= 0 && dist < hit->dist)
{
hit->index = index;
hit->dist = dist;
VECADDFAC(hit->co, ray->origin, ray->direction, dist);
CalcNormFloat(t0, t1, t2, hit->no);
}
t1 = t2;
t2 = t3;
t3 = NULL;
} while(t2);
}
/*
* BVH builders
*/
// Builds a bvh tree.. where nodes are the vertexs of the given mesh
void bvhtree_from_mesh_verts(BVHTreeFromMesh *data, DerivedMesh *mesh, float epsilon, int tree_type, int axis)
{
int i;
int numVerts= mesh->getNumVerts(mesh);
MVert *vert = mesh->getVertDataArray(mesh, CD_MVERT);
BVHTree *tree = NULL;
memset(data, 0, sizeof(*data));
if(vert == NULL)
{
printf("bvhtree cant be build: cant get a vertex array");
return;
}
tree = BLI_bvhtree_new(numVerts, epsilon, tree_type, axis);
if(tree != NULL)
{
for(i = 0; i < numVerts; i++)
BLI_bvhtree_insert(tree, i, vert[i].co, 1);
BLI_bvhtree_balance(tree);
data->tree = tree;
//a NULL nearest callback works fine
//remeber the min distance to point is the same as the min distance to BV of point
data->nearest_callback = NULL;
data->raycast_callback = NULL;
data->mesh = mesh;
data->vert = mesh->getVertDataArray(mesh, CD_MVERT);
data->face = mesh->getFaceDataArray(mesh, CD_MFACE);
data->sphere_radius = epsilon;
}
}
// Builds a bvh tree.. where nodes are the faces of the given mesh.
void bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float epsilon, int tree_type, int axis)
{
int i;
int numFaces= mesh->getNumFaces(mesh);
MVert *vert = mesh->getVertDataArray(mesh, CD_MVERT);
MFace *face = mesh->getFaceDataArray(mesh, CD_MFACE);
BVHTree *tree = NULL;
memset(data, 0, sizeof(*data));
if(vert == NULL && face == NULL)
{
printf("bvhtree cant be build: cant get a vertex/face array");
return;
}
/* Create a bvh-tree of the given target */
tree = BLI_bvhtree_new(numFaces, epsilon, tree_type, axis);
if(tree != NULL)
{
for(i = 0; i < numFaces; i++)
{
float co[4][3];
VECCOPY(co[0], vert[ face[i].v1 ].co);
VECCOPY(co[1], vert[ face[i].v2 ].co);
VECCOPY(co[2], vert[ face[i].v3 ].co);
if(face[i].v4)
VECCOPY(co[3], vert[ face[i].v4 ].co);
BLI_bvhtree_insert(tree, i, co[0], face[i].v4 ? 4 : 3);
}
BLI_bvhtree_balance(tree);
data->tree = tree;
data->nearest_callback = mesh_faces_nearest_point;
data->raycast_callback = mesh_faces_spherecast;
data->mesh = mesh;
data->vert = mesh->getVertDataArray(mesh, CD_MVERT);
data->face = mesh->getFaceDataArray(mesh, CD_MFACE);
data->sphere_radius = epsilon;
}
}
// Frees data allocated by a call to bvhtree_from_mesh_*.
void free_bvhtree_from_mesh(struct BVHTreeFromMesh *data)
{
if(data->tree)
{
BLI_bvhtree_free(data->tree);
memset( data, 0, sizeof(data) );
}
}

@ -1291,116 +1291,6 @@ int cloth_collision_moving ( ClothModifierData *clmd, CollisionModifierData *col
return 1;
}
int cloth_do_selfcollisions(ClothModifierData * clmd)
{
int ret2 = 0, l;
Cloth *cloth = clmd->clothObject;
if ( clmd->clothObject->bvhselftree )
{
for(l = 0; l < clmd->coll_parms->self_loop_count; l++)
{
BVHTreeOverlap *overlap = NULL;
ClothVertex *verts = clmd->clothObject->verts; // needed for openMP
int k;
int ret = 0, result = 0;
// search for overlapping collision pairs
overlap = BLI_bvhtree_overlap ( cloth->bvhselftree, cloth->bvhselftree, &result );
// #pragma omp parallel for private(k, i, j) schedule(static)
for ( k = 0; k < result; k++ )
{
float temp[3];
float length = 0;
float mindistance;
int i, j;
i = overlap[k].indexA;
j = overlap[k].indexB;
mindistance = clmd->coll_parms->selfepsilon* ( cloth->verts[i].avg_spring_len + cloth->verts[j].avg_spring_len );
if ( clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL )
{
if ( ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED )
&& ( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED ) )
{
continue;
}
}
VECSUB ( temp, verts[i].tx, verts[j].tx );
if ( ( ABS ( temp[0] ) > mindistance ) || ( ABS ( temp[1] ) > mindistance ) || ( ABS ( temp[2] ) > mindistance ) ) continue;
// check for adjacent points (i must be smaller j)
if ( BLI_edgehash_haskey ( cloth->edgehash, MIN2(i, j), MAX2(i, j) ) )
{
continue;
}
length = Normalize ( temp );
if ( length < mindistance )
{
float correction = mindistance - length;
if ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED )
{
VecMulf ( temp, -correction );
VECADD ( verts[j].tx, verts[j].tx, temp );
}
else if ( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED )
{
VecMulf ( temp, correction );
VECADD ( verts[i].tx, verts[i].tx, temp );
}
else
{
VecMulf ( temp, -correction*0.5 );
VECADD ( verts[j].tx, verts[j].tx, temp );
VECSUB ( verts[i].tx, verts[i].tx, temp );
}
ret = 1;
ret2 += ret;
}
else
{
// check for approximated time collisions
}
}
if ( overlap )
MEM_freeN ( overlap );
if(!ret)
break;
}
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// SELFCOLLISIONS: update velocities
////////////////////////////////////////////////////////////
if ( ret2 )
{
int i;
ClothVertex *verts = clmd->clothObject->verts; // needed for openMP
for ( i = 0; i < cloth->numverts; i++ )
{
if ( ! ( verts [i].flags & CLOTH_VERT_FLAG_PINNED ) )
{
VECSUB ( verts[i].tv, verts[i].tx, verts[i].txold );
}
}
}
////////////////////////////////////////////////////////////
}
return ret2;
}
// return all collision objects in scene
// collision object will exclude self
@ -1547,7 +1437,7 @@ int cloth_bvh_objcollision ( Object *ob, ClothModifierData * clmd, float step, f
{
Cloth *cloth=NULL;
BVHTree *cloth_bvh=NULL;
int i=0, numfaces = 0, numverts = 0;
int i=0, numfaces = 0, numverts = 0, k, l, j;
int rounds = 0; // result counts applied collisions; ic is for debug output;
ClothVertex *verts = NULL;
int ret = 0, ret2 = 0;
@ -1647,21 +1537,122 @@ int cloth_bvh_objcollision ( Object *ob, ClothModifierData * clmd, float step, f
VECADD ( verts[i].tx, verts[i].txold, verts[i].tv );
}
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// Test on *simple* selfcollisions
////////////////////////////////////////////////////////////
if ( clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_SELF )
{
ret2 += cloth_do_selfcollisions(clmd);
for(l = 0; l < clmd->coll_parms->self_loop_count; l++)
{
// TODO: add coll quality rounds again
BVHTreeOverlap *overlap = NULL;
int result = 0;
// collisions = 1;
verts = cloth->verts; // needed for openMP
numfaces = clmd->clothObject->numfaces;
numverts = clmd->clothObject->numverts;
verts = cloth->verts;
if ( cloth->bvhselftree )
{
// search for overlapping collision pairs
overlap = BLI_bvhtree_overlap ( cloth->bvhselftree, cloth->bvhselftree, &result );
// #pragma omp parallel for private(k, i, j) schedule(static)
for ( k = 0; k < result; k++ )
{
float temp[3];
float length = 0;
float mindistance;
i = overlap[k].indexA;
j = overlap[k].indexB;
mindistance = clmd->coll_parms->selfepsilon* ( cloth->verts[i].avg_spring_len + cloth->verts[j].avg_spring_len );
if ( clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL )
{
if ( ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED )
&& ( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED ) )
{
continue;
}
}
VECSUB ( temp, verts[i].tx, verts[j].tx );
if ( ( ABS ( temp[0] ) > mindistance ) || ( ABS ( temp[1] ) > mindistance ) || ( ABS ( temp[2] ) > mindistance ) ) continue;
// check for adjacent points (i must be smaller j)
if ( BLI_edgehash_haskey ( cloth->edgehash, MIN2(i, j), MAX2(i, j) ) )
{
continue;
}
length = Normalize ( temp );
if ( length < mindistance )
{
float correction = mindistance - length;
if ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED )
{
VecMulf ( temp, -correction );
VECADD ( verts[j].tx, verts[j].tx, temp );
}
else if ( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED )
{
VecMulf ( temp, correction );
VECADD ( verts[i].tx, verts[i].tx, temp );
}
else
{
VecMulf ( temp, -correction*0.5 );
VECADD ( verts[j].tx, verts[j].tx, temp );
VECSUB ( verts[i].tx, verts[i].tx, temp );
}
ret = 1;
ret2 += ret;
}
else
{
// check for approximated time collisions
}
}
if ( overlap )
MEM_freeN ( overlap );
}
}
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// SELFCOLLISIONS: update velocities
////////////////////////////////////////////////////////////
if ( ret2 )
{
for ( i = 0; i < cloth->numverts; i++ )
{
if ( ! ( verts [i].flags & CLOTH_VERT_FLAG_PINNED ) )
{
VECSUB ( verts[i].tv, verts[i].tx, verts[i].txold );
}
}
}
////////////////////////////////////////////////////////////
}
////////////////////////////////////////////////////////////
}
while ( ret2 && ( clmd->coll_parms->loop_count>rounds ) );
if(collobjs)
+ MEM_freeN(collobjs);
MEM_freeN(collobjs);
return MIN2 ( ret, 1 );
}

@ -265,14 +265,34 @@ static void layerSwap_tface(void *data, int *corner_indices)
{
MTFace *tf = data;
float uv[4][2];
const static short pin_flags[4] =
{ TF_PIN1, TF_PIN2, TF_PIN3, TF_PIN4 };
const static char sel_flags[4] =
{ TF_SEL1, TF_SEL2, TF_SEL3, TF_SEL4 };
short unwrap = tf->unwrap & ~(TF_PIN1 | TF_PIN2 | TF_PIN3 | TF_PIN4);
char flag = tf->flag & ~(TF_SEL1 | TF_SEL2 | TF_SEL3 | TF_SEL4);
int j;
for(j = 0; j < 4; ++j) {
uv[j][0] = tf->uv[corner_indices[j]][0];
uv[j][1] = tf->uv[corner_indices[j]][1];
int source_index = corner_indices[j];
uv[j][0] = tf->uv[source_index][0];
uv[j][1] = tf->uv[source_index][1];
// swap pinning flags around
if(tf->unwrap & pin_flags[source_index]) {
unwrap |= pin_flags[j];
}
// swap selection flags around
if(tf->flag & sel_flags[source_index]) {
flag |= sel_flags[j];
}
}
memcpy(tf->uv, uv, sizeof(tf->uv));
tf->unwrap = unwrap;
tf->flag = flag;
}
static void layerDefault_tface(void *data, int count)

@ -97,6 +97,7 @@
#include "BKE_material.h"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
#include "BKE_texture.h"
#include "BKE_utildefines.h"
#include "depsgraph_private.h"
#include "BKE_bmesh.h"
@ -1130,8 +1131,18 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
mface[numFaces].v1 = vert_map[mface[numFaces].v1];
mface[numFaces].v2 = vert_map[mface[numFaces].v2];
mface[numFaces].v3 = vert_map[mface[numFaces].v3];
if(mface[numFaces].v4)
if(mface[numFaces].v4) {
mface[numFaces].v4 = vert_map[mface[numFaces].v4];
test_index_face(&mface[numFaces], &result->faceData,
numFaces, 4);
}
else
{
test_index_face(&mface[numFaces], &result->faceData,
numFaces, 3);
}
origindex[numFaces] = ORIGINDEX_NONE;
numFaces++;
@ -1221,8 +1232,17 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
mface[numFaces].v1 = vert_map[mface[numFaces].v1];
mface[numFaces].v2 = vert_map[mface[numFaces].v2];
mface[numFaces].v3 = vert_map[mface[numFaces].v3];
if(mface[numFaces].v4)
if(mface[numFaces].v4) {
mface[numFaces].v4 = vert_map[mface[numFaces].v4];
test_index_face(&mface[numFaces], &result->faceData,
numFaces, 4);
}
else
{
test_index_face(&mface[numFaces], &result->faceData,
numFaces, 3);
}
origindex[numFaces] = ORIGINDEX_NONE;
numFaces++;
@ -2980,6 +3000,20 @@ CustomDataMask displaceModifier_requiredDataMask(ModifierData *md)
return dataMask;
}
static int displaceModifier_dependsOnTime(ModifierData *md)
{
DisplaceModifierData *dmd = (DisplaceModifierData *)md;
if(dmd->texture)
{
return BKE_texture_dependsOnTime(dmd->texture);
}
else
{
return 0;
}
}
static void displaceModifier_foreachObjectLink(ModifierData *md, Object *ob,
ObjectWalkFunc walk, void *userData)
{
@ -7335,6 +7369,7 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type)
mti->initData = displaceModifier_initData;
mti->copyData = displaceModifier_copyData;
mti->requiredDataMask = displaceModifier_requiredDataMask;
mti->dependsOnTime = displaceModifier_dependsOnTime;
mti->foreachObjectLink = displaceModifier_foreachObjectLink;
mti->foreachIDLink = displaceModifier_foreachIDLink;
mti->updateDepgraph = displaceModifier_updateDepgraph;

@ -3744,6 +3744,9 @@ int psys_get_particle_state(Object *ob, ParticleSystem *psys, int p, ParticleKey
/* TODO: pa_clump vgroup */
do_clump(state,key1,t,part->clumpfac,part->clumppow,1.0);
if(psys->lattice)
calc_latt_deform(state->co,1.0f);
}
else{
if (pa) { /* TODO PARTICLE - should this ever be NULL? - Campbell */

@ -4653,7 +4653,7 @@ static void system_step(Object *ob, ParticleSystem *psys, ParticleSystemModifier
PTCacheID pid;
int totpart, oldtotpart, totchild, oldtotchild, p;
float disp, *vg_vel= 0, *vg_tan= 0, *vg_rot= 0, *vg_size= 0;
int init= 0, distr= 0, alloc= 0, usecache= 0;
int init= 0, distr= 0, alloc= 0, usecache= 0, only_children_changed= 0;
int framenr, framedelta, startframe, endframe;
part= psys->part;
@ -4720,6 +4720,7 @@ static void system_step(Object *ob, ParticleSystem *psys, ParticleSystemModifier
totchild = get_psys_tot_child(psys);
if(oldtotpart != totpart || (psys->part->childtype && oldtotchild != totchild)) {
only_children_changed = (oldtotpart == totpart);
realloc_particles(ob, psys, totpart);
alloc = 1;
distr= 1;
@ -4740,14 +4741,17 @@ static void system_step(Object *ob, ParticleSystem *psys, ParticleSystemModifier
if((psys->part->type == PART_HAIR) && !(psys->flag & PSYS_HAIR_DONE))
/* don't generate children while growing hair - waste of time */
psys_free_children(psys);
else if(get_psys_tot_child(psys))
distribute_particles(ob, psys, PART_FROM_CHILD);
psys_free_children(psys);
else if(get_psys_tot_child(psys))
distribute_particles(ob, psys, PART_FROM_CHILD);
}
initialize_all_particles(ob, psys, psmd);
if(alloc)
reset_all_particles(ob, psys, psmd, 0.0, cfra, oldtotpart);
if(only_children_changed==0) {
initialize_all_particles(ob, psys, psmd);
if(alloc)
reset_all_particles(ob, psys, psmd, 0.0, cfra, oldtotpart);
}
/* flag for possible explode modifiers after this system */
psmd->flag |= eParticleSystemFlag_Pars;

@ -545,6 +545,8 @@ Tex *copy_texture(Tex *tex)
if(texn->type==TEX_IMAGE) id_us_plus((ID *)texn->ima);
else texn->ima= 0;
id_us_plus((ID *)texn->ipo);
if(texn->plugin) {
texn->plugin= MEM_dupallocN(texn->plugin);
open_plugin_tex(texn->plugin);
@ -845,3 +847,19 @@ void BKE_free_envmap(EnvMap *env)
}
/* ------------------------------------------------------------------------- */
int BKE_texture_dependsOnTime(const struct Tex *texture)
{
if(texture->plugin) {
// assume all plugins depend on time
return 1;
} else if( texture->ima &&
ELEM(texture->ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
return 1;
} else if(texture->ipo) {
// assume any ipo means the texture is animated
return 1;
}
return 0;
}
/* ------------------------------------------------------------------------- */

@ -1,4 +1,6 @@
/**
*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@ -40,6 +42,35 @@ typedef struct BVHTreeOverlap {
int indexB;
} BVHTreeOverlap;
typedef struct BVHTreeNearest
{
int index; /* the index of the nearest found (untouched if none is found within a dist radius from the given coordinates) */
float co[3]; /* nearest coordinates (untouched it none is found within a dist radius from the given coordinates) */
float no[3]; /* normal at nearest coordinates (untouched it none is found within a dist radius from the given coordinates) */
float dist; /* squared distance to search arround */
} BVHTreeNearest;
typedef struct BVHTreeRay
{
float origin[3]; /* ray origin */
float direction[3]; /* ray direction */
} BVHTreeRay;
typedef struct BVHTreeRayHit
{
int index; /* index of the tree node (untouched if no hit is found) */
float co[3]; /* coordinates of the hit point */
float no[3]; /* normal on hit point */
float dist; /* distance to the hit point */
} BVHTreeRayHit;
/* callback must update nearest in case it finds a nearest result */
typedef void (*BVHTree_NearestPointCallback) (void *userdata, int index, const float *co, BVHTreeNearest *nearest);
/* callback must update hit in case it finds a nearest successful hit */
typedef void (*BVHTree_RayCastCallback) (void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit);
BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis);
void BLI_bvhtree_free(BVHTree *tree);
@ -56,5 +87,10 @@ BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, int *result)
float BLI_bvhtree_getepsilon(BVHTree *tree);
/* find nearest node to the given coordinates (if nearest is given it will only search nodes where square distance is smaller than nearest->dist) */
int BLI_bvhtree_find_nearest(BVHTree *tree, const float *co, BVHTreeNearest *nearest, BVHTree_NearestPointCallback callback, void *userdata);
int BLI_bvhtree_ray_cast(BVHTree *tree, const float *co, const float *dir, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata);
#endif // BLI_KDOPBVH_H

File diff suppressed because it is too large Load Diff

@ -42,6 +42,8 @@
#define TRF 2
#define TLF 4
#define BRF 8
#define CORNERFLAGS (BLF|TRF|TLF|BRF)
#define BL 0
#define TR 1
#define TL 2
@ -159,7 +161,7 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height)
vert->blb = vert->brb = vert->tlb =\
vert->isect_cache[0] = vert->isect_cache[1] =\
vert->isect_cache[2] = vert->isect_cache[3] = NULL;
vert->free = 15 &~ TRF;
vert->free = CORNERFLAGS &~ TRF;
vert->trb = box;
vert->index = i; i++;
box->v[BL] = vert; vert++;
@ -167,7 +169,7 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height)
vert->trb= vert->brb = vert->tlb =\
vert->isect_cache[0] = vert->isect_cache[1] =\
vert->isect_cache[2] = vert->isect_cache[3] = NULL;
vert->free = 15 &~ BLF;
vert->free = CORNERFLAGS &~ BLF;
vert->blb = box;
vert->index = i; i++;
box->v[TR] = vert; vert++;
@ -175,7 +177,7 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height)
vert->trb = vert->blb = vert->tlb =\
vert->isect_cache[0] = vert->isect_cache[1] =\
vert->isect_cache[2] = vert->isect_cache[3] = NULL;
vert->free = 15 &~ BRF;
vert->free = CORNERFLAGS &~ BRF;
vert->brb = box;
vert->index = i; i++;
box->v[TL] = vert; vert++;
@ -183,7 +185,7 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height)
vert->trb = vert->blb = vert->brb =\
vert->isect_cache[0] = vert->isect_cache[1] =\
vert->isect_cache[2] = vert->isect_cache[3] = NULL;
vert->free = 15 &~ TLF;
vert->free = CORNERFLAGS &~ TLF;
vert->tlb = box;
vert->index = i; i++;
box->v[BR] = vert; vert++;

@ -612,6 +612,7 @@ static int startffmpeg(struct anim * anim) {
av_free(anim->pFrameRGB);
av_free(anim->pFrameDeinterlaced);
av_free(anim->pFrame);
anim->pCodecCtx = NULL;
return -1;
}
@ -639,7 +640,19 @@ static int startffmpeg(struct anim * anim) {
PIX_FMT_BGR32,
SWS_FAST_BILINEAR | SWS_PRINT_INFO,
NULL, NULL, NULL);
if (!anim->img_convert_ctx) {
fprintf (stderr,
"Can't transform color space??? Bailing out...\n");
avcodec_close(anim->pCodecCtx);
av_close_input_file(anim->pFormatCtx);
av_free(anim->pFrameRGB);
av_free(anim->pFrameDeinterlaced);
av_free(anim->pFrame);
anim->pCodecCtx = NULL;
return -1;
}
return (0);
}

@ -108,7 +108,8 @@ void mouse_armature(void);
void remake_editArmature(void);
void selectconnected_armature(void);
void selectconnected_posearmature(void);
void select_bone_parent(void);
void armature_select_hierarchy(short direction, short add_to_sel);
void setflag_armature(short mode);
void unique_editbone_name (struct ListBase *ebones, char *name);
@ -143,6 +144,10 @@ void set_locks_armature_bones(short lock);
#define BONESEL_NOSEL 0x80000000 /* Indicates a negative number */
/* used in bone_select_hierachy() */
#define BONE_SELECT_PARENT 0
#define BONE_SELECT_CHILD 1
#endif

@ -132,7 +132,7 @@ extern int EM_check_backbuf(unsigned int index);
extern void EM_free_backbuf(void);
extern void EM_selectmode_menu(void);
extern void EM_mesh_copy_face(short type);
extern void vertexnoise(void);
extern void vertexsmooth(void);

@ -65,6 +65,8 @@ void pose_assign_to_posegroup(short active);
void pose_remove_from_posegroups(void);
void pgroup_operation_with_menu(void);
void pose_select_hierarchy(short direction, short add_to_sel);
void pose_select_grouped(short nr);
void pose_select_grouped_menu(void);

@ -593,7 +593,7 @@ void curvemap_buttons(struct uiBlock *block, struct CurveMapping *cumap, char la
#define B_VPCOLSLI 2801
#define B_VPGAMMA 2802
#define B_COPY_TF_TRANSP 2803
#define B_COPY_TF_MODE 2804
#define B_COPY_TF_UV 2805
#define B_COPY_TF_COL 2806

@ -160,11 +160,10 @@ ScriptError g_script_error;
* Function prototypes
***************************************************************************/
PyObject *RunPython( Text * text, PyObject * globaldict );
char *GetName( Text * text );
PyObject *CreateGlobalDictionary( void );
void ReleaseGlobalDictionary( PyObject * dict );
void DoAllScriptsFromList( ListBase * list, short event );
PyObject *importText( char *name );
static PyObject *importText( char *name );
void init_ourImport( void );
void init_ourReload( void );
PyObject *blender_import( PyObject * self, PyObject * args );
@ -651,7 +650,7 @@ int BPY_txt_do_python_Text( struct Text *text )
}
/* Create a new script structure and initialize it: */
script = alloc_libblock( &G.main->script, ID_SCRIPT, GetName( text ) );
script = alloc_libblock( &G.main->script, ID_SCRIPT, text->id.name+2 );
if( !script ) {
printf( "couldn't allocate memory for Script struct!" );
@ -662,8 +661,7 @@ int BPY_txt_do_python_Text( struct Text *text )
* an error after it will call BPY_Err_Handle below, but the text struct
* will have been deallocated already, so we need to copy its name here.
*/
BLI_strncpy( textname, GetName( text ),
strlen( GetName( text ) ) + 1 );
BLI_strncpy( textname, text->id.name+2, 21 );
script->id.us = 1;
script->flags = SCRIPT_RUNNING;
@ -1135,12 +1133,10 @@ int BPY_menu_invoke( BPyMenu *pym, short menutype )
*****************************************************************************/
void BPY_free_compiled_text( struct Text *text )
{
if( !text->compiled )
return;
Py_DECREF( ( PyObject * ) text->compiled );
text->compiled = NULL;
return;
if( text->compiled ) {
Py_DECREF( ( PyObject * ) text->compiled );
text->compiled = NULL;
}
}
/*****************************************************************************
@ -2753,8 +2749,7 @@ PyObject *RunPython( Text * text, PyObject * globaldict )
buf = txt_to_buf( text );
text->compiled =
Py_CompileString( buf, GetName( text ),
Py_file_input );
Py_CompileString( buf, text->id.name+2, Py_file_input );
MEM_freeN( buf );
@ -2768,15 +2763,6 @@ PyObject *RunPython( Text * text, PyObject * globaldict )
return PyEval_EvalCode( text->compiled, globaldict, globaldict );
}
/*****************************************************************************
* Description: This function returns the value of the name field of the
* given Text struct.
*****************************************************************************/
char *GetName( Text * text )
{
return ( text->id.name + 2 );
}
/*****************************************************************************
* Description: This function creates a new Python dictionary object.
*****************************************************************************/
@ -2821,49 +2807,38 @@ void DoAllScriptsFromList( ListBase * list, short event )
return;
}
PyObject *importText( char *name )
static PyObject *importText( char *name )
{
Text *text;
char *txtname;
char txtname[22]; /* 21+NULL */
char *buf = NULL;
int namelen = strlen( name );
txtname = malloc( namelen + 3 + 1 );
if( !txtname )
return NULL;
if (namelen>21-3) return NULL; /* we know this cant be importable, the name is too long for blender! */
memcpy( txtname, name, namelen );
memcpy( &txtname[namelen], ".py", 4 );
text = ( Text * ) & ( G.main->text.first );
while( text ) {
if( !strcmp( txtname, GetName( text ) ) )
for(text = G.main->text.first; text; text = text->id.next) {
if( !strcmp( txtname, text->id.name+2 ) )
break;
text = text->id.next;
}
if( !text ) {
free( txtname );
if( !text )
return NULL;
}
if( !text->compiled ) {
buf = txt_to_buf( text );
text->compiled =
Py_CompileString( buf, GetName( text ),
Py_file_input );
text->compiled = Py_CompileString( buf, text->id.name+2, Py_file_input );
MEM_freeN( buf );
if( PyErr_Occurred( ) ) {
PyErr_Print( );
BPY_free_compiled_text( text );
free( txtname );
return NULL;
}
}
free( txtname );
return PyImport_ExecCodeModule( name, text->compiled );
}
@ -2934,7 +2909,7 @@ static PyObject *reimportText( PyObject *module )
/* look up the text object */
text = ( Text * ) & ( G.main->text.first );
while( text ) {
if( !strcmp( txtname, GetName( text ) ) )
if( !strcmp( txtname, text->id.name+2 ) )
break;
text = text->id.next;
}
@ -2951,8 +2926,7 @@ static PyObject *reimportText( PyObject *module )
/* compile the buffer */
buf = txt_to_buf( text );
text->compiled = Py_CompileString( buf, GetName( text ),
Py_file_input );
text->compiled = Py_CompileString( buf, text->id.name+2, Py_file_input );
MEM_freeN( buf );
/* if compile failed.... return this error */

@ -1074,7 +1074,7 @@ void M_Blender_Init(void)
PyDict_SetItemString(dict, "Material", Material_Init());
PyDict_SetItemString(dict, "Mesh", Mesh_Init());
PyDict_SetItemString(dict, "Metaball", Metaball_Init());
PyDict_SetItemString(dict, "Mathutils", Mathutils_Init());
PyDict_SetItemString(dict, "Mathutils", Mathutils_Init("Blender.Mathutils"));
PyDict_SetItemString(dict, "Geometry", Geometry_Init());
PyDict_SetItemString(dict, "Modifier", Modifier_Init());
PyDict_SetItemString(dict, "NMesh", NMesh_Init());

@ -29,6 +29,7 @@
#include "Constraint.h" /*This must come first*/
#include "DNA_armature_types.h"
#include "DNA_object_types.h"
#include "DNA_effect_types.h"
#include "DNA_vec_types.h"
@ -43,6 +44,7 @@
#include "BKE_constraint.h"
#include "BLI_blenlib.h"
#include "BIF_editconstraint.h"
#include "BIF_poseobject.h"
#include "BSE_editipo.h"
#include "MEM_guardedalloc.h"
#include "butspace.h"
@ -2286,19 +2288,32 @@ static PyObject *ConstraintSeq_moveDown( BPy_ConstraintSeq *self, BPy_Constraint
static PyObject *ConstraintSeq_remove( BPy_ConstraintSeq *self, BPy_Constraint *value )
{
bConstraint *con = locate_constr( self, value );
bConstraint *con = locate_constr(self, value);
bPoseChannel *active= NULL;
/* if we can't locate the constraint, return (exception already set) */
if( !con )
if (!con)
return (PyObject *)NULL;
/* do the actual removal */
if( self->pchan )
BLI_remlink( &self->pchan->constraints, con );
else
BLI_remlink( &self->obj->constraints, con);
/* check if we need to set temporary 'active' flag for pchan */
if (self->pchan) {
active= get_active_posechannel(self->obj);
if (active != self->pchan) {
if (active) active->bone->flag &= ~BONE_ACTIVE;
self->pchan->bone->flag |= BONE_ACTIVE;
}
}
/* del_constr_func() frees constraint + its data */
del_constr_func( self->obj, con );
/* reset active pchan (if applicable) */
if (self->pchan && self->pchan!=active) {
if (active) active->bone->flag |= BONE_ACTIVE;
self->pchan->bone->flag &= ~BONE_ACTIVE;
}
/* erase the link to the constraint */
value->con = NULL;

@ -131,11 +131,11 @@
#define EXPP_MAT_RAYMIRRGLOSS_MIN 0.0
#define EXPP_MAT_RAYMIRRGLOSS_MAX 1.0
#define EXPP_MAT_RAYMIRRGLOSSSAMPLES_MIN 0
#define EXPP_MAT_RAYMIRRGLOSSSAMPLES_MAX 255
#define EXPP_MAT_RAYMIRRGLOSSSAMPLES_MAX 1024
#define EXPP_MAT_RAYTRANSPGLOSS_MIN 0.0
#define EXPP_MAT_RAYTRANSPGLOSS_MAX 1.0
#define EXPP_MAT_RAYTRANSPGLOSSSAMPLES_MIN 0
#define EXPP_MAT_RAYTRANSPGLOSSSAMPLES_MAX 255
#define EXPP_MAT_RAYTRANSPGLOSSSAMPLES_MAX 1024
#define EXPP_MAT_FILTER_MIN 0.0
#define EXPP_MAT_FILTER_MAX 1.0
#define EXPP_MAT_TRANSLUCENCY_MIN 0.0
@ -738,8 +738,10 @@ static PyMethodDef BPy_Material_methods[] = {
"() - Return fresnel power for refractions factor"},
{"getRayTransGloss", ( PyCFunction ) Material_getGlossTrans, METH_NOARGS,
"() - Return amount refraction glossiness"},
{"getRayTransGlossSamples", ( PyCFunction ) Material_getGlossTransSamples, METH_NOARGS,
"() - Return number of sampels for transparent glossiness"},
{"getRayMirrGlossSamples", ( PyCFunction ) Material_getGlossMirrSamples, METH_NOARGS,
"() - Return amount mirror glossiness"},
"() - Return number of sampels for mirror glossiness"},
{"getFilter", ( PyCFunction ) Material_getFilter, METH_NOARGS,
"() - Return the amount of filtering when transparent raytrace is enabled"},
{"getTranslucency", ( PyCFunction ) Material_getTranslucency, METH_NOARGS,
@ -847,8 +849,10 @@ static PyMethodDef BPy_Material_methods[] = {
"(f) - Set blend fac for mirror fresnel - [1.0, 5.0]"},
{"setRayTransGloss", ( PyCFunction ) Material_setGlossTrans, METH_VARARGS,
"(f) - Set amount refraction glossiness - [0.0, 1.0]"},
{"setRayTransGlossSamples", ( PyCFunction ) Material_setGlossTransSamples, METH_VARARGS,
"(i) - Set number transparent gloss samples - [1, 1024]"},
{"setRayMirrGlossSamples", ( PyCFunction ) Material_setGlossMirrSamples, METH_VARARGS,
"(f) - Set amount mirror glossiness - [0.0, 1.0]"},
"(i) - Set number mirror gloss samples - [1, 1024]"},
{"setFilter", ( PyCFunction ) Matr_oldsetFilter, METH_VARARGS,
"(f) - Set the amount of filtering when transparent raytrace is enabled"},
{"setTranslucency", ( PyCFunction ) Matr_oldsetTranslucency, METH_VARARGS,

@ -106,8 +106,9 @@ struct PyMethodDef M_Mathutils_methods[] = {
{"Point", (PyCFunction) M_Mathutils_Point, METH_VARARGS, M_Mathutils_Point_doc},
{NULL, NULL, 0, NULL}
};
//----------------------------MODULE INIT-------------------------
PyObject *Mathutils_Init(void)
/*----------------------------MODULE INIT-------------------------*/
/* from can be Blender.Mathutils or GameLogic.Mathutils for the BGE */
PyObject *Mathutils_Init(char *from)
{
PyObject *submodule;
@ -125,8 +126,7 @@ PyObject *Mathutils_Init(void)
if( PyType_Ready( &quaternion_Type ) < 0 )
return NULL;
submodule = Py_InitModule3("Blender.Mathutils",
M_Mathutils_methods, M_Mathutils_doc);
submodule = Py_InitModule3(from, M_Mathutils_methods, M_Mathutils_doc);
return (submodule);
}
//-----------------------------METHODS----------------------------

@ -38,7 +38,7 @@
#include "euler.h"
#include "point.h"
PyObject *Mathutils_Init( void );
PyObject *Mathutils_Init( char * from );
PyObject *row_vector_multiplication(VectorObject* vec, MatrixObject * mat);
PyObject *column_vector_multiplication(MatrixObject * mat, VectorObject* vec);
PyObject *row_point_multiplication(PointObject* pt, MatrixObject * mat);

@ -772,7 +772,7 @@ class RenderData:
"""
Get/set the starting frame for sequence rendering.
@type frame: int (optional)
@param frame: must be between 1 - 18000
@param frame: must be a valid Blender frame number.
@rtype: int (if prototype is empty)
@return: Current starting frame for the scene.
"""
@ -781,7 +781,7 @@ class RenderData:
"""
Get/set the ending frame for sequence rendering.
@type frame: int (optional)
@param frame: must be between 1 - 18000
@param frame: must be a valid Blender frame number.
@rtype: int (if prototype is empty)
@return: Current ending frame for the scene.
"""

@ -1865,9 +1865,17 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
num= cpa->num;
/* get orco */
psys_particle_on_emitter(ob, psmd,
(part->childtype == PART_CHILD_FACES)? PART_FROM_FACE: PART_FROM_PARTICLE,
cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,co,nor,0,0,orco,0);
if(part->childtype == PART_CHILD_FACES) {
psys_particle_on_emitter(ob, psmd,
PART_FROM_FACE, cpa->num,DMCACHE_ISCHILD,
cpa->fuv,cpa->foffset,co,nor,0,0,orco,0);
}
else {
ParticleData *par = psys->particles + cpa->parent;
psys_particle_on_emitter(ob, psmd, part->from,
par->num,DMCACHE_ISCHILD,par->fuv,
par->foffset,co,nor,0,0,orco,0);
}
if(uvco){
if(part->from!=PART_FROM_PARTICLE && part->childtype==PART_CHILD_FACES){

@ -5671,13 +5671,9 @@ void sculptmode_draw_interface_textures(uiBlock *block, unsigned short cx, unsig
void do_fpaintbuts(unsigned short event)
{
Mesh *me;
Object *ob;
bDeformGroup *defGroup;
MTFace *activetf, *tf;
MFace *mf;
MCol *activemcol;
int a;
MTFace *activetf;
SculptData *sd= &G.scene->sculptdata;
ID *id, *idtest;
extern VPaint Gwp; /* from vpaint */
@ -5695,45 +5691,19 @@ void do_fpaintbuts(unsigned short event)
vpaint_dogamma();
break;
case B_COPY_TF_MODE:
EM_mesh_copy_face(4); /* todo, get rid of magic numbers */
break;
case B_COPY_TF_TRANSP:
EM_mesh_copy_face(5);
break;
case B_COPY_TF_UV:
EM_mesh_copy_face(3);
break;
case B_COPY_TF_COL:
EM_mesh_copy_face(6);
break;
case B_COPY_TF_TEX:
me= get_mesh(OBACT);
activetf= get_active_mtface(NULL, &activemcol, 0);
if(me && activetf) {
for (a=0, tf=me->mtface, mf=me->mface; a < me->totface; a++, tf++, mf++) {
if(tf!=activetf && (mf->flag & ME_FACE_SEL)) {
if(event==B_COPY_TF_MODE) {
tf->mode= activetf->mode;
tf->transp= activetf->transp;
}
else if(event==B_COPY_TF_UV) {
memcpy(tf->uv, activetf->uv, sizeof(tf->uv));
tf->tpage= activetf->tpage;
tf->tile= activetf->tile;
if(activetf->mode & TF_TILES) tf->mode |= TF_TILES;
else tf->mode &= ~TF_TILES;
}
else if(event==B_COPY_TF_TEX) {
tf->tpage= activetf->tpage;
tf->tile= activetf->tile;
if(activetf->mode & TF_TILES) tf->mode |= TF_TILES;
else tf->mode &= ~TF_TILES;
}
else if(event==B_COPY_TF_COL && activemcol)
memcpy(&me->mcol[a*4], activemcol, sizeof(MCol)*4);
}
}
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
do_shared_vertexcol(me);
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWIMAGE, 0);
}
EM_mesh_copy_face(2);
break;
case B_SET_VCOL:
if(FACESEL_PAINT_TEST)
@ -6170,8 +6140,20 @@ static void editing_panel_mesh_texface(void)
if(uiNewPanel(curarea, block, "Texture Face", "Editing", 960, 0, 318, 204)==0) return;
tf = get_active_mtface(NULL, NULL, 0);
if(tf) {
uiDefBut(block, LABEL, B_NOP, "Active Face Mode", 600,185,300,19, NULL, 0.0, 0.0, 0, 0, "Face mode its used for TexFace display and the game engine ");
uiDefBut(block, BUT,B_COPY_TF_MODE, "Copy", 850,185,50,19, 0, 0, 0, 0, 0, "Copy active faces mode to other selected (View3D Ctrl+C)");
/* Other copy buttons, layout isnt that nice */
uiBlockBeginAlign(block);
uiDefBut(block, BUT,B_COPY_TF_UV, "CopyUV", 600,15,100,19, 0, 0, 0, 0, 0, "Copy active faces UVs to other selected (View3D Ctrl+C)");
uiDefBut(block, BUT,B_COPY_TF_TEX, "CopyTex", 700,15,100,19, 0, 0, 0, 0, 0, "Copy active faces Texture to other selected (View3D Ctrl+C)");
uiDefBut(block, BUT,B_COPY_TF_COL, "CopyColor", 800,15,100,19, 0, 0, 0, 0, 0, "Copy active faces Color to other selected (View3D Ctrl+C)");
uiBlockEndAlign(block);
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, TF_TEX, B_REDR_3D_IMA, "Tex", 600,160,60,19, &tf->mode, 0, 0, 0, 0, "Render face with texture");
uiDefButBitS(block, TOG, TF_TILES, B_REDR_3D_IMA, "Tiles", 660,160,60,19, &tf->mode, 0, 0, 0, 0, "Use tilemode for face");
uiDefButBitS(block, TOG, TF_LIGHT, REDRAWVIEW3D, "Light", 720,160,60,19, &tf->mode, 0, 0, 0, 0, "Use light for face");
@ -6182,24 +6164,30 @@ static void editing_panel_mesh_texface(void)
uiDefButBitS(block, TOG, TF_SHAREDCOL, REDRAWVIEW3D, "Shared", 600,135,60,19, &tf->mode, 0, 0, 0, 0, "Blend vertex colors across face when vertices are shared");
uiDefButBitS(block, TOG, TF_TWOSIDE, REDRAWVIEW3D, "Twoside",660,135,60,19, &tf->mode, 0, 0, 0, 0, "Render face twosided");
uiDefButBitS(block, TOG, TF_OBCOL, REDRAWVIEW3D, "ObColor",720,135,60,19, &tf->mode, 0, 0, 0, 0, "Use ObColor instead of vertex colors");
uiBlockBeginAlign(block);
uiBlockEndAlign(block);
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, TF_BILLBOARD, B_TFACE_HALO, "Halo", 600,110,60,19, &tf->mode, 0, 0, 0, 0, "Screen aligned billboard");
uiDefButBitS(block, TOG, TF_BILLBOARD2, B_TFACE_BILLB, "Billboard",660,110,60,19, &tf->mode, 0, 0, 0, 0, "Billboard with Z-axis constraint");
uiDefButBitS(block, TOG, TF_SHADOW, REDRAWVIEW3D, "Shadow", 720,110,60,19, &tf->mode, 0, 0, 0, 0, "Face is used for shadow");
uiDefButBitS(block, TOG, TF_BMFONT, REDRAWVIEW3D, "Text", 780,110,60,19, &tf->mode, 0, 0, 0, 0, "Enable bitmap text on face");
uiDefButBitS(block, TOG, TF_ALPHASORT, REDRAWVIEW3D, "Sort", 840,110,60,19, &tf->mode, 0, 0, 0, 0, "Enable sorting of faces for correct alpha drawing (slow, use Clip Alpha instead when possible)");
uiBlockEndAlign(block);
uiDefBut(block, LABEL, B_NOP, "Active Face Alpha Blending (Transp)", 600,75,300,19, NULL, 0.0, 0.0, 0, 0, "Face mode its used for TexFace display and the game engine");
uiDefBut(block, BUT,B_COPY_TF_TRANSP, "Copy", 850,75,50,19, 0, 0, 0, 0, 0, "Copy active faces transp to other selected (View3D Ctrl+C)");
uiBlockBeginAlign(block);
uiBlockSetCol(block, TH_BUT_SETTING1);
uiDefButC(block, ROW, REDRAWVIEW3D, "Opaque", 600,80,60,19, &tf->transp, 2.0, (float)TF_SOLID,0, 0, "Render color of textured face as color");
uiDefButC(block, ROW, REDRAWVIEW3D, "Add", 660,80,60,19, &tf->transp, 2.0, (float)TF_ADD, 0, 0, "Render face transparent and add color of face");
uiDefButC(block, ROW, REDRAWVIEW3D, "Alpha", 720,80,60,19, &tf->transp, 2.0, (float)TF_ALPHA,0, 0, "Render polygon transparent, depending on alpha channel of the texture");
uiDefButC(block, ROW, REDRAWVIEW3D, "Clip Alpha", 780,80,80,19, &tf->transp, 2.0, (float)TF_CLIP,0, 0, "Use the images alpha values clipped with no blending (binary alpha)");
}
else
uiDefButC(block, ROW, REDRAWVIEW3D, "Opaque", 600,50,60,19, &tf->transp, 2.0, (float)TF_SOLID,0, 0, "Render color of textured face as color");
uiDefButC(block, ROW, REDRAWVIEW3D, "Add", 660,50,60,19, &tf->transp, 2.0, (float)TF_ADD, 0, 0, "Render face transparent and add color of face");
uiDefButC(block, ROW, REDRAWVIEW3D, "Alpha", 720,50,60,19, &tf->transp, 2.0, (float)TF_ALPHA,0, 0, "Render polygon transparent, depending on alpha channel of the texture");
uiDefButC(block, ROW, REDRAWVIEW3D, "Clip Alpha", 780,50,80,19, &tf->transp, 2.0, (float)TF_CLIP,0, 0, "Use the images alpha values clipped with no blending (binary alpha)");
uiBlockEndAlign(block);
} else {
uiDefBut(block,LABEL,B_NOP, "(No Active Face)", 10,200,150,19,0,0,0,0,0,"");
}
}

@ -173,6 +173,7 @@ static void constraint_active_func(void *ob_v, void *con_v)
}
lb= get_active_constraints(ob);
if (lb == NULL) return;
for(con= lb->first; con; con= con->next) {
if(con==con_v) con->flag |= CONSTRAINT_ACTIVE;
@ -307,7 +308,7 @@ void del_constr_func (void *ob_v, void *con_v)
}
/* remove constraint itself */
lb= get_active_constraints(ob_v);
free_constraint_data (con);
free_constraint_data(con);
BLI_freelinkN(lb, con);
constraint_active_func(ob_v, NULL);

@ -763,7 +763,16 @@ static void seq_panel_input()
}
if (last_seq->type == SEQ_IMAGE) {
StripElem * se = give_stripelem(last_seq, CFRA);
int cfra = CFRA;
StripElem * se;
if(last_seq->startdisp >cfra) {
cfra = last_seq->startdisp;
} else if (last_seq->enddisp <= cfra) {
cfra = last_seq->enddisp - 1;
}
se = give_stripelem(last_seq, cfra);
if (se) {
uiDefBut(block, TEX,

@ -310,6 +310,8 @@ short draw_gpencil_panel (uiBlock *block, bGPdata *gpd, ScrArea *sa)
/* ************************************************** */
/* GREASE PENCIL DRAWING */
/* ----- General Defines ------ */
/* flags for sflag */
enum {
GP_DRAWDATA_NOSTATUS = (1<<0), /* don't draw status info */
@ -317,7 +319,9 @@ enum {
GP_DRAWDATA_ONLYV2D = (1<<2), /* only draw 'canvas' strokes */
};
/* draw stroke in buffer */
/* ----- Tool Buffer Drawing ------ */
/* draw stroke defined in buffer (simple ogl lines/points for now, as dotted lines) */
static void gp_draw_stroke_buffer (tGPspoint *points, int totpoints, short thickness, short dflag, short sflag)
{
tGPspoint *pt;
@ -377,115 +381,232 @@ static void gp_draw_stroke_buffer (tGPspoint *points, int totpoints, short thick
}
}
/* draw a given stroke */
static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness, short dflag, short sflag, short debug, int winx, int winy)
/* ----- Existing Strokes Drawing (3D and Point) ------ */
/* draw a given stroke - just a single dot (only one point) */
static void gp_draw_stroke_point (bGPDspoint *points, short sflag, int winx, int winy)
{
bGPDspoint *pt;
int i;
/* error checking */
if ((points == NULL) || (totpoints <= 0))
return;
/* check if stroke can be drawn */
if ((dflag & GP_DRAWDATA_ONLY3D) && !(sflag & GP_STROKE_3DSPACE))
return;
if (!(dflag & GP_DRAWDATA_ONLY3D) && (sflag & GP_STROKE_3DSPACE))
return;
if ((dflag & GP_DRAWDATA_ONLYV2D) && !(sflag & GP_STROKE_2DSPACE))
return;
if (!(dflag & GP_DRAWDATA_ONLYV2D) && (sflag & GP_STROKE_2DSPACE))
return;
/* if drawing a single point, draw it larger */
if (totpoints == 1) {
/* draw point */
if (sflag & GP_STROKE_3DSPACE) {
glBegin(GL_POINTS);
glVertex3f(points->x, points->y, points->z);
glEnd();
}
else if (sflag & GP_STROKE_2DSPACE) {
glBegin(GL_POINTS);
glVertex2f(points->x, points->y);
glEnd();
}
else {
const float x= (points->x / 1000 * winx);
const float y= (points->y / 1000 * winy);
glBegin(GL_POINTS);
glVertex2f(x, y);
glEnd();
}
/* draw point */
if (sflag & GP_STROKE_3DSPACE) {
glBegin(GL_POINTS);
glVertex3f(points->x, points->y, points->z);
glEnd();
}
else if (sflag & GP_STROKE_2DSPACE) {
glBegin(GL_POINTS);
glVertex2f(points->x, points->y);
glEnd();
}
else {
float oldpressure = 0.0f;
const float x= (points->x / 1000 * winx);
const float y= (points->y / 1000 * winy);
glBegin(GL_POINTS);
glVertex2f(x, y);
glEnd();
}
}
/* draw a given stroke in 3d (i.e. in 3d-space), using simple ogl lines */
static void gp_draw_stroke_3d (bGPDspoint *points, int totpoints, short thickness, short dflag, short sflag, short debug, int winx, int winy)
{
bGPDspoint *pt;
float oldpressure = 0.0f;
int i;
/* draw stroke curve */
glBegin(GL_LINE_STRIP);
for (i=0, pt=points; i < totpoints && pt; i++, pt++) {
if (fabs(pt->pressure - oldpressure) > 0.2f) {
glEnd();
glLineWidth(pt->pressure * thickness);
glBegin(GL_LINE_STRIP);
glVertex3f(pt->x, pt->y, pt->z);
oldpressure = pt->pressure;
}
else
glVertex3f(pt->x, pt->y, pt->z);
}
glEnd();
/* draw debug points of curve on top? */
if (debug) {
glBegin(GL_POINTS);
for (i=0, pt=points; i < totpoints && pt; i++, pt++)
glVertex3f(pt->x, pt->y, pt->z);
glEnd();
}
}
/* ----- Fancy 2D-Stroke Drawing ------ */
/* draw a given stroke in 2d */
static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness, short dflag, short sflag, short debug, int winx, int winy)
{
/* if thickness is less than 3, 'smooth' opengl lines look better */
if ((thickness < 3) || (G.rt==0)) {
bGPDspoint *pt;
int i;
/* draw stroke curve */
glBegin(GL_LINE_STRIP);
for (i=0, pt=points; i < totpoints && pt; i++, pt++) {
float x, y, z;
if (sflag & GP_STROKE_3DSPACE) {
x= pt->x;
y= pt->y;
z= pt->z;
}
else if (sflag & GP_STROKE_2DSPACE) {
x= pt->x;
y= pt->y;
z= 0;
if (sflag & GP_STROKE_2DSPACE) {
glVertex2f(pt->x, pt->y);
}
else {
x= (pt->x / 1000 * winx);
y= (pt->y / 1000 * winy);
z= 0;
}
if (fabs(pt->pressure - oldpressure) > 0.2f) {
glEnd();
glLineWidth(pt->pressure * thickness);
glBegin(GL_LINE_STRIP);
const float x= (pt->x / 1000 * winx);
const float y= (pt->y / 1000 * winy);
if (sflag & GP_STROKE_3DSPACE)
glVertex3f(x, y, z);
else
glVertex2f(x, y);
oldpressure = pt->pressure;
}
else {
if (sflag & GP_STROKE_3DSPACE)
glVertex3f(x, y, z);
else
glVertex2f(x, y);
glVertex2f(x, y);
}
}
glEnd();
}
else { /* tesselation code: currently only enabled with rt != 0 */
bGPDspoint *pt1, *pt2;
float p0[2], p1[2], pm[2];
int i;
/* draw debug points of curve on top? */
if (debug) {
glBegin(GL_POINTS);
for (i=0, pt=points; i < totpoints && pt; i++, pt++) {
if (sflag & GP_STROKE_3DSPACE) {
glVertex3f(pt->x, pt->y, pt->z);
}
else if (sflag & GP_STROKE_2DSPACE) {
glVertex2f(pt->x, pt->y);
}
else {
const float x= (pt->x / 1000 * winx);
const float y= (pt->y / 1000 * winy);
glVertex2f(x, y);
}
glShadeModel(GL_FLAT);
glBegin(GL_QUAD_STRIP);
for (i=0, pt1=points, pt2=points+1; i < (totpoints-1); i++, pt1++, pt2++) {
float s0[2], s1[2]; /* segment 'center' points */
float t0[2], t1[2]; /* tesselated coordinates */
float m1[2], m2[2]; /* gradient and normal */
float pthick, dist; /* thickness at segment point, and length of segment */
float sminorang; /* minor angle between strokes */
/* get x and y coordinates from points */
if (sflag & GP_STROKE_2DSPACE) {
s0[0]= pt1->x; s0[1]= pt1->y;
s1[0]= pt2->x; s1[1]= pt2->y;
}
glEnd();
else {
s0[0]= (pt1->x / 1000 * winx);
s0[1]= (pt1->y / 1000 * winy);
s1[0]= (pt2->x / 1000 * winx);
s1[1]= (pt2->y / 1000 * winy);
}
/* calculate gradient and normal - 'angle'=(ny/nx) */
m1[1]= s1[1] - s0[1];
m1[0]= s1[0] - s0[0];
dist = Vec2Lenf(s0, s1);
m2[1]= -(m1[0]) / dist;
m2[0]= m1[1] / dist;
/* if the first segment, initialise the first segment using segment's normal */
if (i == 0) {
pthick= (pt1->pressure * thickness);
// TODO: also draw/do a round end-cap first
p0[0]= s0[0] - (pthick * m2[0]);
p0[1]= s0[1] - (pthick * m2[1]);
p1[0]= s1[0] + (pthick * m2[0]);
p1[1]= s1[1] + (pthick * m2[1]);
Vec2Copyf(pm, m1);
}
/* if the minor angle between the current segment and the previous one is less than 90 degrees */
if (i)
sminorang= NormalizedVecAngle2_2D(pm, m1);
else
sminorang= 0.0f;
if ((IS_EQ(sminorang, 0)==0) && (abs(sminorang) < M_PI_2) )
{
float closep[2];
/* recalculate startpoint of segment, where the new start-line:
* - starts a new gl-quad-strip
* - uses the vert of old startpoint closer to our endpoint
* - distance between new startpoints = distance between old startpoints
* - new startpoints occur on same gradient as old segment does (has potential for some 'minor' overlap, but ok)
*/
/* find the closer vertex, and distance between startpoints */
if (Vec2Lenf(p0, s1) > Vec2Lenf(p1, s1))
Vec2Copyf(closep, p1);
else
Vec2Copyf(closep, p0);
/* determine which side this closer vertex should be on */
pthick= (pt1->pressure * thickness * 2);
if ( ((closep[0] - s0[0]) > 0) || ((closep[1] - s0[1]) > 0) ) {
/* assumes this is the 'second' point, (i.e. the 'plus' one), so the other is subtracting */
p0[0]= closep[0] - (pthick * pm[0]);
p0[1]= closep[1] - (pthick * pm[1]);
p1[0]= closep[0];
p1[1]= closep[1];
}
else if ( ((closep[0] - s0[0]) < 0) || ((closep[1] - s0[1]) < 0) ) {
/* assumes this is the 'first' point, (i.e. the 'minus' one), so the other is adding */
p0[0]= closep[0];
p0[1]= closep[1];
p1[0]= closep[0] + (pthick * pm[0]);
p1[1]= closep[1] + (pthick * pm[1]);
}
/* reset gl-states! */
glEnd();
glBegin(GL_QUAD_STRIP);
}
/* do the end of this segment */
pthick= (pt2->pressure * thickness);
t0[0] = s1[0] - (pthick * m2[0]);
t0[1] = s1[1] - (pthick * m2[1]);
t1[0] = s1[0] + (pthick * m2[0]);
t1[1] = s1[1] + (pthick * m2[1]);
/* draw this segment */
glVertex2f(p0[0], p0[1]);
glVertex2f(p1[0], p1[1]);
glVertex2f(t0[0], t0[1]);
glVertex2f(t1[0], t1[1]);
// TODO: draw end cap if last segment
if (i == totpoints-2) {
}
/* store current points for next segment to use */
Vec2Copyf(p0, t0);
Vec2Copyf(p1, t1);
Vec2Copyf(pm, m1);
}
glEnd();
}
/* draw debug points of curve on top? (original stroke points) */
if (debug) {
bGPDspoint *pt;
int i;
glBegin(GL_POINTS);
for (i=0, pt=points; i < totpoints && pt; i++, pt++) {
if (sflag & GP_STROKE_2DSPACE) {
glVertex2f(pt->x, pt->y);
}
else {
const float x= (pt->x / 1000 * winx);
const float y= (pt->y / 1000 * winy);
glVertex2f(x, y);
}
}
glEnd();
}
}
/* ----- General Drawing ------ */
/* draw a set of strokes */
static void gp_draw_strokes (bGPDframe *gpf, int winx, int winy, int dflag, short debug,
short lthick, float color[4])
@ -495,9 +616,26 @@ static void gp_draw_strokes (bGPDframe *gpf, int winx, int winy, int dflag, shor
/* set color first (may need to reset it again later too) */
glColor4f(color[0], color[1], color[2], color[3]);
for (gps= gpf->strokes.first; gps; gps= gps->next) {
/* just draw the stroke once */
gp_draw_stroke(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, winx, winy);
for (gps= gpf->strokes.first; gps; gps= gps->next) {
/* check if stroke can be drawn */
if ((dflag & GP_DRAWDATA_ONLY3D) && !(gps->flag & GP_STROKE_3DSPACE))
continue;
if (!(dflag & GP_DRAWDATA_ONLY3D) && (gps->flag & GP_STROKE_3DSPACE))
continue;
if ((dflag & GP_DRAWDATA_ONLYV2D) && !(gps->flag & GP_STROKE_2DSPACE))
continue;
if (!(dflag & GP_DRAWDATA_ONLYV2D) && (gps->flag & GP_STROKE_2DSPACE))
continue;
if ((gps->points == 0) || (gps->totpoints < 1))
continue;
/* check which stroke-drawer to use */
if (gps->totpoints == 1)
gp_draw_stroke_point(gps->points, gps->flag, winx, winy);
else if (dflag & GP_DRAWDATA_ONLY3D)
gp_draw_stroke_3d(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, winx, winy);
else if (gps->totpoints > 1)
gp_draw_stroke(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, winx, winy);
}
}
@ -656,7 +794,7 @@ static void gp_draw_data (bGPdata *gpd, int winx, int winy, int dflag)
glColor4f(0, 0, 0, 1);
}
/* ----------- */
/* ----- Grease Pencil Sketches Drawing API ------ */
/* draw grease-pencil sketches to specified 2d-view assuming that matrices are already set correctly
* Note: this gets called twice - first time with onlyv2d=1 to draw 'canvas' strokes, second time with onlyv2d=0 for screen-aligned strokes

@ -98,7 +98,7 @@
int no_rightbox=0, no_leftbox= 0;
static void draw_seq_handle(Sequence *seq, SpaceSeq *sseq, float pixelx, short direction);
static void draw_seq_extensions(Sequence *seq, SpaceSeq *sseq);
static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2);
static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2, char *background_col);
static void draw_shadedstrip(Sequence *seq, char *col, float x1, float y1, float x2, float y2);
static void draw_seq_strip(struct Sequence *seq, struct ScrArea *sa, struct SpaceSeq *sseq, int outline_tint, float pixelx);
@ -604,7 +604,7 @@ static void draw_seq_extensions(Sequence *seq, SpaceSeq *sseq)
}
/* draw info text on a sequence strip */
static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2)
static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2, char *background_col)
{
float v1[2], v2[2];
int len, size;
@ -670,8 +670,13 @@ static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2)
mval[1]= 1;
areamouseco_to_ipoco(G.v2d, mval, &x1, &x2);
if(seq->flag & SELECT) cpack(0xFFFFFF);
else cpack(0);
if(seq->flag & SELECT){
cpack(0xFFFFFF);
}else if ((((int)background_col[0] + (int)background_col[1] + (int)background_col[2]) / 3) < 50){
cpack(0x505050); /* use lighter text colour for dark background */
}else{
cpack(0);
}
glRasterPos3f(x1, y1+SEQ_STRIP_OFSBOTTOM, 0.0);
BMF_DrawString(G.font, strp);
}
@ -740,7 +745,7 @@ so wave file sample drawing precission is zoom adjusted
static void draw_seq_strip(Sequence *seq, ScrArea *sa, SpaceSeq *sseq, int outline_tint, float pixelx)
{
float x1, x2, y1, y2;
char col[3], is_single_image;
char col[3], background_col[3], is_single_image;
/* we need to know if this is a single image/color or not for drawing */
is_single_image = (char)check_single_seq(seq);
@ -755,13 +760,14 @@ static void draw_seq_strip(Sequence *seq, ScrArea *sa, SpaceSeq *sseq, int outli
/* get the correct color per strip type*/
get_seq_color3ubv(seq, col);
//get_seq_color3ubv(seq, col);
get_seq_color3ubv(seq, background_col);
/* draw the main strip body */
if (is_single_image) /* single image */
draw_shadedstrip(seq, col, seq_tx_get_final_left(seq, 0), y1, seq_tx_get_final_right(seq, 0), y2);
draw_shadedstrip(seq, background_col, seq_tx_get_final_left(seq, 0), y1, seq_tx_get_final_right(seq, 0), y2);
else /* normal operation */
draw_shadedstrip(seq, col, x1, y1, x2, y2);
draw_shadedstrip(seq, background_col, x1, y1, x2, y2);
/* draw additional info and controls */
if (seq->type == SEQ_RAM_SOUND)
@ -814,7 +820,7 @@ static void draw_seq_strip(Sequence *seq, ScrArea *sa, SpaceSeq *sseq, int outli
/* nice text here would require changing the view matrix for texture text */
if( (x2-x1) / pixelx > 32) {
draw_seq_text(seq, x1, x2, y1, y2);
draw_seq_text(seq, x1, x2, y1, y2, background_col);
}
}

@ -1033,87 +1033,6 @@ static void *get_nearest_bone (short findunsel)
return NULL;
}
/* used by posemode and editmode */
void select_bone_parent (void)
{
Object *ob;
bArmature *arm;
/* get data */
if (G.obedit)
ob= G.obedit;
else if (OBACT)
ob= OBACT;
else
return;
arm= (bArmature *)ob->data;
/* determine which mode armature is in */
if ((!G.obedit) && (ob->flag & OB_POSEMODE)) {
/* deal with pose channels */
/* channels are sorted on dependency, so the loop below won't result in a flood-select */
bPoseChannel *pchan=NULL;
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
/* check if bone in original selection */
if (pchan->bone->flag & BONE_SELECTED) {
bPoseChannel *chanpar= pchan->parent;
/* check if any parent */
if ((chanpar) && ((chanpar->bone->flag & BONE_SELECTED)==0)) {
chanpar->bone->flag |= BONE_SELECTED;
select_actionchannel_by_name (ob->action, pchan->name, 1);
}
}
}
}
else if (G.obedit) {
/* deal with editbones */
EditBone *curbone, *parbone, *parpar;
/* prevent floods */
for (curbone= G.edbo.first; curbone; curbone= curbone->next)
curbone->temp= NULL;
for (curbone= G.edbo.first; curbone; curbone= curbone->next) {
/* check if bone selected */
if ((curbone->flag & BONE_SELECTED) && curbone->temp==NULL) {
parbone= curbone->parent;
/* check if any parent */
if ((parbone) && ((parbone->flag & BONE_SELECTED)==0)) {
/* select the parent bone */
parbone->flag |= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
/* check if parent has parent */
parpar= parbone->parent;
if ((parpar) && (parbone->flag & BONE_CONNECTED)) {
parpar->flag |= BONE_TIPSEL;
}
/* tag this bone to not flood selection */
parbone->temp= parbone;
}
}
}
/* to be sure... */
for (curbone= G.edbo.first; curbone; curbone= curbone->next)
curbone->temp= NULL;
}
/* undo + redraw pushes */
countall(); // flushes selection!
allqueue (REDRAWVIEW3D, 0);
allqueue (REDRAWBUTSEDIT, 0);
allqueue(REDRAWBUTSOBJECT, 0);
allqueue(REDRAWOOPS, 0);
BIF_undo_push("Select Parent");
}
/* helper for setflag_sel_bone() */
static void bone_setflag (int *bone, int flag, short mode)
{
@ -1139,6 +1058,89 @@ static void bone_setflag (int *bone, int flag, short mode)
}
}
/* Get the first available child of an editbone */
static EditBone *editbone_get_child(EditBone *pabone, short use_visibility)
{
Object *ob;
bArmature *arm;
EditBone *curbone, *chbone=NULL;
if (!G.obedit) return NULL;
else ob= G.obedit;
arm= (bArmature *)ob->data;
for (curbone= G.edbo.first; curbone; curbone= curbone->next) {
if (curbone->parent == pabone) {
if (use_visibility) {
if ((arm->layer & curbone->layer) && !(pabone->flag & BONE_HIDDEN_A))
chbone = curbone;
}
else
chbone = curbone;
}
}
return chbone;
}
void armature_select_hierarchy(short direction, short add_to_sel)
{
Object *ob;
bArmature *arm;
EditBone *curbone, *pabone, *chbone;
if (!G.obedit) return;
else ob= G.obedit;
arm= (bArmature *)ob->data;
for (curbone= G.edbo.first; curbone; curbone= curbone->next) {
if (arm->layer & curbone->layer) {
if (curbone->flag & (BONE_ACTIVE)) {
if (direction == BONE_SELECT_PARENT) {
if (curbone->parent == NULL) continue;
else pabone = curbone->parent;
if ((arm->layer & pabone->layer) && !(pabone->flag & BONE_HIDDEN_A)) {
pabone->flag |= (BONE_ACTIVE|BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
if (pabone->parent) pabone->parent->flag |= BONE_TIPSEL;
if (!add_to_sel) curbone->flag &= ~(BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
curbone->flag &= ~BONE_ACTIVE;
break;
}
} else { // BONE_SELECT_CHILD
chbone = editbone_get_child(curbone, 1);
if (chbone == NULL) continue;
if ((arm->layer & chbone->layer) && !(chbone->flag & BONE_HIDDEN_A)) {
chbone->flag |= (BONE_ACTIVE|BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
if (!add_to_sel) {
curbone->flag &= ~(BONE_SELECTED|BONE_ROOTSEL);
if (curbone->parent) curbone->parent->flag &= ~BONE_TIPSEL;
}
curbone->flag &= ~BONE_ACTIVE;
break;
}
}
}
}
}
countall(); // flushes selection!
allqueue (REDRAWVIEW3D, 0);
allqueue (REDRAWBUTSEDIT, 0);
allqueue (REDRAWBUTSOBJECT, 0);
allqueue (REDRAWOOPS, 0);
if (direction==BONE_SELECT_PARENT)
BIF_undo_push("Select edit bone parent");
if (direction==BONE_SELECT_CHILD)
BIF_undo_push("Select edit bone child");
}
/* used by posemode and editmode */
void setflag_armature (short mode)
{

@ -1076,6 +1076,12 @@ void winqreadimaselspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
toggle_blockhandler(sa, IMASEL_HANDLER_IMAGE, UI_PNL_UNSTOW);
scrarea_queue_winredraw(sa);
break;
case HKEY:
simasel->flag ^= FILE_HIDE_DOT;
BIF_filelist_free(simasel->files);
do_draw= 1;
do_headdraw= 1;
break;
case PKEY:
if(G.qual & LR_SHIFTKEY) {
extern char bprogname[]; /* usiblender.c */

@ -1432,348 +1432,78 @@ int mesh_layers_menu(CustomData *data, int type) {
return ret;
}
/* ctrl+c in mesh editmode */
void mesh_copy_menu(void)
void EM_mesh_copy_edge(short type)
{
EditMesh *em = G.editMesh;
EditSelection *ese;
short ret, change=0;
short change=0;
EditEdge *eed, *eed_act;
float vec[3], vec_mid[3], eed_len, eed_len_act;
if (!em) return;
ese = em->selected.last;
if (!ese) return;
/* Faces can have a NULL ese, so dont return on a NULL ese here */
eed_act = (EditEdge*)ese->data;
if(ese && ese->type == EDITVERT) {
if (!ese) return;
/*EditVert *ev, *ev_act = (EditVert*)ese->data;
ret= pupmenu("");*/
} else if(ese && ese->type == EDITEDGE) {
EditEdge *eed, *eed_act;
float vec[3], vec_mid[3], eed_len, eed_len_act;
if (!ese) return;
eed_act = (EditEdge*)ese->data;
ret= pupmenu("Copy Active Edge to Selected%t|Crease%x1|Bevel Weight%x2|Length%x3");
if (ret<1) return;
switch (type) {
case 1: /* copy crease */
for(eed=em->edges.first; eed; eed=eed->next) {
if (eed->f & SELECT && eed != eed_act && eed->crease != eed_act->crease) {
eed->crease = eed_act->crease;
change = 1;
}
}
break;
case 2: /* copy bevel weight */
for(eed=em->edges.first; eed; eed=eed->next) {
if (eed->f & SELECT && eed != eed_act && eed->bweight != eed_act->bweight) {
eed->bweight = eed_act->bweight;
change = 1;
}
}
break;
case 3: /* copy length */
eed_len_act = VecLenf(eed_act->v1->co, eed_act->v2->co);
switch (ret) {
case 1: /* copy crease */
for(eed=em->edges.first; eed; eed=eed->next) {
if (eed->f & SELECT && eed != eed_act && eed->crease != eed_act->crease) {
eed->crease = eed_act->crease;
change = 1;
for(eed=em->edges.first; eed; eed=eed->next) {
if (eed->f & SELECT && eed != eed_act) {
eed_len = VecLenf(eed->v1->co, eed->v2->co);
if (eed_len == eed_len_act) continue;
/* if this edge is zero length we cont do anything with it*/
if (eed_len == 0.0f) continue;
if (eed_len_act == 0.0f) {
VecAddf(vec_mid, eed->v1->co, eed->v2->co);
VecMulf(vec_mid, 0.5);
VECCOPY(eed->v1->co, vec_mid);
VECCOPY(eed->v2->co, vec_mid);
} else {
/* copy the edge length */
VecAddf(vec_mid, eed->v1->co, eed->v2->co);
VecMulf(vec_mid, 0.5);
/* SCALE 1 */
VecSubf(vec, eed->v1->co, vec_mid);
VecMulf(vec, eed_len_act/eed_len);
VecAddf(eed->v1->co, vec, vec_mid);
/* SCALE 2 */
VecSubf(vec, eed->v2->co, vec_mid);
VecMulf(vec, eed_len_act/eed_len);
VecAddf(eed->v2->co, vec, vec_mid);
}
change = 1;
}
break;
case 2: /* copy bevel weight */
for(eed=em->edges.first; eed; eed=eed->next) {
if (eed->f & SELECT && eed != eed_act && eed->bweight != eed_act->bweight) {
eed->bweight = eed_act->bweight;
change = 1;
}
}
break;
case 3: /* copy length */
for(eed=em->edges.first; eed; eed=eed->next) {
if (eed->f & SELECT && eed != eed_act) {
eed_len = VecLenf(eed->v1->co, eed->v2->co);
if (eed_len == eed_len_act) continue;
/* if this edge is zero length we cont do anything with it*/
if (eed_len == 0.0f) continue;
if (eed_len_act == 0.0f) {
VecAddf(vec_mid, eed->v1->co, eed->v2->co);
VecMulf(vec_mid, 0.5);
VECCOPY(eed->v1->co, vec_mid);
VECCOPY(eed->v2->co, vec_mid);
} else {
/* copy the edge length */
VecAddf(vec_mid, eed->v1->co, eed->v2->co);
VecMulf(vec_mid, 0.5);
/* SCALE 1 */
VecSubf(vec, eed->v1->co, vec_mid);
VecMulf(vec, eed_len_act/eed_len);
VecAddf(eed->v1->co, vec, vec_mid);
/* SCALE 2 */
VecSubf(vec, eed->v2->co, vec_mid);
VecMulf(vec, eed_len_act/eed_len);
VecAddf(eed->v2->co, vec, vec_mid);
}
change = 1;
}
}
if (change)
recalc_editnormals();
break;
}
} else if(ese==NULL || ese->type == EDITFACE) {
EditFace *efa, *efa_act;
MTFace *tf, *tf_act = NULL;
MCol *mcol, *mcol_act = NULL;
efa_act = EM_get_actFace(0);
if (efa_act) {
ret= pupmenu(
"Copy Face Selected%t|"
"Active Material%x1|Active Image%x2|Active UV Coords%x3|"
"Active Mode%x4|Active Transp%x5|Active Vertex Colors%x6|%l|"
"TexFace UVs from layer%x7|"
"TexFace Images from layer%x8|"
"TexFace All from layer%x9|"
"Vertex Colors from layer%x10");
if (ret<1) return;
tf_act = CustomData_em_get(&em->fdata, efa_act->data, CD_MTFACE);
mcol_act = CustomData_em_get(&em->fdata, efa_act->data, CD_MCOL);
} else {
ret= pupmenu(
"Copy Face Selected%t|"
/* Make sure these are always the same as above */
"TexFace UVs from layer%x7|"
"TexFace Images from layer%x8|"
"TexFace All from layer%x9|"
"Vertex Colors from layer%x10");
if (ret<1) return;
}
switch (ret) {
case 1: /* copy material */
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT && efa->mat_nr != efa_act->mat_nr) {
efa->mat_nr = efa_act->mat_nr;
change = 1;
}
}
break;
case 2: /* copy image */
if (!tf_act) {
error("mesh has no uv/image layers");
return;
}
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT && efa != efa_act) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (tf_act->tpage) {
tf->tpage = tf_act->tpage;
tf->mode |= TF_TEX;
} else {
tf->tpage = NULL;
tf->mode &= ~TF_TEX;
}
tf->tile= tf_act->tile;
change = 1;
}
}
break;
case 3: /* copy UV's */
if (!tf_act) {
error("mesh has no uv/image layers");
return;
}
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT && efa != efa_act) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
memcpy(tf->uv, tf_act->uv, sizeof(tf->uv));
change = 1;
}
}
break;
case 4: /* mode's */
if (!tf_act) {
error("mesh has no uv/image layers");
return;
}
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT && efa != efa_act) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
tf->mode= tf_act->mode;
change = 1;
}
}
break;
case 5: /* copy transp's */
if (!tf_act) {
error("mesh has no uv/image layers");
return;
}
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT && efa != efa_act) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
tf->transp= tf_act->transp;
change = 1;
}
}
break;
case 6: /* copy vcols's */
if (!mcol_act) {
error("mesh has no color layers");
return;
} else {
/* guess the 4th color if needs be */
float val =- 1;
if (!efa_act->v4) {
/* guess the othe vale, we may need to use it
*
* Modifying the 4th value of the mcol is ok here since its not seen
* on a triangle
* */
val = ((float)(mcol_act->r + (mcol_act+1)->r + (mcol_act+2)->r)) / 3; CLAMP(val, 0, 255);
(mcol_act+3)->r = (char)val;
val = ((float)(mcol_act->g + (mcol_act+1)->g + (mcol_act+2)->g)) / 3; CLAMP(val, 0, 255);
(mcol_act+3)->g = (char)val;
val = ((float)(mcol_act->b + (mcol_act+1)->b + (mcol_act+2)->b)) / 3; CLAMP(val, 0, 255);
(mcol_act+3)->b = (char)val;
}
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT && efa != efa_act) {
/* TODO - make copy from tri to quad guess the 4th vert */
mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
memcpy(mcol, mcol_act, sizeof(MCol)*4);
change = 1;
}
}
}
break;
/* Copy from layer - Warning! tf_act and mcol_act will be NULL here */
case 7:
case 8:
case 9:
if (CustomData_number_of_layers(&em->fdata, CD_MTFACE)<2) {
error("mesh does not have multiple uv/image layers");
return;
} else {
int layer_orig_idx, layer_idx;
layer_idx = mesh_layers_menu(&em->fdata, CD_MTFACE);
if (layer_idx<0) return;
/* warning, have not updated mesh pointers however this is not needed since we swicth back */
layer_orig_idx = CustomData_get_active_layer(&em->fdata, CD_MTFACE);
if (layer_idx==layer_orig_idx)
return;
/* get the tfaces */
CustomData_set_layer_active(&em->fdata, CD_MTFACE, (int)layer_idx);
/* store the tfaces in our temp */
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT) {
efa->tmp.p = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
}
}
CustomData_set_layer_active(&em->fdata, CD_MTFACE, layer_orig_idx);
}
break;
case 10: /* select vcol layers - make sure this stays in sync with above code */
if (CustomData_number_of_layers(&em->fdata, CD_MCOL)<2) {
error("mesh does not have multiple color layers");
return;
} else {
int layer_orig_idx, layer_idx;
layer_idx = mesh_layers_menu(&em->fdata, CD_MCOL);
if (layer_idx<0) return;
/* warning, have not updated mesh pointers however this is not needed since we swicth back */
layer_orig_idx = CustomData_get_active_layer(&em->fdata, CD_MCOL);
if (layer_idx==layer_orig_idx)
return;
/* get the tfaces */
CustomData_set_layer_active(&em->fdata, CD_MCOL, (int)layer_idx);
/* store the tfaces in our temp */
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT) {
efa->tmp.p = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
}
}
CustomData_set_layer_active(&em->fdata, CD_MCOL, layer_orig_idx);
}
break;
}
/* layer copy only - sanity checks done above */
switch (ret) {
case 7: /* copy UV's only */
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT) {
tf_act = (MTFace *)efa->tmp.p; /* not active but easier to use this way */
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
memcpy(tf->uv, tf_act->uv, sizeof(tf->uv));
change = 1;
}
}
break;
case 8: /* copy image settings only */
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT) {
tf_act = (MTFace *)efa->tmp.p; /* not active but easier to use this way */
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (tf_act->tpage) {
tf->tpage = tf_act->tpage;
tf->mode |= TF_TEX;
} else {
tf->tpage = NULL;
tf->mode &= ~TF_TEX;
}
tf->tile= tf_act->tile;
change = 1;
}
}
break;
case 9: /* copy all tface info */
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT) {
tf_act = (MTFace *)efa->tmp.p; /* not active but easier to use this way */
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
memcpy(tf->uv, ((MTFace *)efa->tmp.p)->uv, sizeof(tf->uv));
tf->tpage = tf_act->tpage;
tf->mode = tf_act->mode;
tf->transp = tf_act->transp;
change = 1;
}
}
break;
case 10:
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT) {
mcol_act = (MCol *)efa->tmp.p;
mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
memcpy(mcol, mcol_act, sizeof(MCol)*4);
change = 1;
}
}
break;
}
if (change)
recalc_editnormals();
break;
}
if (change) {
@ -1781,12 +1511,319 @@ void mesh_copy_menu(void)
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSEDIT, 0);
if (ese==NULL || ese->type == EDITFACE) BIF_undo_push("Copy Face Attribute");
else if ( ese->type == EDITEDGE) BIF_undo_push("Copy Edge Attribute");
else if ( ese->type == EDITVERT) BIF_undo_push("Copy Vert Attribute");
BIF_undo_push("Copy Edge Attribute");
}
}
void EM_mesh_copy_face(short type)
{
EditMesh *em = G.editMesh;
short change=0;
EditFace *efa, *efa_act;
MTFace *tf, *tf_act = NULL;
MCol *mcol, *mcol_act = NULL;
if (!em) return;
efa_act = EM_get_actFace(0);
if (!efa_act) return;
tf_act = CustomData_em_get(&em->fdata, efa_act->data, CD_MTFACE);
mcol_act = CustomData_em_get(&em->fdata, efa_act->data, CD_MCOL);
switch (type) {
case 1: /* copy material */
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT && efa->mat_nr != efa_act->mat_nr) {
efa->mat_nr = efa_act->mat_nr;
change = 1;
}
}
break;
case 2: /* copy image */
if (!tf_act) {
error("mesh has no uv/image layers");
return;
}
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT && efa != efa_act) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (tf_act->tpage) {
tf->tpage = tf_act->tpage;
tf->mode |= TF_TEX;
} else {
tf->tpage = NULL;
tf->mode &= ~TF_TEX;
}
tf->tile= tf_act->tile;
change = 1;
}
}
break;
case 3: /* copy UV's */
if (!tf_act) {
error("mesh has no uv/image layers");
return;
}
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT && efa != efa_act) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
memcpy(tf->uv, tf_act->uv, sizeof(tf->uv));
change = 1;
}
}
break;
case 4: /* mode's */
if (!tf_act) {
error("mesh has no uv/image layers");
return;
}
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT && efa != efa_act) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
tf->mode= tf_act->mode;
change = 1;
}
}
break;
case 5: /* copy transp's */
if (!tf_act) {
error("mesh has no uv/image layers");
return;
}
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT && efa != efa_act) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
tf->transp= tf_act->transp;
change = 1;
}
}
break;
case 6: /* copy vcols's */
if (!mcol_act) {
error("mesh has no color layers");
return;
} else {
/* guess the 4th color if needs be */
float val =- 1;
if (!efa_act->v4) {
/* guess the othe vale, we may need to use it
*
* Modifying the 4th value of the mcol is ok here since its not seen
* on a triangle
* */
val = ((float)(mcol_act->r + (mcol_act+1)->r + (mcol_act+2)->r)) / 3; CLAMP(val, 0, 255);
(mcol_act+3)->r = (char)val;
val = ((float)(mcol_act->g + (mcol_act+1)->g + (mcol_act+2)->g)) / 3; CLAMP(val, 0, 255);
(mcol_act+3)->g = (char)val;
val = ((float)(mcol_act->b + (mcol_act+1)->b + (mcol_act+2)->b)) / 3; CLAMP(val, 0, 255);
(mcol_act+3)->b = (char)val;
}
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT && efa != efa_act) {
/* TODO - make copy from tri to quad guess the 4th vert */
mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
memcpy(mcol, mcol_act, sizeof(MCol)*4);
change = 1;
}
}
}
break;
}
if (change) {
DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSEDIT, 0);
if (type==3) {
allqueue(REDRAWIMAGE, 0);
}
BIF_undo_push("Copy Face Attribute");
}
}
void EM_mesh_copy_face_layer(short type)
{
EditMesh *em = G.editMesh;
short change=0;
EditFace *efa;
MTFace *tf, *tf_from;
MCol *mcol, *mcol_from;
if (!em) return;
switch(type) {
case 7:
case 8:
case 9:
if (CustomData_number_of_layers(&em->fdata, CD_MTFACE)<2) {
error("mesh does not have multiple uv/image layers");
return;
} else {
int layer_orig_idx, layer_idx;
layer_idx = mesh_layers_menu(&em->fdata, CD_MTFACE);
if (layer_idx<0) return;
/* warning, have not updated mesh pointers however this is not needed since we swicth back */
layer_orig_idx = CustomData_get_active_layer(&em->fdata, CD_MTFACE);
if (layer_idx==layer_orig_idx)
return;
/* get the tfaces */
CustomData_set_layer_active(&em->fdata, CD_MTFACE, (int)layer_idx);
/* store the tfaces in our temp */
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT) {
efa->tmp.p = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
}
}
CustomData_set_layer_active(&em->fdata, CD_MTFACE, layer_orig_idx);
}
break;
case 10: /* select vcol layers - make sure this stays in sync with above code */
if (CustomData_number_of_layers(&em->fdata, CD_MCOL)<2) {
error("mesh does not have multiple color layers");
return;
} else {
int layer_orig_idx, layer_idx;
layer_idx = mesh_layers_menu(&em->fdata, CD_MCOL);
if (layer_idx<0) return;
/* warning, have not updated mesh pointers however this is not needed since we swicth back */
layer_orig_idx = CustomData_get_active_layer(&em->fdata, CD_MCOL);
if (layer_idx==layer_orig_idx)
return;
/* get the tfaces */
CustomData_set_layer_active(&em->fdata, CD_MCOL, (int)layer_idx);
/* store the tfaces in our temp */
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT) {
efa->tmp.p = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
}
}
CustomData_set_layer_active(&em->fdata, CD_MCOL, layer_orig_idx);
}
break;
}
/* layer copy only - sanity checks done above */
switch (type) {
case 7: /* copy UV's only */
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT) {
tf_from = (MTFace *)efa->tmp.p; /* not active but easier to use this way */
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
memcpy(tf->uv, tf_from->uv, sizeof(tf->uv));
change = 1;
}
}
break;
case 8: /* copy image settings only */
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT) {
tf_from = (MTFace *)efa->tmp.p; /* not active but easier to use this way */
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (tf_from->tpage) {
tf->tpage = tf_from->tpage;
tf->mode |= TF_TEX;
} else {
tf->tpage = NULL;
tf->mode &= ~TF_TEX;
}
tf->tile= tf_from->tile;
change = 1;
}
}
break;
case 9: /* copy all tface info */
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT) {
tf_from = (MTFace *)efa->tmp.p; /* not active but easier to use this way */
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
memcpy(tf->uv, ((MTFace *)efa->tmp.p)->uv, sizeof(tf->uv));
tf->tpage = tf_from->tpage;
tf->mode = tf_from->mode;
tf->transp = tf_from->transp;
change = 1;
}
}
break;
case 10:
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT) {
mcol_from = (MCol *)efa->tmp.p;
mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
memcpy(mcol, mcol_from, sizeof(MCol)*4);
change = 1;
}
}
break;
}
if (change) {
DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSEDIT, 0);
BIF_undo_push("Copy Face Layer");
}
}
/* ctrl+c in mesh editmode */
void mesh_copy_menu(void)
{
EditMesh *em = G.editMesh;
EditSelection *ese;
int ret;
if (!em) return;
ese = em->selected.last;
/* Faces can have a NULL ese, so dont return on a NULL ese here */
if(ese && ese->type == EDITVERT) {
/* EditVert *ev, *ev_act = (EditVert*)ese->data;
ret= pupmenu(""); */
} else if(ese && ese->type == EDITEDGE) {
ret= pupmenu("Copy Active Edge to Selected%t|Crease%x1|Bevel Weight%x2|Length%x3");
if (ret<1) return;
EM_mesh_copy_edge(ret);
} else if(ese==NULL || ese->type == EDITFACE) {
ret= pupmenu(
"Copy Face Selected%t|"
"Active Material%x1|Active Image%x2|Active UV Coords%x3|"
"Active Mode%x4|Active Transp%x5|Active Vertex Colors%x6|%l|"
"TexFace UVs from layer%x7|"
"TexFace Images from layer%x8|"
"TexFace All from layer%x9|"
"Vertex Colors from layer%x10");
if (ret<1) return;
if (ret<=6) {
EM_mesh_copy_face(ret);
} else {
EM_mesh_copy_face_layer(ret);
}
}
}

@ -644,6 +644,7 @@ static int seq_is_parent(Sequence *par, Sequence *seq)
static int seq_is_predecessor(Sequence *pred, Sequence *seq)
{
if (!pred) return 0;
if(pred == seq) return 0;
else if(seq_is_parent(pred, seq)) return 1;
else if(pred->seq1 && seq_is_predecessor(pred->seq1, seq)) return 1;

@ -540,6 +540,42 @@ static void check_packAll()
}
}
#ifdef _WIN32
static void copy_game_dll(char *dll_filename, char *source_dir, char *dest_dir)
{
char source_filename[FILE_MAX];
char dest_filename[FILE_MAX];
strcpy( source_filename, source_dir );
strcat( source_filename, dll_filename );
strcpy( dest_filename, dest_dir );
strcat( dest_filename, dll_filename );
if(!BLI_exists(dest_filename)) {
BLI_copy_fileops( source_filename, dest_filename );
}
}
static void copy_all_game_dlls(char *str)
{
#define GAME_DLL_COUNT 7
char *game_dll_list[GAME_DLL_COUNT]={"gnu_gettext.dll", "libpng.dll", "libtiff.dll", "pthreadVC2.dll", "python25.dll", "SDL.dll", "zlib.dll"};
char dest_dir[FILE_MAX];
char source_dir[FILE_MAX];
int i;
strcpy(source_dir, get_install_dir());
strcat(source_dir, "\\");
BLI_split_dirfile_basic(str, dest_dir, NULL);
for (i= 0; i< GAME_DLL_COUNT; i++) {
copy_game_dll(game_dll_list[i], source_dir, dest_dir );
};
}
#endif
static int write_runtime(char *str, char *exename)
{
char *freestr= NULL;
@ -587,7 +623,14 @@ static void write_runtime_check(char *str)
#endif
write_runtime(str, player);
#ifdef _WIN32
// get a list of the .DLLs in the Blender folder and copy all of these to the destination folder if they don't exist
copy_all_game_dlls(str);
#endif
}
/* end keyed functions */
/************************** MAIN MENU *****************************/
@ -1026,7 +1069,7 @@ static uiBlock *info_externalfiles(void *arg_unused)
block= uiNewBlock(&curarea->uiblocks, "info_externalfiles", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
uiBlockSetButmFunc(block, do_info_externalfiles, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pack into Blend", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 1, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pack into .blend file", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 1, "");
#if 0
uiDefBut(block, BUTM, 1, "Unpack Data to current dir", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 2, "Removes all packed files from the project and saves them to the current directory");
#endif
@ -1036,8 +1079,8 @@ static uiBlock *info_externalfiles(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make all Paths Relative", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 10, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make all Paths Absolute", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 11, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Report Missing Files", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 12, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Find Missing Files", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 13, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Report Missing Files...", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 12, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Find Missing Files...", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 13, "");
uiBlockSetDirection(block, UI_RIGHT);
uiTextBoundsBlock(block, 60);

@ -166,9 +166,9 @@ void do_layer_buttons(short event)
if(event==-1 && (G.qual & LR_CTRLKEY)) {
G.vd->scenelock= !G.vd->scenelock;
do_view3d_buttons(B_SCENELOCK);
} else if (event==-1) {
} else if (event<0) {
if(G.vd->lay== (1<<20)-1) {
if(G.qual & LR_SHIFTKEY) G.vd->lay= oldlay;
if(event==-2 || G.qual & LR_SHIFTKEY) G.vd->lay= oldlay;
}
else {
oldlay= G.vd->lay;
@ -605,6 +605,9 @@ static void do_view3d_viewmenu(void *arg, int event)
case 21: /* Grease Pencil */
add_blockhandler(curarea, VIEW3D_HANDLER_GREASEPENCIL, UI_PNL_UNSTOW);
break;
case 22: /* View all layers */
do_layer_buttons(-2);
break;
}
allqueue(REDRAWVIEW3D, 1);
}
@ -648,6 +651,11 @@ static uiBlock *view3d_viewmenu(void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
if(G.vd->lay== (1<<20)-1) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Previous Layers|Shift ~", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 22, "");
else uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show All Layers| ~", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 22, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
if(G.vd->localview) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Local View|NumPad /", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Local View|NumPad /", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
if(!G.vd->localview) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Global View|NumPad /", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
@ -726,6 +734,9 @@ void do_view3d_select_object_typemenu(void *arg, int event)
case 10: /* Lamp */
selectall_type(OB_LAMP);
break;
case 20:
do_layer_buttons(-2);
break;
}
allqueue(REDRAWVIEW3D, 0);
}
@ -1314,12 +1325,21 @@ static void do_view3d_select_armaturemenu(void *arg, int event)
case 2: /* Select/Deselect all */
deselectall_armature(1, 1);
break;
case 3: /* Select Parent(s) */
select_bone_parent();
break;
case 4: /* Swap Select All */
case 3: /* Swap Select All */
deselectall_armature(3, 1);
break;
case 4: /* Select parent */
armature_select_hierarchy(BONE_SELECT_PARENT, 0);
break;
case 5: /* Select child */
armature_select_hierarchy(BONE_SELECT_CHILD, 0);
break;
case 6: /* Extend Select parent */
armature_select_hierarchy(BONE_SELECT_PARENT, 1);
break;
case 7: /* Extend Select child */
armature_select_hierarchy(BONE_SELECT_CHILD, 1);
break;
}
allqueue(REDRAWVIEW3D, 0);
}
@ -1337,11 +1357,18 @@ static uiBlock *view3d_select_armaturemenu(void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Inverse|Ctrl I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Swap Select All|Ctrl I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Parent|[", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Child|]", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Parent|Shift [", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Child|Shift ]", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Parent(s)|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
if(curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);
}
@ -1368,12 +1395,21 @@ static void do_view3d_select_pose_armaturemenu(void *arg, int event)
case 3: /* Select Target(s) of Constraint(s) */
pose_select_constraint_target();
break;
case 4: /* Select Bone's Parent */
select_bone_parent();
break;
case 5: /* Swap Select All */
deselectall_posearmature(OBACT, 3, 1);
break;
case 6: /* Select parent */
pose_select_hierarchy(BONE_SELECT_PARENT, 0);
break;
case 7: /* Select child */
pose_select_hierarchy(BONE_SELECT_CHILD, 0);
break;
case 8: /* Extend Select parent */
pose_select_hierarchy(BONE_SELECT_PARENT, 1);
break;
case 9: /* Extend Select child */
pose_select_hierarchy(BONE_SELECT_CHILD, 1);
break;
}
allqueue(REDRAWVIEW3D, 0);
}
@ -1393,8 +1429,17 @@ static uiBlock *view3d_select_pose_armaturemenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Swap Select All|Ctrl I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Constraint Target|W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Parent(s)|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Parent|[", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Child|]", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Parent|Shift [", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Child|Shift ]", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
if(curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);
}
@ -2467,8 +2512,11 @@ static void do_view3d_edit_objectmenu(void *arg, int event)
case 15: /* Object Panel */
add_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_UNSTOW);
break;
case 16: /* make proxy object*/
make_proxy();
break;
#ifdef WITH_VERSE
case 16: /* Share Object at Verse server */
case 17: /* Share Object at Verse server */
if(session_list.first != session_list.last) session = session_menu();
else session = session_list.first;
if(session) b_verse_push_object(session, ob);
@ -2493,7 +2541,7 @@ static uiBlock *view3d_edit_objectmenu(void *arg_unused)
if (base) ob= base->object;
if(ob && (ob->type == OB_MESH) && (!ob->vnode)) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Share at Verse Server", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Share at Verse Server", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
}
}
@ -2519,6 +2567,7 @@ static uiBlock *view3d_edit_objectmenu(void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Proxy|Ctrl Alt P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
uiDefIconTextBlockBut(block, view3d_edit_object_makelinksmenu, NULL, ICON_RIGHTARROW_THIN, "Make Links", 0, yco-=20, 120, 19, "");
uiDefIconTextBlockBut(block, view3d_edit_object_singleusermenu, NULL, ICON_RIGHTARROW_THIN, "Make Single User", 0, yco-=20, 120, 19, "");
uiDefIconTextBlockBut(block, view3d_edit_object_makelocalmenu, NULL, ICON_RIGHTARROW_THIN, "Make Local", 0, yco-=20, 120, 19, "");

@ -312,7 +312,7 @@ void poselib_add_current_pose (Object *ob, int val)
/* mode - add new or replace existing */
if (val == 0) {
if ((ob->poselib) && (ob->poselib->markers.first)) {
val= pupmenu("PoseLib Add Current Pose%t|Add New%x1|Replace Existing%x2");
val= pupmenu("PoseLib Add Current Pose%t|Add New%x1|Add New (Current Frame)%x3|Replace Existing%x2");
if (val <= 0) return;
}
else
@ -347,7 +347,10 @@ void poselib_add_current_pose (Object *ob, int val)
act= poselib_validate(ob);
/* get frame */
frame= poselib_get_free_index(act);
if (val == 3)
frame= CFRA;
else /* if (val == 1) */
frame= poselib_get_free_index(act);
/* add pose to poselib - replaces any existing pose there */
for (marker= act->markers.first; marker; marker= marker->next) {

@ -479,6 +479,67 @@ void pose_select_constraint_target(void)
}
void pose_select_hierarchy(short direction, short add_to_sel)
{
Object *ob= OBACT;
bArmature *arm= ob->data;
bPoseChannel *pchan;
Bone *curbone, *pabone, *chbone;
/* paranoia checks */
if (!ob && !ob->pose) return;
if (ob==G.obedit || (ob->flag & OB_POSEMODE)==0) return;
for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
curbone= pchan->bone;
if (arm->layer & curbone->layer) {
if (curbone->flag & (BONE_ACTIVE)) {
if (direction == BONE_SELECT_PARENT) {
if (pchan->parent == NULL) continue;
else pabone= pchan->parent->bone;
if ((arm->layer & pabone->layer) && !(pabone->flag & BONE_HIDDEN_P)) {
if (!add_to_sel) curbone->flag &= ~BONE_SELECTED;
curbone->flag &= ~BONE_ACTIVE;
pabone->flag |= (BONE_ACTIVE|BONE_SELECTED);
select_actionchannel_by_name (ob->action, pchan->name, 0);
select_actionchannel_by_name (ob->action, pchan->parent->name, 1);
break;
}
} else { // BONE_SELECT_CHILD
if (pchan->child == NULL) continue;
else chbone = pchan->child->bone;
if ((arm->layer & chbone->layer) && !(chbone->flag & BONE_HIDDEN_P)) {
if (!add_to_sel) curbone->flag &= ~BONE_SELECTED;
curbone->flag &= ~BONE_ACTIVE;
chbone->flag |= (BONE_ACTIVE|BONE_SELECTED);
select_actionchannel_by_name (ob->action, pchan->name, 0);
select_actionchannel_by_name (ob->action, pchan->child->name, 1);
break;
}
}
}
}
}
allqueue (REDRAWVIEW3D, 0);
allqueue (REDRAWBUTSOBJECT, 0);
allqueue (REDRAWOOPS, 0);
if (direction==BONE_SELECT_PARENT)
BIF_undo_push("Select pose bone parent");
if (direction==BONE_SELECT_CHILD)
BIF_undo_push("Select pose bone child");
}
/* context: active channel */
void pose_special_editmenu(void)
{

@ -2428,7 +2428,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
else if(G.qual==LR_ALTKEY && G.obedit->type==OB_ARMATURE)
clear_bone_parent();
else if((G.qual==0) && (G.obedit->type==OB_ARMATURE))
select_bone_parent();
armature_select_hierarchy(BONE_SELECT_PARENT, 1); // 1 = add to selection
else if((G.qual==(LR_CTRLKEY|LR_ALTKEY)) && (G.obedit->type==OB_ARMATURE))
separate_armature();
else if((G.qual==0) && G.obedit->type==OB_MESH)
@ -2458,7 +2458,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
start_RBSimulation();
}
else if((G.qual==0) && (OBACT) && (OBACT->type==OB_ARMATURE) && (OBACT->flag & OB_POSEMODE))
select_bone_parent();
pose_select_hierarchy(BONE_SELECT_PARENT, 1); // 1 = add to selection
else if((G.qual==0)) {
start_game();
}
@ -2761,6 +2761,19 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
scrarea_queue_winredraw(curarea);
break;
case LEFTBRACKETKEY:
if ((G.obedit) && (G.obedit->type == OB_ARMATURE))
armature_select_hierarchy(BONE_SELECT_PARENT, (G.qual == LR_SHIFTKEY));
else if ((ob) && (ob->flag & OB_POSEMODE))
pose_select_hierarchy(BONE_SELECT_PARENT, (G.qual == LR_SHIFTKEY));
break;
case RIGHTBRACKETKEY:
if ((G.obedit) && (G.obedit->type == OB_ARMATURE))
armature_select_hierarchy(BONE_SELECT_CHILD, (G.qual == LR_SHIFTKEY));
if ((ob) && (ob->flag & OB_POSEMODE))
pose_select_hierarchy(BONE_SELECT_CHILD, (G.qual == LR_SHIFTKEY));
break;
case PADSLASHKEY:
if(G.qual==0) {
if(G.vd->localview) {

@ -125,8 +125,6 @@
void asciitoraw(int ch, unsigned short *event, unsigned short *qual)
{
if( isalpha(ch)==0 ) return;
if( isupper(ch) ) {
*qual= LEFTSHIFTKEY;
ch= tolower(ch);
@ -804,7 +802,10 @@ static void tb_do_hotkey(void *arg, int event)
case 'd': key= PAGEDOWNKEY; break;
}
}
else asciitoraw(event, &key, &qual[3]);
else if (isalpha(event))
asciitoraw(event, &key, &qual[3]);
else if (event == '~')
key = ACCENTGRAVEKEY;
for (i=0;i<4;i++)
{
@ -1213,6 +1214,8 @@ static TBitem tb_view[]= {
{ 0, "Ortho/Perspective|NumPad 5", TB_PAD|'5', NULL},
{ 0, "Local/Global View|NumPad /", TB_PAD|'/', NULL},
{ 0, "SEPR", 0, NULL},
{ 0, "Show All Layers|Shift ~", TB_SHIFT|'~', NULL},
{ 0, "SEPR", 0, NULL},
{ 0, "Align View", 0, tb_view_alignview},
{ 0, "SEPR", 0, NULL},
{ 0, "View Selected|NumPad .", TB_PAD|'.', NULL},

@ -335,7 +335,7 @@ extern "C" void StartKetsjiShell(struct ScrArea *area,
PyDict_SetItemString(dictionaryobject, "GameLogic", gameLogic); // Same as importing the module.
initGameKeys();
initPythonConstraintBinding();
initMathutils();
if (sceneconverter)
{
@ -602,6 +602,7 @@ extern "C" void StartKetsjiShellSimulation(struct ScrArea *area,
PyDict_SetItemString(dictionaryobject, "GameLogic", gameLogic); // Same as importing the module
initGameKeys();
initPythonConstraintBinding();
initMathutils();
if (sceneconverter)
{

@ -1939,7 +1939,17 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
float* fl = (float*) blenderobject->parentinv;
MT_Transform parinvtrans(fl);
parentinversenode->SetLocalPosition(parinvtrans.getOrigin());
parentinversenode->SetLocalOrientation(parinvtrans.getBasis());
// problem here: the parent inverse transform combines scaling and rotation
// in the basis but the scenegraph needs separate rotation and scaling.
// This is not important for OpenGL (it uses 4x4 matrix) but it is important
// for the physic engine that needs a separate scaling
//parentinversenode->SetLocalOrientation(parinvtrans.getBasis());
// Extract the rotation and the scaling from the basis
MT_Matrix3x3 inverseOrientation(parinvtrans.getRotation());
parentinversenode->SetLocalOrientation(inverseOrientation);
MT_Matrix3x3 scale(inverseOrientation.transposed()*parinvtrans.getBasis());
parentinversenode->SetLocalScale(MT_Vector3(scale[0][0], scale[1][1], scale[2][2]));
parentinversenode->AddChild(gameobj->GetSGNode());
}

@ -766,15 +766,18 @@ void BL_ConvertMaterialIpos(
// if there is only one material attached to the mesh then set material_index in BL_ConvertMaterialIpos to NULL
// --> this makes the UpdateMaterialData function in KX_GameObject.cpp use the old hack of using SetObjectColor
// because this yields a better performance as not all the vertex colors need to be edited
if(mat) ConvertMaterialIpos(mat, NULL, gameobj, converter);
if(mat) ConvertMaterialIpos(mat, 0, gameobj, converter);
}
else
{
for (int material_index=1; material_index <= blenderobject->totcol; material_index++)
{
Material *mat = give_current_material(blenderobject, material_index);
STR_HashedString matname = mat->id.name;
if(mat) ConvertMaterialIpos(mat, matname.hash(), gameobj, converter);
STR_HashedString matname;
if(mat) {
matname= mat->id.name;
ConvertMaterialIpos(mat, matname.hash(), gameobj, converter);
}
}
}
}

@ -36,7 +36,7 @@
#include <iostream>
#include <windows.h>
#include <gl/gl.h>
//#include <gl/gl.h>
#include "GPC_Canvas.h"

@ -56,6 +56,7 @@ extern "C"
#include "BLO_readfile.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "DNA_scene_types.h"
#ifdef __cplusplus
}
#endif // __cplusplus
@ -647,7 +648,7 @@ bool GPG_Application::startEngine(void)
PyDict_SetItemString(dictionaryobject, "GameLogic", initGameLogic(startscene)); // Same as importing the module
initGameKeys();
initPythonConstraintBinding();
initMathutils();
@ -669,6 +670,11 @@ bool GPG_Application::startEngine(void)
m_ketsjiengine->StartEngine(true);
m_engineRunning = true;
// Set the animation playback rate for ipo's and actions
// the framerate below should patch with FPS macro defined in blendef.h
// Could be in StartEngine set the framerate, we need the scene to do this
m_ketsjiengine->SetAnimFrameRate( (((double) G.scene->r.frs_sec) / G.scene->r.frs_sec_base) );
}
if (!m_engineRunning)

@ -25,6 +25,17 @@
# ***** END GPL LICENSE BLOCK *****
FILE(GLOB SRC *.cpp)
SET(SRC
${SRC}
../../../source/blender/python/api2_2x/Mathutils.c
../../../source/blender/python/api2_2x/constant.c
../../../source/blender/python/api2_2x/euler.c
../../../source/blender/python/api2_2x/gen_utils.c
../../../source/blender/python/api2_2x/matrix.c
../../../source/blender/python/api2_2x/point.c
../../../source/blender/python/api2_2x/quat.c
../../../source/blender/python/api2_2x/vector.c
)
SET(INC
.
@ -39,7 +50,8 @@ SET(INC
../../../intern/moto/include
../../../source/gameengine/Ketsji
../../../source/blender/blenlib
../../../source/blender/blenkernel
../../../source/blender/blenkernel
../../../source/blender/python/api2_2x
../../../source/blender
../../../source/blender/include
../../../source/blender/makesdna

@ -914,6 +914,7 @@ PyMethodDef KX_GameObject::Methods[] = {
KX_PYMETHODTABLE(KX_GameObject, rayCastTo),
KX_PYMETHODTABLE(KX_GameObject, rayCast),
KX_PYMETHODTABLE(KX_GameObject, getDistanceTo),
KX_PYMETHODTABLE(KX_GameObject, getVectTo),
{NULL,NULL} //Sentinel
};
@ -1367,14 +1368,15 @@ PyObject* KX_GameObject::PyGetMesh(PyObject* self,
{
int mesh = 0;
if (PyArg_ParseTuple(args, "|i", &mesh))
if (!PyArg_ParseTuple(args, "|i", &mesh))
return NULL; // python sets a simple error
if (((unsigned int)mesh < m_meshes.size()) && mesh >= 0)
{
if (((unsigned int)mesh < m_meshes.size()) && mesh >= 0)
{
KX_MeshProxy* meshproxy = new KX_MeshProxy(m_meshes[mesh]);
return meshproxy;
}
KX_MeshProxy* meshproxy = new KX_MeshProxy(m_meshes[mesh]);
return meshproxy;
}
Py_RETURN_NONE;
}
@ -1488,6 +1490,9 @@ PyObject* KX_GameObject::PyAlignAxisToVect(PyObject* self,
MT_Vector3 vect;
if (PyVecTo(pyvect, vect))
{
if (fac<=0.0) Py_RETURN_NONE; // Nothing to do.
if (fac> 1.0) fac= 1.0;
AlignAxisToVect(vect,axis,fac);
NodeUpdateGS(0.f,true);
Py_RETURN_NONE;
@ -1555,6 +1560,54 @@ KX_PYMETHODDEF_DOC(KX_GameObject, getDistanceTo,
return NULL;
}
KX_PYMETHODDEF_DOC(KX_GameObject, getVectTo,
"getVectTo(other): get vector and the distance to another point/KX_GameObject\n"
"Returns a 3-tuple with (distance,worldVector,localVector)\n")
{
MT_Point3 toPoint, fromPoint;
MT_Vector3 toDir, locToDir;
MT_Scalar distance;
PyObject *returnValue;
PyObject *pyother;
if (!PyVecArgTo(args, toPoint))
{
PyErr_Clear();
if (PyArg_ParseTuple(args, "O!", &KX_GameObject::Type, &pyother))
{
KX_GameObject *other = static_cast<KX_GameObject*>(pyother);
toPoint = other->NodeGetWorldPosition();
}else
{
PyErr_SetString(PyExc_TypeError, "Expected a 3D Vector or GameObject type");
return NULL;
}
}
fromPoint = NodeGetWorldPosition();
toDir = toPoint-fromPoint;
distance = toDir.length();
if (MT_fuzzyZero(distance))
{
//cout << "getVectTo() Error: Null vector!\n";
locToDir = toDir = MT_Vector3(0.0,0.0,0.0);
distance = 0.0;
} else {
toDir.normalize();
locToDir = toDir * NodeGetWorldOrientation();
}
returnValue = PyTuple_New(3);
if (returnValue) { // very unlikely to fail, python sets a memory error here.
PyTuple_SET_ITEM(returnValue, 0, PyFloat_FromDouble(distance));
PyTuple_SET_ITEM(returnValue, 1, PyObjectFrom(toDir));
PyTuple_SET_ITEM(returnValue, 2, PyObjectFrom(locToDir));
}
return returnValue;
}
bool KX_GameObject::RayHit(KX_ClientObjectInfo* client, MT_Point3& hit_point, MT_Vector3& hit_normal, void * const data)
{
@ -1588,8 +1641,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo,
char *propName = NULL;
if (!PyArg_ParseTuple(args,"O|fs", &pyarg, &dist, &propName)) {
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
return NULL;
return NULL; // python sets simple error
}
if (!PyVecTo(pyarg, toPoint))
@ -1654,8 +1706,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCast,
KX_GameObject *other;
if (!PyArg_ParseTuple(args,"O|Ofs", &pyto, &pyfrom, &dist, &propName)) {
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
return NULL;
return NULL; // Python sets a simple error
}
if (!PyVecTo(pyto, toPoint))
@ -1714,13 +1765,11 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCast,
if (m_pHitObject)
{
PyObject* returnValue = PyTuple_New(3);
if (!returnValue) {
PyErr_SetString(PyExc_TypeError, "PyTuple_New() failed");
return NULL;
if (returnValue) { // unlikely this would ever fail, if it does python sets an error
PyTuple_SET_ITEM(returnValue, 0, m_pHitObject->AddRef());
PyTuple_SET_ITEM(returnValue, 1, PyObjectFrom(resultPoint));
PyTuple_SET_ITEM(returnValue, 2, PyObjectFrom(resultNormal));
}
PyTuple_SET_ITEM(returnValue, 0, m_pHitObject->AddRef());
PyTuple_SET_ITEM(returnValue, 1, PyObjectFrom(resultPoint));
PyTuple_SET_ITEM(returnValue, 2, PyObjectFrom(resultNormal));
return returnValue;
}
return Py_BuildValue("OOO", Py_None, Py_None, Py_None);

@ -756,6 +756,7 @@ public:
KX_PYMETHOD_DOC(KX_GameObject,rayCastTo);
KX_PYMETHOD_DOC(KX_GameObject,rayCast);
KX_PYMETHOD_DOC(KX_GameObject,getDistanceTo);
KX_PYMETHOD_DOC(KX_GameObject,getVectTo);
private :

@ -62,6 +62,10 @@
#include "KX_PyMath.h"
extern "C" {
#include "Mathutils.h" // Blender.Mathutils module copied here so the blenderlayer can use.
}
#include "PHY_IPhysicsEnvironment.h"
// FIXME: Enable for access to blender python modules. This is disabled because
// python has dependencies on a lot of other modules and is a pain to link.
@ -733,7 +737,7 @@ PyObject* initGameLogic(KX_Scene* scene) // quick hack to get gravity hook
ErrorObject = PyString_FromString("GameLogic.error");
PyDict_SetItemString(d, "error", ErrorObject);
// XXXX Add constants here
/* To use logic bricks, we need some sort of constants. Here, we associate */
/* constants and sumbolic names. Add them to dictionary d. */
@ -876,7 +880,7 @@ PyObject *KXpy_import(PyObject *self, PyObject *args)
/* quick hack for GamePython modules
TODO: register builtin modules properly by ExtendInittab */
if (!strcmp(name, "GameLogic") || !strcmp(name, "GameKeys") || !strcmp(name, "PhysicsConstraints") ||
!strcmp(name, "Rasterizer")) {
!strcmp(name, "Rasterizer") || !strcmp(name, "Mathutils")) {
return PyImport_ImportModuleEx(name, globals, locals, fromlist);
}
@ -1169,6 +1173,11 @@ PyObject* initGameKeys()
return d;
}
PyObject* initMathutils()
{
return Mathutils_Init("Mathutils"); // Use as a top level module in BGE
}
void PHY_SetActiveScene(class KX_Scene* scene)
{
gp_KetsjiScene = scene;

@ -44,6 +44,7 @@ PyObject* initGameLogic(class KX_Scene* ketsjiscene);
PyObject* initGameKeys();
PyObject* initRasterizer(class RAS_IRasterizer* rasty,class RAS_ICanvas* canvas);
PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecurityLevel level);
PyObject* initMathutils();
void exitGamePlayerPythonScripting();
PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLevel level);
void exitGamePythonScripting();

@ -147,23 +147,23 @@ void KX_RadarSensor::SynchronizeTransform()
};
case 3: // -X Axis
{
MT_Quaternion rotquatje(MT_Vector3(0,0,1),MT_radians(90));
MT_Quaternion rotquatje(MT_Vector3(0,0,1),MT_radians(-90));
trans.rotate(rotquatje);
trans.translate(MT_Vector3 (0, m_coneheight/2.0 ,0));
trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0));
break;
};
case 4: // -Y Axis
{
MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(-180));
trans.rotate(rotquatje);
trans.translate(MT_Vector3 (0, m_coneheight/2.0 ,0));
//MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(-180));
//trans.rotate(rotquatje);
trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0));
break;
};
case 5: // -Z Axis
{
MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(-90));
MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(90));
trans.rotate(rotquatje);
trans.translate(MT_Vector3 (0, m_coneheight/2.0 ,0));
trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0));
break;
};
default:

@ -100,17 +100,17 @@ bool KX_TouchEventManager::newBroadphaseResponse(void *client_data,
void KX_TouchEventManager::RegisterSensor(SCA_ISensor* sensor)
{
KX_TouchSensor* touchsensor = static_cast<KX_TouchSensor*>(sensor);
m_sensors.insert(touchsensor);
touchsensor->RegisterSumo(this);
if (m_sensors.insert(touchsensor).second)
// the sensor was effectively inserted, register it
touchsensor->RegisterSumo(this);
}
void KX_TouchEventManager::RemoveSensor(SCA_ISensor* sensor)
{
KX_TouchSensor* touchsensor = static_cast<KX_TouchSensor*>(sensor);
m_sensors.erase(touchsensor);
touchsensor->UnregisterSumo(this);
if (m_sensors.erase(touchsensor))
// the sensor was effectively removed, unregister it
touchsensor->UnregisterSumo(this);
}

@ -5,7 +5,21 @@ Import ('env')
sources = env.Glob('*.cpp')
incs = '. #source/kernel/gen_system #intern/string #intern/guardedalloc'
# Mathutils C files.
sources.extend([\
'#source/blender/python/api2_2x/Mathutils.c',\
'#source/blender/python/api2_2x/constant.c',\
'#source/blender/python/api2_2x/euler.c',\
'#source/blender/python/api2_2x/gen_utils.c',\
'#source/blender/python/api2_2x/matrix.c',\
'#source/blender/python/api2_2x/point.c',\
'#source/blender/python/api2_2x/quat.c',\
'#source/blender/python/api2_2x/vector.c',\
])
incs = '. #source/blender/python/api2_2x' # Only for Mathutils! - no other deps
incs += ' #source/kernel/gen_system #intern/string #intern/guardedalloc'
incs += ' #source/gameengine/Rasterizer/RAS_OpenGLRasterizer #intern/bmfont'
incs += ' #intern/SoundSystem #intern/SoundSystem/include #intern/SoundSystem/openal'
incs += ' #intern/SoundSystem/dummy #intern/SoundSystem/intern #source/gameengine/Converter'

@ -42,7 +42,8 @@ CcdPhysicsController::CcdPhysicsController (const CcdConstructionInfo& ci)
{
m_collisionDelay = 0;
m_newClientInfo = 0;
m_registerCount = 0;
m_MotionState = ci.m_MotionState;
m_bulletMotionState = 0;
@ -217,7 +218,7 @@ void CcdPhysicsController::WriteDynamicsToMotionState()
void CcdPhysicsController::PostProcessReplica(class PHY_IMotionState* motionstate,class PHY_IPhysicsController* parentctrl)
{
m_MotionState = motionstate;
m_registerCount = 0;
m_body = 0;

@ -110,12 +110,19 @@ class CcdPhysicsController : public PHY_IPhysicsController
void* m_newClientInfo;
int m_registerCount; // needed when multiple sensors use the same controller
CcdConstructionInfo m_cci;//needed for replication
void GetWorldOrientation(btMatrix3x3& mat);
void CreateRigidbody();
bool Register() {
return (m_registerCount++ == 0) ? true : false;
}
bool Unregister() {
return (--m_registerCount == 0) ? true : false;
}
protected:
void setWorldOrientation(const btMatrix3x3& mat);

@ -439,6 +439,9 @@ void CcdPhysicsEnvironment::removeCcdPhysicsController(CcdPhysicsController* ctr
m_dynamicsWorld->removeRigidBody(ctrl->GetRigidBody());
m_controllers.erase(ctrl);
if (ctrl->m_registerCount != 0)
printf("Warning: removing controller with non-zero m_registerCount: %d\n", ctrl->m_registerCount);
//remove it from the triggers
m_triggerControllers.erase(ctrl);
}
@ -473,6 +476,13 @@ void CcdPhysicsEnvironment::enableCcdPhysicsController(CcdPhysicsController* ctr
}
}
void CcdPhysicsEnvironment::disableCcdPhysicsController(CcdPhysicsController* ctrl)
{
if (m_controllers.erase(ctrl))
{
m_dynamicsWorld->removeRigidBody(ctrl->GetRigidBody());
}
}
void CcdPhysicsEnvironment::beginFrame()
@ -885,13 +895,17 @@ void CcdPhysicsEnvironment::addSensor(PHY_IPhysicsController* ctrl)
void CcdPhysicsEnvironment::removeCollisionCallback(PHY_IPhysicsController* ctrl)
{
m_triggerControllers.erase((CcdPhysicsController*)ctrl);
CcdPhysicsController* ccdCtrl = (CcdPhysicsController*)ctrl;
if (ccdCtrl->Unregister())
m_triggerControllers.erase(ccdCtrl);
}
void CcdPhysicsEnvironment::removeSensor(PHY_IPhysicsController* ctrl)
{
removeCcdPhysicsController((CcdPhysicsController*)ctrl);
removeCollisionCallback(ctrl);
disableCcdPhysicsController((CcdPhysicsController*)ctrl);
}
void CcdPhysicsEnvironment::addTouchCallback(int response_class, PHY_ResponseCallback callback, void *user)
@ -930,8 +944,8 @@ void CcdPhysicsEnvironment::requestCollisionCallback(PHY_IPhysicsController* ctr
{
CcdPhysicsController* ccdCtrl = static_cast<CcdPhysicsController*>(ctrl);
//printf("requestCollisionCallback\n");
m_triggerControllers.insert(ccdCtrl);
if (ccdCtrl->Register())
m_triggerControllers.insert(ccdCtrl);
}
void CcdPhysicsEnvironment::CallbackTriggers()
@ -942,13 +956,16 @@ void CcdPhysicsEnvironment::CallbackTriggers()
if (m_triggerCallbacks[PHY_OBJECT_RESPONSE] || (m_debugDrawer && (m_debugDrawer->getDebugMode() & btIDebugDraw::DBG_DrawContactPoints)))
{
//walk over all overlapping pairs, and if one of the involved bodies is registered for trigger callback, perform callback
int numManifolds = m_dynamicsWorld->getDispatcher()->getNumManifolds();
btDispatcher* dispatcher = m_dynamicsWorld->getDispatcher();
int numManifolds = dispatcher->getNumManifolds();
for (int i=0;i<numManifolds;i++)
{
btPersistentManifold* manifold = m_dynamicsWorld->getDispatcher()->getManifoldByIndexInternal(i);
btPersistentManifold* manifold = dispatcher->getManifoldByIndexInternal(i);
int numContacts = manifold->getNumContacts();
if (numContacts)
{
btRigidBody* rb0 = static_cast<btRigidBody*>(manifold->getBody0());
btRigidBody* rb1 = static_cast<btRigidBody*>(manifold->getBody1());
if (m_debugDrawer && (m_debugDrawer->getDebugMode() & btIDebugDraw::DBG_DrawContactPoints))
{
for (int j=0;j<numContacts;j++)
@ -959,8 +976,8 @@ void CcdPhysicsEnvironment::CallbackTriggers()
m_debugDrawer->drawContactPoint(cp.m_positionWorldOnB,cp.m_normalWorldOnB,cp.getDistance(),cp.getLifeTime(),color);
}
}
btRigidBody* obj0 = static_cast<btRigidBody* >(manifold->getBody0());
btRigidBody* obj1 = static_cast<btRigidBody* >(manifold->getBody1());
btRigidBody* obj0 = rb0;
btRigidBody* obj1 = rb1;
//m_internalOwner is set in 'addPhysicsController'
CcdPhysicsController* ctrl0 = static_cast<CcdPhysicsController*>(obj0->getUserPointer());
@ -977,6 +994,15 @@ void CcdPhysicsEnvironment::CallbackTriggers()
m_triggerCallbacks[PHY_OBJECT_RESPONSE](m_triggerCallbacksUserPtrs[PHY_OBJECT_RESPONSE],
ctrl0,ctrl1,0);
}
// Bullet does not refresh the manifold contact point for object without contact response
// may need to remove this when a newer Bullet version is integrated
if (!dispatcher->needsResponse(rb0, rb1))
{
// Refresh algorithm fails sometimes when there is penetration
// (usuall the case with ghost and sensor objects)
// Let's just clear the manifold, in any case, it is recomputed on each frame.
manifold->clearManifold(); //refreshContactPoints(rb0->getCenterOfMassTransform(),rb1->getCenterOfMassTransform());
}
}
}

@ -186,10 +186,7 @@ protected:
void updateCcdPhysicsController(CcdPhysicsController* ctrl, btScalar newMass, int newCollisionFlags, short int newCollisionGroup, short int newCollisionMask);
void disableCcdPhysicsController(CcdPhysicsController* ctrl)
{
removeCcdPhysicsController(ctrl);
}
void disableCcdPhysicsController(CcdPhysicsController* ctrl);
void enableCcdPhysicsController(CcdPhysicsController* ctrl);

@ -253,6 +253,16 @@ class KX_GameObject:
@type other: L{KX_GameObject} or list [x, y, z]
@rtype: float
"""
def getVectTo(other):
"""
Returns the vector and the distance to another object or point.
The vector is normalized unless the distance is 0, in which a NULL vector is returned.
@param other: a point or another L{KX_GameObject} to get the vector and distance to.
@type other: L{KX_GameObject} or list [x, y, z]
@rtype: 3-tuple (float, 3-tuple (x,y,z), 3-tuple (x,y,z))
@return: (distance, globalVector(3), localVector(3))
"""
def rayCastTo(other,dist,prop):
"""
Look towards another point/object and find first object hit within dist that matches prop.