merging trunk 15964 -> 16116
This commit is contained in:
commit
db42038bcf
@ -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)
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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,7 +232,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"
|
||||
@ -285,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"
|
||||
|
@ -1 +1 @@
|
||||
2.46
|
||||
2.47
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 50 KiB |
@ -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)
|
||||
|
||||
|
@ -7,7 +7,7 @@ Group: 'Import'
|
||||
Tooltip: 'Import for DXF geometry data (Drawing eXchange Format).'
|
||||
"""
|
||||
__author__ = 'Kitsu(Ed Blake) & migius(Remigiusz Fiedler)'
|
||||
__version__ = '1.12 - 2008.07.04 by migius'
|
||||
__version__ = '1.12 - 2008.08.03 by migius'
|
||||
__url__ = ["http://blenderartists.org/forum/showthread.php?t=84319",
|
||||
"http://wiki.blender.org/index.php/Scripts/Manual/Import/DXF-3D"]
|
||||
__email__ = ["migius(at)4d-vectors.de","Kitsune_e(at)yahoo.com"]
|
||||
@ -88,7 +88,7 @@ in creating new objects in scene database - probably a database management probl
|
||||
|
||||
"""
|
||||
History:
|
||||
v1.0 - 2008.01. by migius
|
||||
v1.0 - 2007/2008 by migius
|
||||
planned tasks:
|
||||
-- (to see more, search for "--todo--" in script code)
|
||||
-- command-line-mode/batch-mode
|
||||
|
@ -13,7 +13,7 @@ from Blender import Mesh, Scene, Window, sys, Image, Draw
|
||||
import BPyMesh
|
||||
|
||||
__author__ = "Bruce Merry"
|
||||
__version__ = "0.92"
|
||||
__version__ = "0.93"
|
||||
__bpydoc__ = """\
|
||||
This script exports Stanford PLY files from Blender. It supports normals,
|
||||
colours, and texture coordinates per face or per vertex.
|
||||
@ -37,6 +37,8 @@ Only one mesh can be exported at a time.
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# Vector rounding se we can use as keys
|
||||
#
|
||||
# Updated on Aug 11, 2008 by Campbell Barton
|
||||
# - added 'comment' prefix to comments - Needed to comply with the PLY spec.
|
||||
#
|
||||
# Updated on Jan 1, 2007 by Gabe Ghearing
|
||||
# - fixed normals so they are correctly smooth/flat
|
||||
@ -162,7 +164,7 @@ def file_callback(filename):
|
||||
|
||||
file.write('ply\n')
|
||||
file.write('format ascii 1.0\n')
|
||||
file.write('Created by Blender3D %s - www.blender.org, source file: %s\n' % (Blender.Get('version'), Blender.Get('filename').split('/')[-1].split('\\')[-1] ))
|
||||
file.write('comment Created by Blender3D %s - www.blender.org, source file: %s\n' % (Blender.Get('version'), Blender.Get('filename').split('/')[-1].split('\\')[-1] ))
|
||||
|
||||
file.write('element vertex %d\n' % len(verts))
|
||||
|
||||
@ -210,7 +212,6 @@ def file_callback(filename):
|
||||
if faceUV: uvcoord= rvec2d(uv[j])
|
||||
elif vertexUV: uvcoord= rvec2d(v.uvco)
|
||||
if vertexColors: color= col[j].r, col[j].g, col[j].b
|
||||
co = v.co
|
||||
|
||||
file.write('%d ' % vdict[v.index][normal, uvcoord, color])
|
||||
|
||||
|
@ -40,8 +40,8 @@ extern "C" {
|
||||
struct ListBase;
|
||||
struct MemFile;
|
||||
|
||||
#define BLENDER_VERSION 246
|
||||
#define BLENDER_SUBVERSION 1
|
||||
#define BLENDER_VERSION 247
|
||||
#define BLENDER_SUBVERSION 0
|
||||
|
||||
#define BLENDER_MINVERSION 245
|
||||
#define BLENDER_MINSUBVERSION 15
|
||||
|
@ -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);
|
||||
|
@ -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"
|
||||
@ -2999,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)
|
||||
{
|
||||
@ -7354,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;
|
||||
|
@ -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;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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
@ -116,6 +116,7 @@ void setflag_armature(short mode);
|
||||
void unique_editbone_name (struct ListBase *ebones, char *name);
|
||||
|
||||
void auto_align_armature(short mode);
|
||||
void switch_direction_armature(void);
|
||||
|
||||
void create_vgroups_from_armature(struct Object *ob, struct Object *par);
|
||||
void add_verts_to_dgroups(struct Object *ob, struct Object *par, int heat, int mirror);
|
||||
@ -137,7 +138,6 @@ void transform_armature_mirror_update(void);
|
||||
void hide_selected_armature_bones(void);
|
||||
void hide_unselected_armature_bones(void);
|
||||
void show_all_armature_bones(void);
|
||||
void set_locks_armature_bones(short lock);
|
||||
|
||||
#define BONESEL_ROOT 0x10000000
|
||||
#define BONESEL_TIP 0x20000000
|
||||
@ -149,6 +149,10 @@ void set_locks_armature_bones(short lock);
|
||||
/* from autoarmature */
|
||||
void BIF_retargetArmature();
|
||||
|
||||
/* useful macros */
|
||||
#define EBONE_VISIBLE(arm, ebone) ((arm->layer & ebone->layer) && !(ebone->flag & BONE_HIDDEN_A))
|
||||
#define EBONE_EDITABLE(ebone) ((ebone->flag & BONE_SELECTED) && !(ebone->flag & BONE_EDITMODE_LOCKED))
|
||||
|
||||
/* used in bone_select_hierachy() */
|
||||
#define BONE_SELECT_PARENT 0
|
||||
#define BONE_SELECT_CHILD 1
|
||||
|
@ -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);
|
||||
|
@ -594,7 +594,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
|
||||
|
@ -163,7 +163,7 @@ PyObject *RunPython( Text * text, PyObject * globaldict );
|
||||
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 );
|
||||
@ -1104,12 +1104,10 @@ int BPY_menu_do_python( short menutype, int event )
|
||||
*****************************************************************************/
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@ -2780,48 +2778,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 ) {
|
||||
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, text->id.name+2, 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 );
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -105,6 +105,10 @@
|
||||
#define EXPP_TEX_LACUNARITY_MAX 6.0f
|
||||
#define EXPP_TEX_OCTS_MIN 0.0f
|
||||
#define EXPP_TEX_OCTS_MAX 8.0f
|
||||
#define EXPP_TEX_OFST_MIN 0.0f
|
||||
#define EXPP_TEX_OFST_MAX 6.0f
|
||||
#define EXPP_TEX_GAIN_MIN 0.0f
|
||||
#define EXPP_TEX_GAIN_MAX 6.0f
|
||||
#define EXPP_TEX_ISCALE_MIN 0.0f
|
||||
#define EXPP_TEX_ISCALE_MAX 10.0f
|
||||
#define EXPP_TEX_EXP_MIN 0.010f
|
||||
@ -430,6 +434,8 @@ GETFUNC( getNoiseDepth );
|
||||
GETFUNC( getNoiseSize );
|
||||
GETFUNC( getNoiseType );
|
||||
GETFUNC( getOcts );
|
||||
GETFUNC( getOffset );
|
||||
GETFUNC( getGain );
|
||||
GETFUNC( getRepeat );
|
||||
GETFUNC( getRGBCol );
|
||||
GETFUNC( getSType );
|
||||
@ -478,6 +484,8 @@ SETFUNC( setNoiseDepth );
|
||||
SETFUNC( setNoiseSize );
|
||||
SETFUNC( setNoiseType );
|
||||
SETFUNC( setOcts );
|
||||
SETFUNC( setOffset );
|
||||
SETFUNC( setGain );
|
||||
SETFUNC( setRepeat );
|
||||
SETFUNC( setRGBCol );
|
||||
SETFUNC( setSType );
|
||||
@ -646,6 +654,14 @@ static PyGetSetDef BPy_Texture_getseters[] = {
|
||||
(getter)Texture_getLacunarity, (setter)Texture_setLacunarity,
|
||||
"Gap between succesive frequencies (for Musgrave textures)",
|
||||
NULL},
|
||||
{"offset",
|
||||
(getter)Texture_getOffset, (setter)Texture_setOffset,
|
||||
"Fractal offset (for Musgrave textures)",
|
||||
NULL},
|
||||
{"gain",
|
||||
(getter)Texture_getGain, (setter)Texture_setGain,
|
||||
"Gain multiplier (for Musgrave textures)",
|
||||
NULL},
|
||||
{"noiseBasis",
|
||||
(getter)Texture_getNoiseBasis, (setter)Texture_setNoiseBasis,
|
||||
"Noise basis type (wood, stucci, marble, clouds, Musgrave, distorted noise)",
|
||||
@ -1837,6 +1853,20 @@ static int Texture_setLacunarity( BPy_Texture * self, PyObject * value )
|
||||
EXPP_TEX_LACUNARITY_MAX );
|
||||
}
|
||||
|
||||
static int Texture_setOffset( BPy_Texture * self, PyObject * value )
|
||||
{
|
||||
return EXPP_setFloatClamped ( value, &self->texture->mg_offset,
|
||||
EXPP_TEX_OFST_MIN,
|
||||
EXPP_TEX_OFST_MAX );
|
||||
}
|
||||
|
||||
static int Texture_setGain( BPy_Texture * self, PyObject * value )
|
||||
{
|
||||
return EXPP_setFloatClamped ( value, &self->texture->mg_gain,
|
||||
EXPP_TEX_GAIN_MIN,
|
||||
EXPP_TEX_GAIN_MAX );
|
||||
}
|
||||
|
||||
static int Texture_setOcts( BPy_Texture * self, PyObject * value )
|
||||
{
|
||||
return EXPP_setFloatClamped ( value, &self->texture->mg_octaves,
|
||||
@ -2168,6 +2198,16 @@ static PyObject *Texture_getOcts( BPy_Texture *self )
|
||||
return PyFloat_FromDouble( self->texture->mg_octaves );
|
||||
}
|
||||
|
||||
static PyObject *Texture_getOffset( BPy_Texture *self )
|
||||
{
|
||||
return PyFloat_FromDouble( self->texture->mg_offset );
|
||||
}
|
||||
|
||||
static PyObject *Texture_getGain( BPy_Texture *self )
|
||||
{
|
||||
return PyFloat_FromDouble( self->texture->mg_gain );
|
||||
}
|
||||
|
||||
static PyObject *Texture_getRepeat( BPy_Texture *self )
|
||||
{
|
||||
return Py_BuildValue( "(i,i)", self->texture->xrepeat,
|
||||
|
@ -170,17 +170,6 @@ def SetRenderWinPos(locationList):
|
||||
the location of the Render window on the screen.
|
||||
"""
|
||||
|
||||
def EnableEdgeShift():
|
||||
"""
|
||||
Globally with the unified renderer enabled the outlines of the render
|
||||
are shifted a bit.
|
||||
"""
|
||||
|
||||
def EnableEdgeAll():
|
||||
"""
|
||||
Globally consider transparent faces for edge-rendering with the unified renderer.
|
||||
"""
|
||||
|
||||
class RenderData:
|
||||
"""
|
||||
The RenderData object
|
||||
@ -772,7 +761,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 +770,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.
|
||||
"""
|
||||
|
@ -344,6 +344,12 @@ class Texture:
|
||||
@ivar octs: Number of frequencies (for Musgrave textures).
|
||||
Value is clamped to the range [0.0,8.0].
|
||||
@type octs: float
|
||||
@ivar offset: Fractal offset (for hetero terrain and multifractal Musgrave textures).
|
||||
Value is clamped to the range [0.0,6.0].
|
||||
@type offset: float
|
||||
@ivar gain: Gain multiplier (for multifractal Musgrave textures).
|
||||
Value is clamped to the range [0.0,6.0].
|
||||
@type gain: float
|
||||
@ivar repeat: Repetition multiplier (for image textures).
|
||||
@type repeat: tuple of 2 ints
|
||||
@ivar rgbCol: RGB color tuple.
|
||||
|
@ -263,7 +263,12 @@ static void shade_ray(Isect *is, ShadeInput *shi, ShadeResult *shr)
|
||||
shade_input_set_shade_texco(shi);
|
||||
|
||||
if(is->mode==RE_RAY_SHADOW_TRA)
|
||||
shade_color(shi, shr);
|
||||
if(shi->mat->nodetree && shi->mat->use_nodes) {
|
||||
ntreeShaderExecTree(shi->mat->nodetree, shi, shr);
|
||||
shi->mat= vlr->mat; /* shi->mat is being set in nodetree */
|
||||
}
|
||||
else
|
||||
shade_color(shi, shr);
|
||||
else {
|
||||
if(shi->mat->nodetree && shi->mat->use_nodes) {
|
||||
ntreeShaderExecTree(shi->mat->nodetree, shi, shr);
|
||||
|
@ -5746,13 +5746,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 */
|
||||
@ -5770,45 +5766,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)
|
||||
@ -6245,8 +6215,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");
|
||||
@ -6257,24 +6239,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);
|
||||
|
@ -854,6 +854,7 @@ static void separate_armature_bones (Object *ob, short sel)
|
||||
BLI_freelistN(&edbo);
|
||||
}
|
||||
|
||||
/* separate selected bones into their armature */
|
||||
void separate_armature (void)
|
||||
{
|
||||
Object *oldob, *newob;
|
||||
@ -1094,13 +1095,13 @@ void armature_select_hierarchy(short direction, short add_to_sel)
|
||||
arm= (bArmature *)ob->data;
|
||||
|
||||
for (curbone= G.edbo.first; curbone; curbone= curbone->next) {
|
||||
if (arm->layer & curbone->layer) {
|
||||
if (EBONE_VISIBLE(arm, curbone)) {
|
||||
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)) {
|
||||
if (EBONE_VISIBLE(arm, pabone)) {
|
||||
pabone->flag |= (BONE_ACTIVE|BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
|
||||
if (pabone->parent) pabone->parent->flag |= BONE_TIPSEL;
|
||||
|
||||
@ -1109,11 +1110,12 @@ void armature_select_hierarchy(short direction, short add_to_sel)
|
||||
break;
|
||||
}
|
||||
|
||||
} else { // BONE_SELECT_CHILD
|
||||
}
|
||||
else { // BONE_SELECT_CHILD
|
||||
chbone = editbone_get_child(curbone, 1);
|
||||
if (chbone == NULL) continue;
|
||||
|
||||
if ((arm->layer & chbone->layer) && !(chbone->flag & BONE_HIDDEN_A)) {
|
||||
if (EBONE_VISIBLE(arm, chbone)) {
|
||||
chbone->flag |= (BONE_ACTIVE|BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
|
||||
|
||||
if (!add_to_sel) {
|
||||
@ -1159,17 +1161,18 @@ void setflag_armature (short mode)
|
||||
|
||||
/* get flag to set (sync these with the ones used in eBone_Flag */
|
||||
if (mode == 2)
|
||||
flag= pupmenu("Disable Setting%t|Draw Wire%x1|Deform%x2|Mult VG%x3|Hinge%x4|No Scale%x5");
|
||||
flag= pupmenu("Disable Setting%t|Draw Wire%x1|Deform%x2|Mult VG%x3|Hinge%x4|No Scale%x5|Locked%x6");
|
||||
else if (mode == 1)
|
||||
flag= pupmenu("Enable Setting%t|Draw Wire%x1|Deform%x2|Mult VG%x3|Hinge%x4|No Scale%x5");
|
||||
flag= pupmenu("Enable Setting%t|Draw Wire%x1|Deform%x2|Mult VG%x3|Hinge%x4|No Scale%x5|Locked%x6");
|
||||
else
|
||||
flag= pupmenu("Toggle Setting%t|Draw Wire%x1|Deform%x2|Mult VG%x3|Hinge%x4|No Scale%x5");
|
||||
flag= pupmenu("Toggle Setting%t|Draw Wire%x1|Deform%x2|Mult VG%x3|Hinge%x4|No Scale%x5|Locked%x6");
|
||||
switch (flag) {
|
||||
case 1: flag = BONE_DRAWWIRE; break;
|
||||
case 2: flag = BONE_NO_DEFORM; break;
|
||||
case 3: flag = BONE_MULT_VG_ENV; break;
|
||||
case 4: flag = BONE_HINGE; break;
|
||||
case 5: flag = BONE_NO_SCALE; break;
|
||||
case 6: flag = BONE_EDITMODE_LOCKED; break;
|
||||
default: return;
|
||||
}
|
||||
|
||||
@ -1725,12 +1728,12 @@ void auto_align_armature(short mode)
|
||||
float *cursor= give_cursor();
|
||||
|
||||
for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
|
||||
if (arm->layer & ebone->layer) {
|
||||
if (EBONE_VISIBLE(arm, ebone)) {
|
||||
if (arm->flag & ARM_MIRROR_EDIT)
|
||||
flipbone = armature_bone_get_mirrored(ebone);
|
||||
|
||||
if ((ebone->flag & BONE_SELECTED) ||
|
||||
(flipbone && flipbone->flag & BONE_SELECTED))
|
||||
(flipbone && (flipbone->flag & BONE_SELECTED)))
|
||||
{
|
||||
/* specific method used to calculate roll depends on mode */
|
||||
if (mode == 1) {
|
||||
@ -1975,7 +1978,7 @@ void addvert_armature(void)
|
||||
|
||||
/* find the active or selected bone */
|
||||
for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
|
||||
if (arm->layer & ebone->layer) {
|
||||
if (EBONE_VISIBLE(arm, ebone)) {
|
||||
if (ebone->flag & (BONE_ACTIVE|BONE_TIPSEL))
|
||||
break;
|
||||
}
|
||||
@ -1983,7 +1986,7 @@ void addvert_armature(void)
|
||||
|
||||
if (ebone==NULL) {
|
||||
for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
|
||||
if (arm->layer & ebone->layer) {
|
||||
if (EBONE_VISIBLE(arm, ebone)) {
|
||||
if (ebone->flag & (BONE_ACTIVE|BONE_ROOTSEL))
|
||||
break;
|
||||
}
|
||||
@ -2066,11 +2069,12 @@ static EditBone *get_named_editbone(char *name)
|
||||
{
|
||||
EditBone *eBone;
|
||||
|
||||
if (name)
|
||||
if (name) {
|
||||
for (eBone=G.edbo.first; eBone; eBone=eBone->next) {
|
||||
if (!strcmp(name, eBone->name))
|
||||
return eBone;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -2136,7 +2140,7 @@ void adduplicate_armature(void)
|
||||
/* Select mirrored bones */
|
||||
if (arm->flag & ARM_MIRROR_EDIT) {
|
||||
for (curBone=G.edbo.first; curBone; curBone=curBone->next) {
|
||||
if (arm->layer & curBone->layer) {
|
||||
if (EBONE_VISIBLE(arm, curBone)) {
|
||||
if (curBone->flag & BONE_SELECTED) {
|
||||
eBone = armature_bone_get_mirrored(curBone);
|
||||
if (eBone)
|
||||
@ -2148,13 +2152,13 @@ void adduplicate_armature(void)
|
||||
|
||||
/* Find the selected bones and duplicate them as needed */
|
||||
for (curBone=G.edbo.first; curBone && curBone!=firstDup; curBone=curBone->next) {
|
||||
if (arm->layer & curBone->layer) {
|
||||
if (EBONE_VISIBLE(arm, curBone)) {
|
||||
if (curBone->flag & BONE_SELECTED) {
|
||||
eBone=MEM_callocN(sizeof(EditBone), "addup_editbone");
|
||||
eBone->flag |= BONE_SELECTED;
|
||||
|
||||
/* Copy data from old bone to new bone */
|
||||
memcpy (eBone, curBone, sizeof(EditBone));
|
||||
memcpy(eBone, curBone, sizeof(EditBone));
|
||||
|
||||
curBone->temp = eBone;
|
||||
eBone->temp = curBone;
|
||||
@ -2204,7 +2208,7 @@ void adduplicate_armature(void)
|
||||
|
||||
/* Run though the list and fix the pointers */
|
||||
for (curBone=G.edbo.first; curBone && curBone!=firstDup; curBone=curBone->next) {
|
||||
if (arm->layer & curBone->layer) {
|
||||
if (EBONE_VISIBLE(arm, curBone)) {
|
||||
if (curBone->flag & BONE_SELECTED) {
|
||||
eBone=(EditBone*) curBone->temp;
|
||||
|
||||
@ -2236,7 +2240,7 @@ void adduplicate_armature(void)
|
||||
/* Deselect the old bones and select the new ones */
|
||||
|
||||
for (curBone=G.edbo.first; curBone && curBone!=firstDup; curBone=curBone->next) {
|
||||
if (arm->layer & curBone->layer)
|
||||
if (EBONE_VISIBLE(arm, curBone))
|
||||
curBone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL | BONE_ACTIVE);
|
||||
}
|
||||
|
||||
@ -2373,7 +2377,7 @@ void fill_bones_armature(void)
|
||||
|
||||
/* loop over all bones, and only consider if visible */
|
||||
for (ebo= G.edbo.first; ebo; ebo= ebo->next) {
|
||||
if ((arm->layer & ebo->layer) && !(ebo->flag & BONE_HIDDEN_A)) {
|
||||
if (EBONE_VISIBLE(arm, ebo)) {
|
||||
if (!(ebo->flag & BONE_CONNECTED) && (ebo->flag & BONE_ROOTSEL))
|
||||
fill_add_joint(ebo, 0, &points);
|
||||
if (ebo->flag & BONE_TIPSEL)
|
||||
@ -2608,7 +2612,7 @@ void merge_armature(void)
|
||||
/* only consider bones that are visible and selected */
|
||||
for (ebo=chain->data; ebo; child=ebo, ebo=ebo->parent) {
|
||||
/* check if visible + selected */
|
||||
if ( (arm->layer & ebo->layer) && !(ebo->flag & BONE_HIDDEN_A) &&
|
||||
if ( EBONE_VISIBLE(arm, ebo) &&
|
||||
((ebo->flag & BONE_CONNECTED) || (ebo->parent==NULL)) &&
|
||||
(ebo->flag & (BONE_SELECTED|BONE_ACTIVE)) )
|
||||
{
|
||||
@ -2659,7 +2663,7 @@ void hide_selected_armature_bones(void)
|
||||
EditBone *ebone;
|
||||
|
||||
for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
|
||||
if (arm->layer & ebone->layer) {
|
||||
if (EBONE_VISIBLE(arm, ebone)) {
|
||||
if (ebone->flag & (BONE_SELECTED)) {
|
||||
ebone->flag &= ~(BONE_TIPSEL|BONE_SELECTED|BONE_ROOTSEL|BONE_ACTIVE);
|
||||
ebone->flag |= BONE_HIDDEN_A;
|
||||
@ -2678,7 +2682,7 @@ void hide_unselected_armature_bones(void)
|
||||
|
||||
for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
|
||||
bArmature *arm= G.obedit->data;
|
||||
if (arm->layer & ebone->layer) {
|
||||
if (EBONE_VISIBLE(arm, ebone)) {
|
||||
if (ebone->flag & (BONE_TIPSEL|BONE_SELECTED|BONE_ROOTSEL));
|
||||
else {
|
||||
ebone->flag &= ~BONE_ACTIVE;
|
||||
@ -2711,32 +2715,6 @@ void show_all_armature_bones(void)
|
||||
BIF_undo_push("Reveal Bones");
|
||||
}
|
||||
|
||||
/* Sets editmode transform locks for bones (adds if lock==1, clears otherwise) */
|
||||
void set_locks_armature_bones(short lock)
|
||||
{
|
||||
bArmature *arm= G.obedit->data;
|
||||
EditBone *ebone;
|
||||
|
||||
for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
|
||||
if (arm->layer & ebone->layer) {
|
||||
if (ebone->flag & BONE_SELECTED) {
|
||||
if (lock)
|
||||
ebone->flag |= BONE_EDITMODE_LOCKED;
|
||||
else
|
||||
ebone->flag &= ~BONE_EDITMODE_LOCKED;
|
||||
}
|
||||
}
|
||||
}
|
||||
countall();
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
allqueue(REDRAWBUTSEDIT, 0);
|
||||
|
||||
if (lock)
|
||||
BIF_undo_push("Lock Bones");
|
||||
else
|
||||
BIF_undo_push("Unlock Bones");
|
||||
}
|
||||
|
||||
/* check for null, before calling! */
|
||||
static void bone_connect_to_existing_parent(EditBone *bone)
|
||||
{
|
||||
@ -2803,7 +2781,7 @@ void make_bone_parent(void)
|
||||
|
||||
/* find active bone to parent to */
|
||||
for (actbone = G.edbo.first; actbone; actbone=actbone->next) {
|
||||
if (arm->layer & actbone->layer) {
|
||||
if (EBONE_VISIBLE(arm, actbone)) {
|
||||
if (actbone->flag & BONE_ACTIVE)
|
||||
break;
|
||||
}
|
||||
@ -2815,7 +2793,7 @@ void make_bone_parent(void)
|
||||
|
||||
/* find selected bones */
|
||||
for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
|
||||
if (arm->layer & ebone->layer) {
|
||||
if (EBONE_VISIBLE(arm, ebone)) {
|
||||
if ((ebone->flag & BONE_SELECTED) && (ebone != actbone)) {
|
||||
foundselbone++;
|
||||
if (ebone->parent != actbone) allchildbones= 1;
|
||||
@ -2851,7 +2829,7 @@ void make_bone_parent(void)
|
||||
else {
|
||||
/* loop through all editbones, parenting all selected bones to the active bone */
|
||||
for (selbone = G.edbo.first; selbone; selbone=selbone->next) {
|
||||
if (arm->layer & selbone->layer) {
|
||||
if (EBONE_VISIBLE(arm, selbone)) {
|
||||
if ((selbone->flag & BONE_SELECTED) && (selbone!=actbone)) {
|
||||
/* parent selbone to actbone */
|
||||
bone_connect_to_new_parent(selbone, actbone, val);
|
||||
@ -2909,7 +2887,7 @@ void clear_bone_parent(void)
|
||||
if (val<1) return;
|
||||
|
||||
for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
|
||||
if (arm->layer & ebone->layer) {
|
||||
if (EBONE_VISIBLE(arm, ebone)) {
|
||||
if (ebone->flag & BONE_SELECTED) {
|
||||
if (arm->flag & ARM_MIRROR_EDIT)
|
||||
flipbone = armature_bone_get_mirrored(ebone);
|
||||
@ -2959,7 +2937,7 @@ void unique_editbone_name (ListBase *ebones, char *name)
|
||||
}
|
||||
|
||||
for (number = 1; number <=999; number++) {
|
||||
sprintf (tempname, "%s.%03d", name, number);
|
||||
sprintf(tempname, "%s.%03d", name, number);
|
||||
if (!editbone_name_exists(ebones, tempname)) {
|
||||
BLI_strncpy(name, tempname, 32);
|
||||
return;
|
||||
@ -2980,7 +2958,7 @@ void extrude_armature(int forked)
|
||||
|
||||
/* since we allow root extrude too, we have to make sure selection is OK */
|
||||
for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
|
||||
if (arm->layer & ebone->layer) {
|
||||
if (EBONE_VISIBLE(arm, ebone)) {
|
||||
if (ebone->flag & BONE_ROOTSEL) {
|
||||
if (ebone->parent && (ebone->flag & BONE_CONNECTED)) {
|
||||
if (ebone->parent->flag & BONE_TIPSEL)
|
||||
@ -2992,7 +2970,7 @@ void extrude_armature(int forked)
|
||||
|
||||
/* Duplicate the necessary bones */
|
||||
for (ebone = G.edbo.first; ((ebone) && (ebone!=first)); ebone=ebone->next) {
|
||||
if (arm->layer & ebone->layer) {
|
||||
if (EBONE_VISIBLE(arm, ebone)) {
|
||||
/* we extrude per definition the tip */
|
||||
do_extrude= 0;
|
||||
if (ebone->flag & (BONE_TIPSEL|BONE_SELECTED))
|
||||
@ -3006,7 +2984,7 @@ void extrude_armature(int forked)
|
||||
if (do_extrude) {
|
||||
/* we re-use code for mirror editing... */
|
||||
flipbone= NULL;
|
||||
if(arm->flag & ARM_MIRROR_EDIT) {
|
||||
if (arm->flag & ARM_MIRROR_EDIT) {
|
||||
flipbone= armature_bone_get_mirrored(ebone);
|
||||
if (flipbone) {
|
||||
forked= 0; // we extrude 2 different bones
|
||||
@ -3036,7 +3014,7 @@ void extrude_armature(int forked)
|
||||
newbone->parent = ebone;
|
||||
|
||||
newbone->flag = ebone->flag & BONE_TIPSEL; // copies it, in case mirrored bone
|
||||
|
||||
|
||||
if (newbone->parent) newbone->flag |= BONE_CONNECTED;
|
||||
}
|
||||
else {
|
||||
@ -3046,7 +3024,7 @@ void extrude_armature(int forked)
|
||||
|
||||
newbone->flag= BONE_TIPSEL;
|
||||
|
||||
if (newbone->parent && ebone->flag & BONE_CONNECTED) {
|
||||
if (newbone->parent && (ebone->flag & BONE_CONNECTED)) {
|
||||
newbone->flag |= BONE_CONNECTED;
|
||||
}
|
||||
}
|
||||
@ -3065,8 +3043,8 @@ void extrude_armature(int forked)
|
||||
BLI_strncpy (newbone->name, ebone->name, 32);
|
||||
|
||||
if (flipbone && forked) { // only set if mirror edit
|
||||
if(strlen(newbone->name)<30) {
|
||||
if(a==0) strcat(newbone->name, "_L");
|
||||
if (strlen(newbone->name)<30) {
|
||||
if (a==0) strcat(newbone->name, "_L");
|
||||
else strcat(newbone->name, "_R");
|
||||
}
|
||||
}
|
||||
@ -3111,7 +3089,7 @@ void subdivide_armature(int numcuts)
|
||||
if (numcuts < 1) return;
|
||||
|
||||
for (mbone = G.edbo.last; mbone; mbone= mbone->prev) {
|
||||
if (arm->layer & mbone->layer) {
|
||||
if (EBONE_VISIBLE(arm, mbone)) {
|
||||
if (mbone->flag & BONE_SELECTED) {
|
||||
for (i=numcuts+1; i>1; i--) {
|
||||
/* compute cut ratio first */
|
||||
@ -3176,6 +3154,59 @@ void subdivide_armature(int numcuts)
|
||||
else BIF_undo_push("Subdivide multi");
|
||||
}
|
||||
|
||||
/* switch direction of bone chains */
|
||||
void switch_direction_armature (void)
|
||||
{
|
||||
bArmature *arm= (G.obedit) ? G.obedit->data : NULL;
|
||||
ListBase chains = {NULL, NULL};
|
||||
LinkData *chain;
|
||||
|
||||
/* error checking paranoia */
|
||||
if (arm == NULL)
|
||||
return;
|
||||
|
||||
/* get chains of bones (ends on chains) */
|
||||
chains_find_tips(&chains);
|
||||
if (chains.first == NULL) return;
|
||||
|
||||
/* loop over chains, only considering selected and visible bones */
|
||||
for (chain= chains.first; chain; chain= chain->next) {
|
||||
EditBone *ebo, *child=NULL, *parent=NULL;
|
||||
|
||||
/* loop over bones in chain */
|
||||
for (ebo= chain->data; ebo; child= ebo, ebo=parent) {
|
||||
parent= ebo->parent;
|
||||
|
||||
/* only if selected and editable */
|
||||
if (EBONE_VISIBLE(arm, ebo) && EBONE_EDITABLE(ebo)) {
|
||||
/* swap head and tail coordinates */
|
||||
SWAP(float, ebo->head[0], ebo->tail[0]);
|
||||
SWAP(float, ebo->head[1], ebo->tail[1]);
|
||||
SWAP(float, ebo->head[2], ebo->tail[2]);
|
||||
|
||||
/* do parent swapping:
|
||||
* - use 'child' as new parent
|
||||
* - connected flag is only set if points are coincidental
|
||||
*/
|
||||
ebo->parent= child;
|
||||
if ((child) && VecEqual(ebo->head, child->tail))
|
||||
ebo->flag |= BONE_CONNECTED;
|
||||
else
|
||||
ebo->flag &= ~BONE_CONNECTED;
|
||||
|
||||
/* FIXME: other things that need fixing?
|
||||
* i.e. roll?
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* free chains */
|
||||
BLI_freelistN(&chains);
|
||||
|
||||
BIF_undo_push("Switch Direction");
|
||||
}
|
||||
|
||||
/* ***************** Pose tools ********************* */
|
||||
|
||||
void clear_armature(Object *ob, char mode)
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -2760,7 +2760,7 @@ void special_editmenu(void)
|
||||
DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
|
||||
}
|
||||
else if(G.obedit->type==OB_ARMATURE) {
|
||||
nr= pupmenu("Specials%t|Subdivide %x1|Subdivide Multi%x2|Flip Left-Right Names%x3|%l|AutoName Left-Right%x4|AutoName Front-Back%x5|AutoName Top-Bottom%x6|%l|Lock%x7|Unlock%x8");
|
||||
nr= pupmenu("Specials%t|Subdivide %x1|Subdivide Multi%x2|Switch Direction%x7|Flip Left-Right Names%x3|%l|AutoName Left-Right%x4|AutoName Front-Back%x5|AutoName Top-Bottom%x6");
|
||||
if(nr==1)
|
||||
subdivide_armature(1);
|
||||
if(nr==2) {
|
||||
@ -2773,10 +2773,8 @@ void special_editmenu(void)
|
||||
else if(ELEM3(nr, 4, 5, 6)) {
|
||||
armature_autoside_names(nr-4);
|
||||
}
|
||||
else if(nr==7)
|
||||
set_locks_armature_bones(1);
|
||||
else if(nr==8)
|
||||
set_locks_armature_bones(0);
|
||||
else if(nr == 7)
|
||||
switch_direction_armature();
|
||||
}
|
||||
else if(G.obedit->type==OB_LATTICE) {
|
||||
static float weight= 1.0f;
|
||||
|
@ -5139,7 +5139,7 @@ static char *snapmode_pup(void)
|
||||
static char string[512];
|
||||
char *str = string;
|
||||
|
||||
str += sprintf(str, "%s", "Snap Mode: %t");
|
||||
str += sprintf(str, "%s", "Snap Element: %t");
|
||||
str += sprintf(str, "%s", "|Vertex%x0");
|
||||
str += sprintf(str, "%s", "|Edge%x1");
|
||||
str += sprintf(str, "%s", "|Face%x2");
|
||||
@ -5777,7 +5777,7 @@ void view3d_buttons(void)
|
||||
xco+= XIC;
|
||||
uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_VERTEXSEL, snapmode_pup(), xco,0,XIC+10,YIC, &(G.scene->snap_mode), 0.0, 0.0, 0, 0, "Snapping mode");
|
||||
xco+= XIC;
|
||||
uiDefButS(block, MENU, B_NOP, "Mode%t|Closest%x0|Center%x1|Median%x2|Active%x3",xco,0,70,YIC, &G.scene->snap_target, 0, 0, 0, 0, "Snap Target Mode");
|
||||
uiDefButS(block, MENU, B_NOP, "Snap Mode%t|Closest%x0|Center%x1|Median%x2|Active%x3",xco,0,70,YIC, &G.scene->snap_target, 0, 0, 0, 0, "Snap Target Mode");
|
||||
xco+= 70;
|
||||
} else {
|
||||
uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEAR,xco,0,XIC,YIC, &G.scene->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)");
|
||||
|
@ -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) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -913,8 +913,8 @@ static void createTransPose(TransInfo *t, Object *ob)
|
||||
if (arm==NULL || ob->pose==NULL) return;
|
||||
|
||||
if (arm->flag & ARM_RESTPOS) {
|
||||
if(t->mode!=TFM_BONESIZE) {
|
||||
notice ("Pose edit not possible while Rest Position is enabled");
|
||||
if(ELEM(t->mode, TFM_DUMMY, TFM_BONESIZE)==0) {
|
||||
notice("Pose edit not possible while Rest Position is enabled");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -484,17 +484,10 @@ char BL_ActionActuator::GetAction_doc[] =
|
||||
PyObject* BL_ActionActuator::PyGetAction(PyObject* self,
|
||||
PyObject* args,
|
||||
PyObject* kwds) {
|
||||
PyObject *result;
|
||||
|
||||
if (m_action){
|
||||
result = Py_BuildValue("s", m_action->id.name+2);
|
||||
return PyString_FromString(m_action->id.name+2);
|
||||
}
|
||||
else{
|
||||
Py_INCREF(Py_None);
|
||||
result = Py_None;
|
||||
}
|
||||
|
||||
return result;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* getProperty */
|
||||
@ -640,8 +633,7 @@ PyObject* BL_ActionActuator::PySetAction(PyObject* self,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* setStart */
|
||||
@ -662,8 +654,7 @@ PyObject* BL_ActionActuator::PySetStart(PyObject* self,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* setEnd */
|
||||
@ -684,8 +675,7 @@ PyObject* BL_ActionActuator::PySetEnd(PyObject* self,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* setBlendin */
|
||||
@ -707,8 +697,7 @@ PyObject* BL_ActionActuator::PySetBlendin(PyObject* self,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* setBlendtime */
|
||||
@ -735,8 +724,7 @@ PyObject* BL_ActionActuator::PySetBlendtime(PyObject* self,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* setPriority */
|
||||
@ -759,8 +747,7 @@ PyObject* BL_ActionActuator::PySetPriority(PyObject* self,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* setFrame */
|
||||
@ -785,8 +772,7 @@ PyObject* BL_ActionActuator::PySetFrame(PyObject* self,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* setProperty */
|
||||
@ -808,8 +794,7 @@ PyObject* BL_ActionActuator::PySetProperty(PyObject* self,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* setFrameProperty */
|
||||
@ -830,8 +815,7 @@ PyObject* BL_ActionActuator::PySetFrameProperty(PyObject* self,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -848,8 +832,7 @@ PyObject* BL_ActionActuator::PyGetChannel(PyObject* self,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
*/
|
||||
|
||||
@ -934,8 +917,7 @@ PyObject* BL_ActionActuator::PySetChannel(PyObject* self,
|
||||
}
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* getType */
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -464,17 +464,10 @@ char BL_ShapeActionActuator::GetAction_doc[] =
|
||||
"\tReturns a string containing the name of the current action.\n";
|
||||
|
||||
PyObject* BL_ShapeActionActuator::PyGetAction(PyObject* self) {
|
||||
PyObject *result;
|
||||
|
||||
if (m_action){
|
||||
result = Py_BuildValue("s", m_action->id.name+2);
|
||||
return PyString_FromString(m_action->id.name+2);
|
||||
}
|
||||
else{
|
||||
Py_INCREF(Py_None);
|
||||
result = Py_None;
|
||||
}
|
||||
|
||||
return result;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* getProperty */
|
||||
@ -591,12 +584,10 @@ PyObject* BL_ShapeActionActuator::PySetAction(PyObject* self,
|
||||
}
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* setStart */
|
||||
@ -614,12 +605,10 @@ PyObject* BL_ShapeActionActuator::PySetStart(PyObject* self,
|
||||
m_startframe = start;
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* setEnd */
|
||||
@ -637,12 +626,10 @@ PyObject* BL_ShapeActionActuator::PySetEnd(PyObject* self,
|
||||
m_endframe = end;
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* setBlendin */
|
||||
@ -661,12 +648,10 @@ PyObject* BL_ShapeActionActuator::PySetBlendin(PyObject* self,
|
||||
m_blendin = blendin;
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* setBlendtime */
|
||||
@ -690,12 +675,10 @@ PyObject* BL_ShapeActionActuator::PySetBlendtime(PyObject* self,
|
||||
m_blendframe = m_blendin;
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* setPriority */
|
||||
@ -715,12 +698,10 @@ PyObject* BL_ShapeActionActuator::PySetPriority(PyObject* self,
|
||||
m_priority = priority;
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* setFrame */
|
||||
@ -742,12 +723,10 @@ PyObject* BL_ShapeActionActuator::PySetFrame(PyObject* self,
|
||||
m_localtime=m_endframe;
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* setProperty */
|
||||
@ -766,12 +745,10 @@ PyObject* BL_ShapeActionActuator::PySetProperty(PyObject* self,
|
||||
m_propname = string;
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* getType */
|
||||
@ -793,7 +770,6 @@ PyObject* BL_ShapeActionActuator::PySetType(PyObject* self,
|
||||
short typeArg;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "h", &typeArg)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -540,9 +540,16 @@ void BL_ConvertActuators(char* maggiename,
|
||||
// does the 'original' for replication exists, and
|
||||
// is it in a non-active layer ?
|
||||
SCA_IObject* originalval = NULL;
|
||||
if (editobact->ob && !(editobact->ob->lay & activeLayerBitInfo))
|
||||
originalval = converter->FindGameObject(editobact->ob);
|
||||
|
||||
if (editobact->ob)
|
||||
{
|
||||
if (editobact->ob->lay & activeLayerBitInfo)
|
||||
{
|
||||
fprintf(stderr, "Warning, object \"%s\" from AddObject actuator \"%s\" is not in a hidden layer.\n", objectname.Ptr(), uniquename.Ptr());
|
||||
}
|
||||
else {
|
||||
originalval = converter->FindGameObject(editobact->ob);
|
||||
}
|
||||
}
|
||||
MT_Vector3 linvelvec ( KX_BLENDERTRUNC(editobact->linVelocity[0]),
|
||||
KX_BLENDERTRUNC(editobact->linVelocity[1]),
|
||||
KX_BLENDERTRUNC(editobact->linVelocity[2]));
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -631,7 +631,8 @@ void CParser::SetContext(CValue* context)
|
||||
PyObject* CParserPyMake(PyObject* ignored,PyObject* args)
|
||||
{
|
||||
char* txt;
|
||||
Py_Try(PyArg_ParseTuple(args,"s",&txt));
|
||||
if (!PyArg_ParseTuple(args,"s",&txt))
|
||||
return NULL;
|
||||
CParser parser;
|
||||
CExpression* expr = parser.ProcessText(txt);
|
||||
CValue* val = expr->Calculate();
|
||||
@ -641,7 +642,7 @@ PyObject* CParserPyMake(PyObject* ignored,PyObject* args)
|
||||
|
||||
static PyMethodDef CParserMethods[] =
|
||||
{
|
||||
{ "calc", CParserPyMake , Py_NEWARGS},
|
||||
{ "calc", CParserPyMake , METH_VARARGS},
|
||||
{ NULL,NULL} // Sentinel
|
||||
};
|
||||
|
||||
|
@ -43,7 +43,7 @@ PyObject* listvalue_buffer_item(PyObject* list,Py_ssize_t index)
|
||||
return ((CListValue*) list)->GetValue(index)->AddRef();
|
||||
|
||||
}
|
||||
Py_Error(PyExc_IndexError, "Python ListIndex out of range");
|
||||
PyErr_SetString(PyExc_IndexError, "Python ListIndex out of range");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -130,9 +130,10 @@ listvalue_buffer_concat(PyObject * self, PyObject * other)
|
||||
}
|
||||
}
|
||||
|
||||
if (error)
|
||||
Py_Error(PyExc_SystemError, "Python Error: couldn't add one or more items to a list");
|
||||
|
||||
if (error) {
|
||||
PyErr_SetString(PyExc_SystemError, "Python Error: couldn't add one or more items to a list");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
@ -155,8 +156,8 @@ listvalue_buffer_concat(PyObject * self, PyObject * other)
|
||||
listval->Add(objval);
|
||||
} else
|
||||
{
|
||||
Py_Error(PyExc_SystemError, "Python Error: couldn't add item to a list");
|
||||
// bad luck
|
||||
PyErr_SetString(PyExc_SystemError, "Python Error: couldn't add item to a list");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ PyObjectPlus::PyObjectPlus(PyTypeObject *T) // constructor
|
||||
* PyObjectPlus Methods -- Every class, even the abstract one should have a Methods
|
||||
------------------------------*/
|
||||
PyMethodDef PyObjectPlus::Methods[] = {
|
||||
{"isA", (PyCFunction) sPy_isA, Py_NEWARGS},
|
||||
{"isA", (PyCFunction) sPy_isA, METH_VARARGS},
|
||||
{NULL, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
@ -134,7 +134,8 @@ int PyObjectPlus::_setattr(const STR_String& attr, PyObject *value)
|
||||
------------------------------*/
|
||||
PyObject *PyObjectPlus::_repr(void)
|
||||
{
|
||||
Py_Error(PyExc_SystemError, "Representation not overridden by object.");
|
||||
PyErr_SetString(PyExc_SystemError, "Representation not overridden by object.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*------------------------------
|
||||
@ -164,11 +165,12 @@ bool PyObjectPlus::isA(const char *mytypename) // check typename of each parent
|
||||
PyObject *PyObjectPlus::Py_isA(PyObject *args) // Python wrapper for isA
|
||||
{
|
||||
char *mytypename;
|
||||
Py_Try(PyArg_ParseTuple(args, "s", &mytypename));
|
||||
if (!PyArg_ParseTuple(args, "s", &mytypename))
|
||||
return NULL;
|
||||
if(isA(mytypename))
|
||||
{Py_INCREF(Py_True); return Py_True;}
|
||||
Py_RETURN_TRUE;
|
||||
else
|
||||
{Py_INCREF(Py_False); return Py_False;};
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
|
||||
#endif //NO_EXP_PYTHON_EMBEDDING
|
||||
|
@ -44,22 +44,7 @@
|
||||
------------------------------*/
|
||||
|
||||
// some basic python macros
|
||||
#define Py_NEWARGS 1
|
||||
#define Py_Return { Py_INCREF(Py_None); return Py_None;}
|
||||
static inline PyObject* Py_Success(bool truth)
|
||||
{
|
||||
if (truth)
|
||||
{
|
||||
Py_INCREF(Py_True);
|
||||
return Py_True;
|
||||
}
|
||||
Py_INCREF(Py_False);
|
||||
return Py_False;
|
||||
}
|
||||
|
||||
#define Py_Error(E, M) {PyErr_SetString(E, M); return NULL;}
|
||||
#define Py_Try(F) {if (!(F)) return NULL;}
|
||||
#define Py_Assert(A,E,M) {if (!(A)) {PyErr_SetString(E, M); return NULL;}}
|
||||
|
||||
static inline void Py_Fatal(char *M) {
|
||||
//cout << M << endl;
|
||||
@ -136,6 +121,13 @@ static inline void Py_Fatal(char *M) {
|
||||
}; \
|
||||
static char method_name##_doc[]; \
|
||||
|
||||
#define KX_PYMETHOD_DOC_VARARGS(class_name, method_name) \
|
||||
PyObject* Py##method_name(PyObject* self, PyObject* args); \
|
||||
static PyObject* sPy##method_name( PyObject* self, PyObject* args) { \
|
||||
return ((class_name*) self)->Py##method_name(self, args); \
|
||||
}; \
|
||||
static char method_name##_doc[]; \
|
||||
|
||||
#define KX_PYMETHOD_DOC_O(class_name, method_name) \
|
||||
PyObject* Py##method_name(PyObject* self, PyObject* value); \
|
||||
static PyObject* sPy##method_name( PyObject* self, PyObject* value) { \
|
||||
|
@ -158,15 +158,14 @@ PyParentObject CValue::Parents[] = {
|
||||
};
|
||||
|
||||
PyMethodDef CValue::Methods[] = {
|
||||
// { "printHello", (PyCFunction) CValue::sPyPrintHello, Py_NEWARGS},
|
||||
{ "getName", (PyCFunction) CValue::sPyGetName, Py_NEWARGS},
|
||||
// { "printHello", (PyCFunction) CValue::sPyPrintHello, METH_VARARGS},
|
||||
{ "getName", (PyCFunction) CValue::sPyGetName, METH_NOARGS},
|
||||
{NULL,NULL} //Sentinel
|
||||
};
|
||||
|
||||
PyObject* CValue::PyGetName(PyObject* self,PyObject* args,PyObject* kwds)
|
||||
PyObject* CValue::PyGetName(PyObject* self)
|
||||
{
|
||||
PyObject* pyname = PyString_FromString(this->GetName());
|
||||
return pyname;
|
||||
return PyString_FromString(this->GetName());
|
||||
}
|
||||
|
||||
/*#define CVALUE_DEBUG*/
|
||||
@ -662,7 +661,7 @@ CValue* CValue::FindIdentifier(const STR_String& identifiername)
|
||||
|
||||
static PyMethodDef CValueMethods[] =
|
||||
{
|
||||
//{ "new", CValue::PyMake , Py_NEWARGS},
|
||||
//{ "new", CValue::PyMake , METH_VARARGS},
|
||||
{ NULL,NULL} // Sentinel
|
||||
};
|
||||
|
||||
@ -700,9 +699,7 @@ CValue* CValue::ConvertPythonToValue(PyObject* pyobj)
|
||||
|
||||
CValue* vallie = NULL;
|
||||
|
||||
PyTypeObject* type = pyobj->ob_type;
|
||||
|
||||
if (type == &PyList_Type)
|
||||
if (PyList_Check(pyobj))
|
||||
{
|
||||
CListValue* listval = new CListValue();
|
||||
bool error = false;
|
||||
@ -732,26 +729,25 @@ CValue* CValue::ConvertPythonToValue(PyObject* pyobj)
|
||||
}
|
||||
|
||||
} else
|
||||
if (type == &PyFloat_Type)
|
||||
if (PyFloat_Check(pyobj))
|
||||
{
|
||||
float fl;
|
||||
PyArg_Parse(pyobj,"f",&fl);
|
||||
vallie = new CFloatValue(fl);
|
||||
vallie = new CFloatValue( (float)PyFloat_AsDouble(pyobj) );
|
||||
} else
|
||||
if (type==&PyInt_Type)
|
||||
if (PyInt_Check(pyobj))
|
||||
{
|
||||
int innie;
|
||||
PyArg_Parse(pyobj,"i",&innie);
|
||||
vallie = new CIntValue(innie);
|
||||
vallie = new CIntValue( (int)PyInt_AS_LONG(pyobj) );
|
||||
} else
|
||||
|
||||
if (type==&PyString_Type)
|
||||
if (PyString_Check(pyobj))
|
||||
{
|
||||
vallie = new CStringValue(PyString_AsString(pyobj),"");
|
||||
} else
|
||||
if (type==&CValue::Type || type==&CListValue::Type)
|
||||
if (pyobj->ob_type==&CValue::Type || pyobj->ob_type==&CListValue::Type)
|
||||
{
|
||||
vallie = ((CValue*) pyobj)->AddRef();
|
||||
} else
|
||||
{
|
||||
/* return an error value from the caller */
|
||||
PyErr_SetString(PyExc_TypeError, "This python value could not be assigned to a game engine property");
|
||||
}
|
||||
return vallie;
|
||||
|
||||
@ -778,6 +774,9 @@ int CValue::_setattr(const STR_String& attr,PyObject* pyobj)
|
||||
SetProperty(attr,vallie);
|
||||
}
|
||||
vallie->Release();
|
||||
} else
|
||||
{
|
||||
return 1; /* ConvertPythonToValue sets the error message */
|
||||
}
|
||||
|
||||
//PyObjectPlus::_setattr(attr,value);
|
||||
@ -806,9 +805,8 @@ PyObject* CValue::ConvertKeysToPython( void )
|
||||
PyObject* CValue::PyMake(PyObject* ignored,PyObject* args)
|
||||
{
|
||||
|
||||
//Py_Try(PyArg_ParseTuple(args,"s",&name));
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;//new CValue();
|
||||
//if (!PyArg_ParseTuple(args,"s",&name)) return NULL;
|
||||
Py_RETURN_NONE;//new CValue();
|
||||
}
|
||||
*/
|
||||
|
||||
|
@ -255,7 +255,7 @@ public:
|
||||
|
||||
virtual PyObject* ConvertKeysToPython( void );
|
||||
|
||||
KX_PYMETHOD(CValue,GetName);
|
||||
KX_PYMETHOD_NOARGS(CValue,GetName);
|
||||
|
||||
#else
|
||||
CValue();
|
||||
|
@ -180,7 +180,6 @@ PyObject* SCA_ActuatorSensor::PySetActuator(PyObject* self, PyObject* args, PyOb
|
||||
char *actNameArg = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s", &actNameArg)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -271,8 +271,7 @@ PyObject* SCA_ILogicBrick::PyGetOwner(PyObject* self)
|
||||
}
|
||||
|
||||
printf("ERROR: Python scriptblock without owner\n");
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;//Int_FromLong(IsPositiveTrigger());
|
||||
Py_RETURN_NONE; //Int_FromLong(IsPositiveTrigger());
|
||||
}
|
||||
|
||||
|
||||
|
@ -273,36 +273,16 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr)
|
||||
* break it by hand, then DECREF (which in this case
|
||||
* should always ensure excdict is cleared).
|
||||
*/
|
||||
/* PyObject *excdict= myPyDict_Copy(m_pythondictionary);
|
||||
struct _object* resultobj = PyEval_EvalCode((PyCodeObject*)m_bytecode,
|
||||
excdict,
|
||||
excdict
|
||||
);
|
||||
PyDict_Clear(excdict);
|
||||
Py_DECREF(excdict);*/
|
||||
|
||||
|
||||
#if 1
|
||||
PyObject *excdict= PyDict_Copy(m_pythondictionary);
|
||||
PyObject* resultobj = PyEval_EvalCode((PyCodeObject*)m_bytecode,
|
||||
excdict,
|
||||
excdict
|
||||
);
|
||||
PyDict_Clear(excdict);
|
||||
Py_DECREF(excdict);
|
||||
#else
|
||||
|
||||
PyObject* resultobj = PyEval_EvalCode((PyCodeObject*)m_bytecode,
|
||||
m_pythondictionary,
|
||||
m_pythondictionary
|
||||
);
|
||||
|
||||
#endif
|
||||
excdict, excdict);
|
||||
|
||||
if (resultobj)
|
||||
{
|
||||
Py_DECREF(resultobj);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
// something is wrong, tell the user what went wrong
|
||||
printf("PYTHON SCRIPT ERROR:\n");
|
||||
@ -310,6 +290,11 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr)
|
||||
//PyRun_SimpleString(m_scriptText.Ptr());
|
||||
}
|
||||
|
||||
// clear after PyErrPrint - seems it can be using
|
||||
// something in this dictionary and crash?
|
||||
PyDict_Clear(excdict);
|
||||
Py_DECREF(excdict);
|
||||
|
||||
m_sCurrentController = NULL;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -846,8 +846,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, getFragmentProg ,"getFragmentProg( )" )
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, validate, "validate()")
|
||||
{
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
if(mShader==0) {
|
||||
PyErr_Format(PyExc_TypeError, "invalid shader object");
|
||||
@ -877,8 +876,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, validate, "validate()")
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setSampler, "setSampler(name, index)" )
|
||||
{
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
char *uniform="";
|
||||
@ -900,7 +898,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setSampler, "setSampler(name, index)" )
|
||||
//else
|
||||
// spit("Invalid texture sample index: " << index);
|
||||
}
|
||||
Py_Return;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -919,8 +917,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setNumberOfPasses, "setNumberOfPasses( max-pass )
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setUniform1f, "setUniform1f(name, fx)" )
|
||||
{
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
char *uniform="";
|
||||
@ -945,8 +942,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform1f, "setUniform1f(name, fx)" )
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setUniform2f , "setUniform2f(name, fx, fy)")
|
||||
{
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
char *uniform="";
|
||||
float array[2]={ 0,0 };
|
||||
@ -970,8 +966,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform2f , "setUniform2f(name, fx, fy)")
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setUniform3f, "setUniform3f(name, fx,fy,fz) ")
|
||||
{
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
char *uniform="";
|
||||
float array[3]={0,0,0};
|
||||
@ -996,8 +991,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform3f, "setUniform3f(name, fx,fy,fz) ")
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setUniform4f, "setUniform4f(name, fx,fy,fz, fw) ")
|
||||
{
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
char *uniform="";
|
||||
float array[4]={0,0,0,0};
|
||||
@ -1021,8 +1015,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform4f, "setUniform4f(name, fx,fy,fz, fw) "
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setUniform1i, "setUniform1i(name, ix)" )
|
||||
{
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
char *uniform="";
|
||||
int value=0;
|
||||
@ -1046,8 +1039,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform1i, "setUniform1i(name, ix)" )
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setUniform2i , "setUniform2i(name, ix, iy)")
|
||||
{
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
char *uniform="";
|
||||
int array[2]={ 0,0 };
|
||||
@ -1071,8 +1063,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform2i , "setUniform2i(name, ix, iy)")
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setUniform3i, "setUniform3i(name, ix,iy,iz) ")
|
||||
{
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
char *uniform="";
|
||||
@ -1096,8 +1087,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform3i, "setUniform3i(name, ix,iy,iz) ")
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setUniform4i, "setUniform4i(name, ix,iy,iz, iw) ")
|
||||
{
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
char *uniform="";
|
||||
int array[4]={0,0,0, 0};
|
||||
@ -1120,8 +1110,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform4i, "setUniform4i(name, ix,iy,iz, iw) "
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setUniformfv , "setUniformfv( float (list2 or list3 or list4) )")
|
||||
{
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
char*uniform = "";
|
||||
PyObject *listPtr =0;
|
||||
@ -1190,8 +1179,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformfv , "setUniformfv( float (list2 or lis
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setUniformiv, "setUniformiv( int (list2 or list3 or list4) )")
|
||||
{
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
char*uniform = "";
|
||||
PyObject *listPtr =0;
|
||||
@ -1263,8 +1251,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix4,
|
||||
"setUniformMatrix4(uniform-name, mat-4x4, transpose(row-major=true, col-major=false)" )
|
||||
{
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
float matr[16] = {
|
||||
@ -1306,8 +1293,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix3,
|
||||
"setUniformMatrix3(uniform-name, list[3x3], transpose(row-major=true, col-major=false)" )
|
||||
{
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
float matr[9] = {
|
||||
@ -1347,8 +1333,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix3,
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setAttrib, "setAttrib(enum)" )
|
||||
{
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
int attr=0;
|
||||
if(PyArg_ParseTuple(args, "i", &attr )) {
|
||||
@ -1368,8 +1353,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setAttrib, "setAttrib(enum)" )
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setUniformDef, "setUniformDef(name, enum)" )
|
||||
{
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
char *uniform="";
|
||||
|
@ -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
|
||||
|
@ -395,8 +395,8 @@ PyParentObject KX_CameraActuator::Parents[] = {
|
||||
};
|
||||
|
||||
PyMethodDef KX_CameraActuator::Methods[] = {
|
||||
{"setObject",(PyCFunction) KX_CameraActuator::sPySetObject, METH_VARARGS, SetObject_doc},
|
||||
{"getObject",(PyCFunction) KX_CameraActuator::sPyGetObject, METH_NOARGS, GetObject_doc},
|
||||
{"setObject",(PyCFunction) KX_CameraActuator::sPySetObject, METH_O, SetObject_doc},
|
||||
{"getObject",(PyCFunction) KX_CameraActuator::sPyGetObject, METH_VARARGS, GetObject_doc},
|
||||
{"setMin" ,(PyCFunction) KX_CameraActuator::sPySetMin, METH_VARARGS, SetMin_doc},
|
||||
{"getMin" ,(PyCFunction) KX_CameraActuator::sPyGetMin, METH_NOARGS, GetMin_doc},
|
||||
{"setMax" ,(PyCFunction) KX_CameraActuator::sPySetMax, METH_VARARGS, SetMax_doc},
|
||||
@ -413,50 +413,43 @@ PyObject* KX_CameraActuator::_getattr(const STR_String& attr) {
|
||||
}
|
||||
/* get obj ---------------------------------------------------------- */
|
||||
char KX_CameraActuator::GetObject_doc[] =
|
||||
"getObject\n"
|
||||
"getObject(name_only = 1)\n"
|
||||
"name_only - optional arg, when true will return the KX_GameObject rather then its name\n"
|
||||
"\tReturns the object this sensor reacts to.\n";
|
||||
PyObject* KX_CameraActuator::PyGetObject(PyObject* self,
|
||||
PyObject* args,
|
||||
PyObject* kwds)
|
||||
PyObject* KX_CameraActuator::PyGetObject(PyObject* self, PyObject* args)
|
||||
{
|
||||
return PyString_FromString(m_ob->GetName());
|
||||
int ret_name_only = 1;
|
||||
if (!PyArg_ParseTuple(args, "|i", &ret_name_only))
|
||||
return NULL;
|
||||
|
||||
if (!m_ob)
|
||||
Py_RETURN_NONE;
|
||||
|
||||
if (ret_name_only)
|
||||
return PyString_FromString(m_ob->GetName());
|
||||
else
|
||||
return m_ob->AddRef();
|
||||
}
|
||||
/* set obj ---------------------------------------------------------- */
|
||||
char KX_CameraActuator::SetObject_doc[] =
|
||||
"setObject\n"
|
||||
"setObject(object)\n"
|
||||
"\t- object: KX_GameObject, string or None\n"
|
||||
"\tSets the object this sensor reacts to.\n";
|
||||
PyObject* KX_CameraActuator::PySetObject(PyObject* self,
|
||||
PyObject* args,
|
||||
PyObject* kwds)
|
||||
PyObject* KX_CameraActuator::PySetObject(PyObject* self, PyObject* value)
|
||||
{
|
||||
|
||||
PyObject* gameobj;
|
||||
if (PyArg_ParseTuple(args, "O!", &KX_GameObject::Type, &gameobj))
|
||||
{
|
||||
if (m_ob)
|
||||
m_ob->UnregisterActuator(this);
|
||||
m_ob = (SCA_IObject*)gameobj;
|
||||
if (m_ob)
|
||||
m_ob->RegisterActuator(this);
|
||||
Py_Return;
|
||||
}
|
||||
PyErr_Clear();
|
||||
KX_GameObject *gameobj;
|
||||
|
||||
char* objectname;
|
||||
if (PyArg_ParseTuple(args, "s", &objectname))
|
||||
{
|
||||
SCA_IObject *object = (SCA_IObject*)SCA_ILogicBrick::m_sCurrentLogicManager->GetGameObjectByName(STR_String(objectname));
|
||||
if(object)
|
||||
{
|
||||
if (m_ob != NULL)
|
||||
m_ob->UnregisterActuator(this);
|
||||
m_ob = object;
|
||||
m_ob->RegisterActuator(this);
|
||||
Py_Return;
|
||||
}
|
||||
}
|
||||
if (!ConvertPythonToGameObject(value, &gameobj, true))
|
||||
return NULL; // ConvertPythonToGameObject sets the error
|
||||
|
||||
return NULL;
|
||||
if (m_ob != NULL)
|
||||
m_ob->UnregisterActuator(this);
|
||||
|
||||
m_ob = (SCA_IObject*)gameobj;
|
||||
if (m_ob)
|
||||
m_ob->RegisterActuator(this);
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* get min ---------------------------------------------------------- */
|
||||
|
@ -123,9 +123,9 @@ private :
|
||||
virtual PyObject* _getattr(const STR_String& attr);
|
||||
|
||||
/* set object to look at */
|
||||
KX_PYMETHOD_DOC(KX_CameraActuator,SetObject);
|
||||
KX_PYMETHOD_DOC_O(KX_CameraActuator,SetObject);
|
||||
/* get current object */
|
||||
KX_PYMETHOD_DOC(KX_CameraActuator,GetObject);
|
||||
KX_PYMETHOD_DOC_VARARGS(KX_CameraActuator,GetObject);
|
||||
KX_PYMETHOD_DOC(KX_CameraActuator,SetMin);
|
||||
KX_PYMETHOD_DOC(KX_CameraActuator,GetMin);
|
||||
KX_PYMETHOD_DOC(KX_CameraActuator,SetMax);
|
||||
|
@ -476,7 +476,6 @@ PyObject* KX_ConstraintActuator::PySetDamp(PyObject* self,
|
||||
PyObject* kwds) {
|
||||
int dampArg;
|
||||
if(!PyArg_ParseTuple(args, "i", &dampArg)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -504,7 +503,6 @@ PyObject* KX_ConstraintActuator::PySetRotDamp(PyObject* self,
|
||||
PyObject* kwds) {
|
||||
int dampArg;
|
||||
if(!PyArg_ParseTuple(args, "i", &dampArg)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -534,7 +532,6 @@ PyObject* KX_ConstraintActuator::PySetDirection(PyObject* self,
|
||||
MT_Vector3 dir;
|
||||
|
||||
if(!PyArg_ParseTuple(args, "(fff)", &x, &y, &z)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
dir[0] = x;
|
||||
@ -577,7 +574,6 @@ PyObject* KX_ConstraintActuator::PySetOption(PyObject* self,
|
||||
PyObject* kwds) {
|
||||
int option;
|
||||
if(!PyArg_ParseTuple(args, "i", &option)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -605,7 +601,6 @@ PyObject* KX_ConstraintActuator::PySetTime(PyObject* self,
|
||||
PyObject* kwds) {
|
||||
int t;
|
||||
if(!PyArg_ParseTuple(args, "i", &t)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -634,7 +629,6 @@ PyObject* KX_ConstraintActuator::PySetProperty(PyObject* self,
|
||||
PyObject* kwds) {
|
||||
char *property;
|
||||
if (!PyArg_ParseTuple(args, "s", &property)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
if (property == NULL) {
|
||||
@ -670,7 +664,6 @@ PyObject* KX_ConstraintActuator::PySetMin(PyObject* self,
|
||||
PyObject* kwds) {
|
||||
float minArg;
|
||||
if(!PyArg_ParseTuple(args, "f", &minArg)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -716,7 +709,6 @@ PyObject* KX_ConstraintActuator::PySetMax(PyObject* self,
|
||||
PyObject* kwds){
|
||||
float maxArg;
|
||||
if(!PyArg_ParseTuple(args, "f", &maxArg)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -770,7 +762,6 @@ PyObject* KX_ConstraintActuator::PySetLimit(PyObject* self,
|
||||
PyObject* kwds) {
|
||||
int locrotArg;
|
||||
if(!PyArg_ParseTuple(args, "i", &locrotArg)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -53,8 +53,7 @@ PyObject* KX_ConstraintWrapper::PyTestMethod(PyObject* self,
|
||||
PyObject* kwds)
|
||||
{
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PyObject* KX_ConstraintWrapper::PyGetConstraintId(PyObject* self,
|
||||
|
@ -942,7 +942,7 @@ PyObject* KX_GameObject::PyEndObject(PyObject* self)
|
||||
KX_Scene *scene = PHY_GetActiveScene();
|
||||
scene->DelayedRemoveObject(this);
|
||||
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
|
||||
}
|
||||
|
||||
@ -1490,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;
|
||||
@ -1548,9 +1551,9 @@ KX_PYMETHODDEF_DOC(KX_GameObject, getDistanceTo,
|
||||
PyErr_Clear();
|
||||
|
||||
PyObject *pyother;
|
||||
if (PyArg_ParseTuple(args, "O!", &KX_GameObject::Type, &pyother))
|
||||
KX_GameObject *other;
|
||||
if (PyArg_ParseTuple(args, "O", &pyother) && ConvertPythonToGameObject(pyother, &other, false))
|
||||
{
|
||||
KX_GameObject *other = static_cast<KX_GameObject*>(pyother);
|
||||
return PyFloat_FromDouble(NodeGetWorldPosition().distance(other->NodeGetWorldPosition()));
|
||||
}
|
||||
|
||||
@ -1571,11 +1574,12 @@ KX_PYMETHODDEF_DOC(KX_GameObject, getVectTo,
|
||||
if (!PyVecArgTo(args, toPoint))
|
||||
{
|
||||
PyErr_Clear();
|
||||
if (PyArg_ParseTuple(args, "O!", &KX_GameObject::Type, &pyother))
|
||||
|
||||
KX_GameObject *other;
|
||||
if (PyArg_ParseTuple(args, "O", &pyother) && ConvertPythonToGameObject(pyother, &other, false))
|
||||
{
|
||||
KX_GameObject *other = static_cast<KX_GameObject*>(pyother);
|
||||
toPoint = other->NodeGetWorldPosition();
|
||||
}else
|
||||
} else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "Expected a 3D Vector or GameObject type");
|
||||
return NULL;
|
||||
@ -1645,12 +1649,15 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo,
|
||||
{
|
||||
KX_GameObject *other;
|
||||
PyErr_Clear();
|
||||
if (!PyType_IsSubtype(pyarg->ob_type, &KX_GameObject::Type)) {
|
||||
|
||||
if (ConvertPythonToGameObject(pyarg, &other, false))
|
||||
{
|
||||
toPoint = other->NodeGetWorldPosition();
|
||||
} else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "the first argument to rayCastTo must be a vector or a KX_GameObject");
|
||||
return NULL;
|
||||
}
|
||||
other = static_cast<KX_GameObject*>(pyarg);
|
||||
toPoint = other->NodeGetWorldPosition();
|
||||
}
|
||||
MT_Point3 fromPoint = NodeGetWorldPosition();
|
||||
if (dist != 0.0f)
|
||||
@ -1709,12 +1716,15 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCast,
|
||||
if (!PyVecTo(pyto, toPoint))
|
||||
{
|
||||
PyErr_Clear();
|
||||
if (!PyType_IsSubtype(pyto->ob_type, &KX_GameObject::Type)) {
|
||||
|
||||
if (ConvertPythonToGameObject(pyto, &other, false))
|
||||
{
|
||||
toPoint = other->NodeGetWorldPosition();
|
||||
} else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "the first argument to rayCast must be a vector or a KX_GameObject");
|
||||
return NULL;
|
||||
}
|
||||
other = static_cast<KX_GameObject*>(pyto);
|
||||
toPoint = other->NodeGetWorldPosition();
|
||||
}
|
||||
if (!pyfrom || pyfrom == Py_None)
|
||||
{
|
||||
@ -1723,12 +1733,15 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCast,
|
||||
else if (!PyVecTo(pyfrom, fromPoint))
|
||||
{
|
||||
PyErr_Clear();
|
||||
if (!PyType_IsSubtype(pyfrom->ob_type, &KX_GameObject::Type)) {
|
||||
|
||||
if (ConvertPythonToGameObject(pyfrom, &other, false))
|
||||
{
|
||||
fromPoint = other->NodeGetWorldPosition();
|
||||
} else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "the second optional argument to rayCast must be a vector or a KX_GameObject");
|
||||
return NULL;
|
||||
}
|
||||
other = static_cast<KX_GameObject*>(pyfrom);
|
||||
fromPoint = other->NodeGetWorldPosition();
|
||||
}
|
||||
|
||||
if (dist != 0.0f) {
|
||||
@ -1795,3 +1808,49 @@ void KX_GameObject::Relink(GEN_Map<GEN_HashedPtr, void*> *map_parameter)
|
||||
}
|
||||
}
|
||||
|
||||
bool ConvertPythonToGameObject(PyObject * value, KX_GameObject **object, bool py_none_ok)
|
||||
{
|
||||
if (value==NULL) {
|
||||
PyErr_SetString(PyExc_TypeError, "Error in ConvertPythonToGameObject, python pointer NULL, should never happen");
|
||||
*object = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (value==Py_None) {
|
||||
*object = NULL;
|
||||
|
||||
if (py_none_ok) {
|
||||
return true;
|
||||
} else {
|
||||
PyErr_SetString(PyExc_TypeError, "Expected KX_GameObject or a string for a name of a KX_GameObject, None is invalid");
|
||||
return false;
|
||||
}
|
||||
return (py_none_ok ? true : false);
|
||||
}
|
||||
|
||||
if (PyString_Check(value)) {
|
||||
*object = (KX_GameObject *)SCA_ILogicBrick::m_sCurrentLogicManager->GetGameObjectByName(STR_String( PyString_AsString(value) ));
|
||||
|
||||
if (*object) {
|
||||
return true;
|
||||
} else {
|
||||
PyErr_SetString(PyExc_ValueError, "Requested name did not match any KX_GameObject");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (PyObject_TypeCheck(value, &KX_GameObject::Type)) {
|
||||
*object = static_cast<KX_GameObject*>(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
*object = NULL;
|
||||
|
||||
if (py_none_ok) {
|
||||
PyErr_SetString(PyExc_TypeError, "Expect a KX_GameObject, a string or None");
|
||||
} else {
|
||||
PyErr_SetString(PyExc_TypeError, "Expect a KX_GameObject or a string");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "KX_KetsjiEngine.h" /* for m_anim_framerate */
|
||||
#include "KX_IPhysicsController.h" /* for suspend/resume */
|
||||
#include "DNA_object_types.h"
|
||||
#include "SCA_LogicManager.h" /* for ConvertPythonToGameObject to search object names */
|
||||
#define KX_OB_DYNAMIC 1
|
||||
|
||||
|
||||
@ -775,5 +776,8 @@ private :
|
||||
|
||||
};
|
||||
|
||||
/* utility conversion function */
|
||||
bool ConvertPythonToGameObject(PyObject * value, KX_GameObject **object, bool py_none_ok);
|
||||
|
||||
#endif //__KX_GAMEOBJECT
|
||||
|
||||
|
@ -480,7 +480,6 @@ PyObject* KX_IpoActuator::PySet(PyObject* self,
|
||||
int startFrame, stopFrame;
|
||||
if(!PyArg_ParseTuple(args, "siii", &mode, &startFrame,
|
||||
&stopFrame, &forceToggle)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
modenum = string2mode(mode);
|
||||
@ -516,7 +515,6 @@ PyObject* KX_IpoActuator::PySetProperty(PyObject* self,
|
||||
/* args: property */
|
||||
char *propertyName;
|
||||
if(!PyArg_ParseTuple(args, "s", &propertyName)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -535,7 +533,6 @@ PyObject* KX_IpoActuator::PySetStart(PyObject* self,
|
||||
PyObject* kwds) {
|
||||
float startArg;
|
||||
if(!PyArg_ParseTuple(args, "f", &startArg)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -561,7 +558,6 @@ PyObject* KX_IpoActuator::PySetEnd(PyObject* self,
|
||||
PyObject* kwds) {
|
||||
float endArg;
|
||||
if(!PyArg_ParseTuple(args, "f", &endArg)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -588,7 +584,6 @@ PyObject* KX_IpoActuator::PySetIpoAsForce(PyObject* self,
|
||||
int boolArg;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "i", &boolArg)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -617,7 +612,6 @@ PyObject* KX_IpoActuator::PySetIpoAdd(PyObject* self,
|
||||
int boolArg;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "i", &boolArg)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -646,7 +640,6 @@ PyObject* KX_IpoActuator::PySetType(PyObject* self,
|
||||
int typeArg;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "i", &typeArg)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -678,7 +671,6 @@ PyObject* KX_IpoActuator::PySetForceIpoActsLocal(PyObject* self,
|
||||
int boolArg;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "i", &boolArg)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -238,5 +238,5 @@ KX_PYMETHODDEF_DOC(KX_MeshProxy, reinstancePhysicsMesh,
|
||||
"Reinstance the physics mesh.")
|
||||
{
|
||||
//this needs to be reviewed, it is dependend on Sumo/Solid. Who is using this ?
|
||||
return Py_None;//Py_Success(KX_ReInstanceShapeFromMesh(m_meshobj));
|
||||
Py_RETURN_NONE;//(KX_ReInstanceShapeFromMesh(m_meshobj)) ? Py_RETURN_TRUE : Py_RETURN_FALSE;
|
||||
}
|
||||
|
@ -360,7 +360,6 @@ PyObject* KX_ObjectActuator::PySetForce(PyObject* self,
|
||||
int bToggle = 0;
|
||||
if (!PyArg_ParseTuple(args, "fffi", &vecArg[0], &vecArg[1],
|
||||
&vecArg[2], &bToggle)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
m_force.setValue(vecArg);
|
||||
@ -390,7 +389,6 @@ PyObject* KX_ObjectActuator::PySetTorque(PyObject* self,
|
||||
int bToggle = 0;
|
||||
if (!PyArg_ParseTuple(args, "fffi", &vecArg[0], &vecArg[1],
|
||||
&vecArg[2], &bToggle)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
m_torque.setValue(vecArg);
|
||||
@ -420,7 +418,6 @@ PyObject* KX_ObjectActuator::PySetDLoc(PyObject* self,
|
||||
int bToggle = 0;
|
||||
if(!PyArg_ParseTuple(args, "fffi", &vecArg[0], &vecArg[1],
|
||||
&vecArg[2], &bToggle)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
m_dloc.setValue(vecArg);
|
||||
@ -450,7 +447,6 @@ PyObject* KX_ObjectActuator::PySetDRot(PyObject* self,
|
||||
int bToggle = 0;
|
||||
if (!PyArg_ParseTuple(args, "fffi", &vecArg[0], &vecArg[1],
|
||||
&vecArg[2], &bToggle)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
m_drot.setValue(vecArg);
|
||||
@ -479,7 +475,6 @@ PyObject* KX_ObjectActuator::PySetLinearVelocity(PyObject* self,
|
||||
int bToggle = 0;
|
||||
if (!PyArg_ParseTuple(args, "fffi", &vecArg[0], &vecArg[1],
|
||||
&vecArg[2], &bToggle)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
m_linear_velocity.setValue(vecArg);
|
||||
@ -508,7 +503,6 @@ PyObject* KX_ObjectActuator::PySetAngularVelocity(PyObject* self,
|
||||
int bToggle = 0;
|
||||
if (!PyArg_ParseTuple(args, "fffi", &vecArg[0], &vecArg[1],
|
||||
&vecArg[2], &bToggle)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
m_angular_velocity.setValue(vecArg);
|
||||
@ -523,7 +517,6 @@ PyObject* KX_ObjectActuator::PySetDamping(PyObject* self,
|
||||
PyObject* kwds) {
|
||||
int damping = 0;
|
||||
if (!PyArg_ParseTuple(args, "i", &damping) || damping < 0 || damping > 1000) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
m_damping = damping;
|
||||
@ -553,7 +546,6 @@ PyObject* KX_ObjectActuator::PySetForceLimitX(PyObject* self,
|
||||
float vecArg[2];
|
||||
int bToggle = 0;
|
||||
if(!PyArg_ParseTuple(args, "ffi", &vecArg[0], &vecArg[1], &bToggle)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
m_drot[0] = vecArg[0];
|
||||
@ -581,7 +573,6 @@ PyObject* KX_ObjectActuator::PySetForceLimitY(PyObject* self,
|
||||
float vecArg[2];
|
||||
int bToggle = 0;
|
||||
if(!PyArg_ParseTuple(args, "ffi", &vecArg[0], &vecArg[1], &bToggle)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
m_drot[1] = vecArg[0];
|
||||
@ -609,7 +600,6 @@ PyObject* KX_ObjectActuator::PySetForceLimitZ(PyObject* self,
|
||||
float vecArg[2];
|
||||
int bToggle = 0;
|
||||
if(!PyArg_ParseTuple(args, "ffi", &vecArg[0], &vecArg[1], &bToggle)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
m_drot[2] = vecArg[0];
|
||||
@ -636,7 +626,6 @@ PyObject* KX_ObjectActuator::PySetPID(PyObject* self,
|
||||
{
|
||||
float vecArg[3];
|
||||
if (!PyArg_ParseTuple(args, "fff", &vecArg[0], &vecArg[1], &vecArg[2])) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
}
|
||||
m_torque.setValue(vecArg);
|
||||
|
@ -164,7 +164,7 @@ PyParentObject KX_ParentActuator::Parents[] = {
|
||||
};
|
||||
|
||||
PyMethodDef KX_ParentActuator::Methods[] = {
|
||||
{"setObject", (PyCFunction) KX_ParentActuator::sPySetObject, METH_VARARGS, SetObject_doc},
|
||||
{"setObject", (PyCFunction) KX_ParentActuator::sPySetObject, METH_O, SetObject_doc},
|
||||
{"getObject", (PyCFunction) KX_ParentActuator::sPyGetObject, METH_VARARGS, GetObject_doc},
|
||||
{NULL,NULL} //Sentinel
|
||||
};
|
||||
@ -176,44 +176,44 @@ PyObject* KX_ParentActuator::_getattr(const STR_String& attr) {
|
||||
/* 1. setObject */
|
||||
char KX_ParentActuator::SetObject_doc[] =
|
||||
"setObject(object)\n"
|
||||
"\tSet the object to set as parent.\n"
|
||||
"\tCan be an object name or an object\n";
|
||||
PyObject* KX_ParentActuator::PySetObject(PyObject* self, PyObject* args, PyObject* kwds) {
|
||||
PyObject* gameobj;
|
||||
if (PyArg_ParseTuple(args, "O!", &KX_GameObject::Type, &gameobj))
|
||||
{
|
||||
if (m_ob != NULL)
|
||||
m_ob->UnregisterActuator(this);
|
||||
m_ob = (SCA_IObject*)gameobj;
|
||||
if (m_ob)
|
||||
m_ob->RegisterActuator(this);
|
||||
Py_Return;
|
||||
}
|
||||
PyErr_Clear();
|
||||
"\t- object: KX_GameObject, string or None\n"
|
||||
"\tSet the object to set as parent.\n";
|
||||
PyObject* KX_ParentActuator::PySetObject(PyObject* self, PyObject* value) {
|
||||
KX_GameObject *gameobj;
|
||||
|
||||
char* objectname;
|
||||
if (PyArg_ParseTuple(args, "s", &objectname))
|
||||
{
|
||||
SCA_IObject *object = (SCA_IObject*)SCA_ILogicBrick::m_sCurrentLogicManager->GetGameObjectByName(STR_String(objectname));
|
||||
if(object)
|
||||
{
|
||||
if (m_ob != NULL)
|
||||
m_ob->UnregisterActuator(this);
|
||||
m_ob = object;
|
||||
m_ob->RegisterActuator(this);
|
||||
Py_Return;
|
||||
}
|
||||
}
|
||||
if (!ConvertPythonToGameObject(value, &gameobj, true))
|
||||
return NULL; // ConvertPythonToGameObject sets the error
|
||||
|
||||
return NULL;
|
||||
if (m_ob != NULL)
|
||||
m_ob->UnregisterActuator(this);
|
||||
|
||||
m_ob = (SCA_IObject*)gameobj;
|
||||
if (m_ob)
|
||||
m_ob->RegisterActuator(this);
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* 2. getObject */
|
||||
char KX_ParentActuator::GetObject_doc[] =
|
||||
"getObject()\n"
|
||||
|
||||
/* get obj ---------------------------------------------------------- */
|
||||
char KX_ParentActuator::GetObject_doc[] =
|
||||
"getObject(name_only = 1)\n"
|
||||
"name_only - optional arg, when true will return the KX_GameObject rather then its name\n"
|
||||
"\tReturns the object that is set to.\n";
|
||||
PyObject* KX_ParentActuator::PyGetObject(PyObject* self, PyObject* args, PyObject* kwds) {
|
||||
return PyString_FromString(m_ob->GetName());
|
||||
}
|
||||
PyObject* KX_ParentActuator::PyGetObject(PyObject* self, PyObject* args)
|
||||
{
|
||||
int ret_name_only = 1;
|
||||
if (!PyArg_ParseTuple(args, "|i", &ret_name_only))
|
||||
return NULL;
|
||||
|
||||
if (!m_ob)
|
||||
Py_RETURN_NONE;
|
||||
|
||||
if (ret_name_only)
|
||||
return PyString_FromString(m_ob->GetName());
|
||||
else
|
||||
return m_ob->AddRef();
|
||||
}
|
||||
|
||||
/* eof */
|
||||
|
@ -79,9 +79,9 @@ class KX_ParentActuator : public SCA_IActuator
|
||||
virtual PyObject* _getattr(const STR_String& attr);
|
||||
|
||||
/* 1. setObject */
|
||||
KX_PYMETHOD_DOC(KX_ParentActuator,SetObject);
|
||||
KX_PYMETHOD_DOC_O(KX_ParentActuator,SetObject);
|
||||
/* 2. getObject */
|
||||
KX_PYMETHOD_DOC(KX_ParentActuator,GetObject);
|
||||
KX_PYMETHOD_DOC_VARARGS(KX_ParentActuator,GetObject);
|
||||
|
||||
}; /* end of class KX_ParentActuator : public SCA_PropertyActuator */
|
||||
|
||||
|
@ -61,7 +61,7 @@ PyObject* KX_PhysicsObjectWrapper::PySetPosition(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ PyObject* KX_PhysicsObjectWrapper::PySetLinearVelocity(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PyObject* KX_PhysicsObjectWrapper::PySetAngularVelocity(PyObject* self,
|
||||
@ -94,7 +94,7 @@ PyObject* KX_PhysicsObjectWrapper::PySetAngularVelocity(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PyObject* KX_PhysicsObjectWrapper::PySetActive(PyObject* self,
|
||||
@ -109,7 +109,7 @@ PyObject* KX_PhysicsObjectWrapper::PySetActive(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,7 +91,7 @@ static PyObject* gPySetGravity(PyObject* self,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject* gPySetDebugMode(PyObject* self,
|
||||
@ -112,7 +112,7 @@ static PyObject* gPySetDebugMode(PyObject* self,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -132,7 +132,7 @@ static PyObject* gPySetNumTimeSubSteps(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -151,7 +151,7 @@ static PyObject* gPySetNumIterations(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -171,7 +171,7 @@ static PyObject* gPySetDeactivationTime(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -190,7 +190,7 @@ static PyObject* gPySetDeactivationLinearTreshold(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -209,7 +209,7 @@ static PyObject* gPySetDeactivationAngularTreshold(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject* gPySetContactBreakingTreshold(PyObject* self,
|
||||
@ -227,7 +227,7 @@ static PyObject* gPySetContactBreakingTreshold(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -246,7 +246,7 @@ static PyObject* gPySetCcdMode(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject* gPySetSorConstant(PyObject* self,
|
||||
@ -264,7 +264,7 @@ static PyObject* gPySetSorConstant(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject* gPySetSolverTau(PyObject* self,
|
||||
@ -282,7 +282,7 @@ static PyObject* gPySetSolverTau(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -301,7 +301,7 @@ static PyObject* gPySetSolverDamping(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject* gPySetLinearAirDamping(PyObject* self,
|
||||
@ -319,7 +319,7 @@ static PyObject* gPySetLinearAirDamping(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -338,7 +338,7 @@ static PyObject* gPySetUseEpa(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
static PyObject* gPySetSolverType(PyObject* self,
|
||||
PyObject* args,
|
||||
@ -355,7 +355,7 @@ static PyObject* gPySetSolverType(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -388,7 +388,7 @@ static PyObject* gPyGetVehicleConstraint(PyObject* self,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -448,7 +448,7 @@ static PyObject* gPyCreateConstraint(PyObject* self,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -502,7 +502,7 @@ static PyObject* gPyRemoveConstraint(PyObject* self,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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.
|
||||
@ -351,8 +355,7 @@ static PyObject *pyPrintExt(PyObject *,PyObject *,PyObject *)
|
||||
if(!count)
|
||||
pprint("No extenstions are used in this build");
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -733,7 +736,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 +879,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 +1172,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:
|
||||
|
@ -180,7 +180,7 @@ PyParentObject KX_SCA_AddObjectActuator::Parents[] = {
|
||||
NULL
|
||||
};
|
||||
PyMethodDef KX_SCA_AddObjectActuator::Methods[] = {
|
||||
{"setObject", (PyCFunction) KX_SCA_AddObjectActuator::sPySetObject, METH_VARARGS, SetObject_doc},
|
||||
{"setObject", (PyCFunction) KX_SCA_AddObjectActuator::sPySetObject, METH_O, SetObject_doc},
|
||||
{"setTime", (PyCFunction) KX_SCA_AddObjectActuator::sPySetTime, METH_VARARGS, SetTime_doc},
|
||||
{"getObject", (PyCFunction) KX_SCA_AddObjectActuator::sPyGetObject, METH_VARARGS, GetObject_doc},
|
||||
{"getTime", (PyCFunction) KX_SCA_AddObjectActuator::sPyGetTime, METH_VARARGS, GetTime_doc},
|
||||
@ -200,41 +200,25 @@ PyObject* KX_SCA_AddObjectActuator::_getattr(const STR_String& attr)
|
||||
|
||||
/* 1. setObject */
|
||||
char KX_SCA_AddObjectActuator::SetObject_doc[] =
|
||||
"setObject(name)\n"
|
||||
"\t- name: string\n"
|
||||
"setObject(object)\n"
|
||||
"\t- object: KX_GameObject, string or None\n"
|
||||
"\tSets the object that will be added. There has to be an object\n"
|
||||
"\tof this name. If not, this function does nothing.\n";
|
||||
|
||||
|
||||
|
||||
PyObject* KX_SCA_AddObjectActuator::PySetObject(PyObject* self,
|
||||
PyObject* args,
|
||||
PyObject* kwds)
|
||||
{
|
||||
PyObject* gameobj;
|
||||
if (PyArg_ParseTuple(args, "O!", &KX_GameObject::Type, &gameobj))
|
||||
{
|
||||
if (m_OriginalObject != NULL)
|
||||
m_OriginalObject->UnregisterActuator(this);
|
||||
m_OriginalObject = (SCA_IObject*)gameobj;
|
||||
if (m_OriginalObject)
|
||||
m_OriginalObject->RegisterActuator(this);
|
||||
Py_Return;
|
||||
}
|
||||
PyErr_Clear();
|
||||
PyObject* KX_SCA_AddObjectActuator::PySetObject(PyObject* self, PyObject* value)
|
||||
{
|
||||
KX_GameObject *gameobj;
|
||||
|
||||
char* objectname;
|
||||
if (PyArg_ParseTuple(args, "s", &objectname))
|
||||
{
|
||||
if (m_OriginalObject != NULL)
|
||||
m_OriginalObject->UnregisterActuator(this);
|
||||
m_OriginalObject = (SCA_IObject*)SCA_ILogicBrick::m_sCurrentLogicManager->GetGameObjectByName(STR_String(objectname));;
|
||||
if (m_OriginalObject)
|
||||
m_OriginalObject->RegisterActuator(this);
|
||||
Py_Return;
|
||||
}
|
||||
if (!ConvertPythonToGameObject(value, &gameobj, true))
|
||||
return NULL; // ConvertPythonToGameObject sets the error
|
||||
|
||||
return NULL;
|
||||
if (m_OriginalObject != NULL)
|
||||
m_OriginalObject->UnregisterActuator(this);
|
||||
|
||||
m_OriginalObject = (SCA_IObject*)gameobj;
|
||||
if (m_OriginalObject)
|
||||
m_OriginalObject->RegisterActuator(this);
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -280,19 +264,22 @@ PyObject* KX_SCA_AddObjectActuator::PyGetTime(PyObject* self,
|
||||
|
||||
/* 4. getObject */
|
||||
char KX_SCA_AddObjectActuator::GetObject_doc[] =
|
||||
"getObject()\n"
|
||||
"getObject(name_only = 1)\n"
|
||||
"name_only - optional arg, when true will return the KX_GameObject rather then its name\n"
|
||||
"\tReturns the name of the object that will be added.\n";
|
||||
|
||||
|
||||
|
||||
PyObject* KX_SCA_AddObjectActuator::PyGetObject(PyObject* self,
|
||||
PyObject* args,
|
||||
PyObject* kwds)
|
||||
PyObject* KX_SCA_AddObjectActuator::PyGetObject(PyObject* self, PyObject* args)
|
||||
{
|
||||
int ret_name_only = 1;
|
||||
if (!PyArg_ParseTuple(args, "|i", &ret_name_only))
|
||||
return NULL;
|
||||
|
||||
if (!m_OriginalObject)
|
||||
Py_Return;
|
||||
|
||||
return PyString_FromString(m_OriginalObject->GetName());
|
||||
Py_RETURN_NONE;
|
||||
|
||||
if (ret_name_only)
|
||||
return PyString_FromString(m_OriginalObject->GetName());
|
||||
else
|
||||
return m_OriginalObject->AddRef();
|
||||
}
|
||||
|
||||
|
||||
|
@ -113,13 +113,13 @@ public:
|
||||
void InstantAddObject();
|
||||
|
||||
/* 1. setObject */
|
||||
KX_PYMETHOD_DOC(KX_SCA_AddObjectActuator,SetObject);
|
||||
KX_PYMETHOD_DOC_O(KX_SCA_AddObjectActuator,SetObject);
|
||||
/* 2. setTime */
|
||||
KX_PYMETHOD_DOC(KX_SCA_AddObjectActuator,SetTime);
|
||||
/* 3. getTime */
|
||||
KX_PYMETHOD_DOC(KX_SCA_AddObjectActuator,GetTime);
|
||||
/* 4. getObject */
|
||||
KX_PYMETHOD_DOC(KX_SCA_AddObjectActuator,GetObject);
|
||||
KX_PYMETHOD_DOC_VARARGS(KX_SCA_AddObjectActuator,GetObject);
|
||||
/* 5. getLinearVelocity */
|
||||
KX_PYMETHOD_DOC(KX_SCA_AddObjectActuator,GetLinearVelocity);
|
||||
/* 6. setLinearVelocity */
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -454,7 +454,7 @@ PyParentObject KX_TrackToActuator::Parents[] = {
|
||||
|
||||
|
||||
PyMethodDef KX_TrackToActuator::Methods[] = {
|
||||
{"setObject", (PyCFunction) KX_TrackToActuator::sPySetObject, METH_VARARGS, SetObject_doc},
|
||||
{"setObject", (PyCFunction) KX_TrackToActuator::sPySetObject, METH_O, SetObject_doc},
|
||||
{"getObject", (PyCFunction) KX_TrackToActuator::sPyGetObject, METH_VARARGS, GetObject_doc},
|
||||
{"setTime", (PyCFunction) KX_TrackToActuator::sPySetTime, METH_VARARGS, SetTime_doc},
|
||||
{"getTime", (PyCFunction) KX_TrackToActuator::sPyGetTime, METH_VARARGS, GetTime_doc},
|
||||
@ -475,47 +475,45 @@ PyObject* KX_TrackToActuator::_getattr(const STR_String& attr)
|
||||
/* 1. setObject */
|
||||
char KX_TrackToActuator::SetObject_doc[] =
|
||||
"setObject(object)\n"
|
||||
"\t- object: string\n"
|
||||
"\t- object: KX_GameObject, string or None\n"
|
||||
"\tSet the object to track with the parent of this actuator.\n";
|
||||
PyObject* KX_TrackToActuator::PySetObject(PyObject* self, PyObject* args, PyObject* kwds) {
|
||||
PyObject* gameobj;
|
||||
if (PyArg_ParseTuple(args, "O!", &KX_GameObject::Type, &gameobj))
|
||||
{
|
||||
if (m_object != NULL)
|
||||
m_object->UnregisterActuator(this);
|
||||
m_object = (SCA_IObject*)gameobj;
|
||||
if (m_object)
|
||||
m_object->RegisterActuator(this);
|
||||
Py_Return;
|
||||
}
|
||||
PyErr_Clear();
|
||||
PyObject* KX_TrackToActuator::PySetObject(PyObject* self, PyObject* value)
|
||||
{
|
||||
KX_GameObject *gameobj;
|
||||
|
||||
char* objectname;
|
||||
if (PyArg_ParseTuple(args, "s", &objectname))
|
||||
{
|
||||
if (m_object != NULL)
|
||||
m_object->UnregisterActuator(this);
|
||||
m_object= static_cast<SCA_IObject*>(SCA_ILogicBrick::m_sCurrentLogicManager->GetGameObjectByName(STR_String(objectname)));
|
||||
if (m_object)
|
||||
m_object->RegisterActuator(this);
|
||||
Py_Return;
|
||||
}
|
||||
if (!ConvertPythonToGameObject(value, &gameobj, true))
|
||||
return NULL; // ConvertPythonToGameObject sets the error
|
||||
|
||||
return NULL;
|
||||
if (m_object != NULL)
|
||||
m_object->UnregisterActuator(this);
|
||||
|
||||
m_object = (SCA_IObject*)gameobj;
|
||||
if (m_object)
|
||||
m_object->RegisterActuator(this);
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* 2. getObject */
|
||||
char KX_TrackToActuator::GetObject_doc[] =
|
||||
"getObject()\n"
|
||||
"\tReturns the object to track with the parent of this actuator.\n";
|
||||
PyObject* KX_TrackToActuator::PyGetObject(PyObject* self, PyObject* args, PyObject* kwds)
|
||||
"getObject(name_only = 1)\n"
|
||||
"name_only - optional arg, when true will return the KX_GameObject rather then its name\n"
|
||||
"\tReturns the object to track with the parent of this actuator\n";
|
||||
PyObject* KX_TrackToActuator::PyGetObject(PyObject* self, PyObject* args)
|
||||
{
|
||||
int ret_name_only = 1;
|
||||
if (!PyArg_ParseTuple(args, "|i", &ret_name_only))
|
||||
return NULL;
|
||||
|
||||
if (!m_object)
|
||||
Py_Return;
|
||||
|
||||
return PyString_FromString(m_object->GetName());
|
||||
Py_RETURN_NONE;
|
||||
|
||||
if (ret_name_only)
|
||||
return PyString_FromString(m_object->GetName());
|
||||
else
|
||||
return m_object->AddRef();
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,9 +75,9 @@ class KX_TrackToActuator : public SCA_IActuator
|
||||
virtual PyObject* _getattr(const STR_String& attr);
|
||||
|
||||
/* 1. setObject */
|
||||
KX_PYMETHOD_DOC(KX_TrackToActuator,SetObject);
|
||||
KX_PYMETHOD_DOC_O(KX_TrackToActuator,SetObject);
|
||||
/* 2. getObject */
|
||||
KX_PYMETHOD_DOC(KX_TrackToActuator,GetObject);
|
||||
KX_PYMETHOD_DOC_VARARGS(KX_TrackToActuator,GetObject);
|
||||
/* 3. setTime */
|
||||
KX_PYMETHOD_DOC(KX_TrackToActuator,SetTime);
|
||||
/* 4. getTime */
|
||||
|
@ -71,8 +71,7 @@ PyObject* KX_VehicleWrapper::PyAddWheel(PyObject* self,
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -157,8 +156,7 @@ PyObject* KX_VehicleWrapper::PyApplyEngineForce(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PyObject* KX_VehicleWrapper::PySetTyreFriction(PyObject* self,
|
||||
@ -175,8 +173,7 @@ PyObject* KX_VehicleWrapper::PySetTyreFriction(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PyObject* KX_VehicleWrapper::PySetSuspensionStiffness(PyObject* self,
|
||||
@ -193,8 +190,7 @@ PyObject* KX_VehicleWrapper::PySetSuspensionStiffness(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PyObject* KX_VehicleWrapper::PySetSuspensionDamping(PyObject* self,
|
||||
@ -210,8 +206,7 @@ PyObject* KX_VehicleWrapper::PySetSuspensionDamping(PyObject* self,
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PyObject* KX_VehicleWrapper::PySetSuspensionCompression(PyObject* self,
|
||||
@ -227,8 +222,7 @@ PyObject* KX_VehicleWrapper::PySetSuspensionCompression(PyObject* self,
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PyObject* KX_VehicleWrapper::PySetRollInfluence(PyObject* self,
|
||||
@ -245,8 +239,7 @@ PyObject* KX_VehicleWrapper::PySetRollInfluence(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -264,8 +257,7 @@ PyObject* KX_VehicleWrapper::PyApplyBraking(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -285,8 +277,7 @@ PyObject* KX_VehicleWrapper::PySetSteeringValue(PyObject* self,
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -8,11 +8,13 @@ class KX_CameraActuator(SCA_IActuator):
|
||||
|
||||
@author: snail
|
||||
"""
|
||||
def getObject():
|
||||
def getObject(name_only = 1):
|
||||
"""
|
||||
Returns the name of the object this actuator tracks.
|
||||
|
||||
rtype: string
|
||||
@type name_only: bool
|
||||
@param name_only: optional argument, when 0 return a KX_GameObject
|
||||
@rtype: string, KX_GameObject or None if no object is set
|
||||
"""
|
||||
|
||||
def setObject(target):
|
||||
@ -20,7 +22,7 @@ class KX_CameraActuator(SCA_IActuator):
|
||||
Sets the object this actuator tracks.
|
||||
|
||||
@param target: the object to track.
|
||||
@type target: string or L{KX_GameObject}
|
||||
@type target: L{KX_GameObject}, string or None
|
||||
"""
|
||||
|
||||
def getMin():
|
||||
|
@ -12,11 +12,12 @@ class KX_ParentActuator(SCA_IActuator):
|
||||
|
||||
Object can be either a L{KX_GameObject} or the name of the object.
|
||||
|
||||
@type object: L{KX_GameObject} or string
|
||||
@type object: L{KX_GameObject}, string or None
|
||||
"""
|
||||
def getObject():
|
||||
def getObject(name_only = 1):
|
||||
"""
|
||||
Returns the name of the object to change to.
|
||||
|
||||
@rtype: string
|
||||
@type name_only: bool
|
||||
@param name_only: optional argument, when 0 return a KX_GameObject
|
||||
@rtype: string, KX_GameObject or None if no object is set
|
||||
"""
|
||||
|
@ -13,7 +13,7 @@ class KX_SCA_AddObjectActuator(SCA_IActuator):
|
||||
|
||||
C{ERROR: GameObject I{OBName} has a AddObjectActuator I{ActuatorName} without object (in 'nonactive' layer)}
|
||||
"""
|
||||
def setObject(obj):
|
||||
def setObject(object):
|
||||
"""
|
||||
Sets the game object to add.
|
||||
|
||||
@ -21,17 +21,18 @@ class KX_SCA_AddObjectActuator(SCA_IActuator):
|
||||
|
||||
If the object does not exist, this function is ignored.
|
||||
|
||||
obj can either be a L{KX_GameObject} or the name of an object.
|
||||
object can either be a L{KX_GameObject} or the name of an object or None.
|
||||
|
||||
@type obj: L{KX_GameObject} or string
|
||||
@type object: L{KX_GameObject}, string or None
|
||||
"""
|
||||
def getObject():
|
||||
def getObject(name_only = 0):
|
||||
"""
|
||||
Returns the name of the game object to be added.
|
||||
|
||||
Returns None if no game object has been assigned to be added.
|
||||
|
||||
@rtype: string
|
||||
@type name_only: bool
|
||||
@param name_only: optional argument, when 0 return a KX_GameObject
|
||||
@rtype: string, KX_GameObject or None if no object is set
|
||||
"""
|
||||
def setTime(time):
|
||||
"""
|
||||
|
@ -18,16 +18,16 @@ class KX_TrackToActuator(SCA_IActuator):
|
||||
"""
|
||||
Sets the object to track.
|
||||
|
||||
@type object: L{KX_GameObject} or string
|
||||
@type object: L{KX_GameObject}, string or None
|
||||
@param object: Either a reference to a game object or the name of the object to track.
|
||||
"""
|
||||
def getObject():
|
||||
"""
|
||||
Returns the name of the object to track.
|
||||
|
||||
Returns None if no object has been set to track.
|
||||
|
||||
@rtype: string
|
||||
@type name_only: bool
|
||||
@param name_only: optional argument, when 0 return a KX_GameObject
|
||||
@rtype: string, KX_GameObject or None if no object is set
|
||||
"""
|
||||
def setTime(time):
|
||||
"""
|
||||
|
@ -332,6 +332,8 @@ def read_opts(cfg, args):
|
||||
|
||||
('BF_X264_CONFIG', 'configuration flags for x264', ''),
|
||||
('BF_XVIDCORE_CONFIG', 'configuration flags for xvidcore', ''),
|
||||
|
||||
('BF_CONFIG', 'SCons python config file used to set default options', 'user_config.py'),
|
||||
|
||||
) # end of opts.AddOptions()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user