Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct9
-rw-r--r--intern/boolop/SConscript2
-rw-r--r--intern/boolop/intern/BOP_Interface.cpp2
-rw-r--r--intern/boolop/make/msvc_7_0/boolop.vcproj9
-rw-r--r--intern/bsp/SConscript2
-rw-r--r--projectfiles_vc7/blender/BPY_python/BPY_python.vcproj108
-rw-r--r--projectfiles_vc7/blender/blender.sln9
-rw-r--r--projectfiles_vc7/gameengine/ketsji/KX_ketsji.vcproj9
-rw-r--r--projectfiles_vc7/gameengine/physics/PHY_Physics/PHY_Sumo/PHY_Sumo.vcproj1
-rw-r--r--release/scripts/import_dxf.py926
-rw-r--r--release/scripts/weightpaint_clean.py7
-rw-r--r--source/blender/blenkernel/BKE_texture.h1
-rw-r--r--source/blender/blenkernel/bad_level_call_stubs/stubs.c4
-rw-r--r--source/blender/blenkernel/intern/collision.c221
-rw-r--r--source/blender/blenkernel/intern/customdata.c24
-rw-r--r--source/blender/blenkernel/intern/modifier.c39
-rw-r--r--source/blender/blenkernel/intern/particle.c3
-rw-r--r--source/blender/blenkernel/intern/texture.c16
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c3
-rw-r--r--source/blender/blenlib/intern/boxpack2d.c10
-rw-r--r--source/blender/blenloader/intern/writefile.c2
-rw-r--r--source/blender/imbuf/intern/anim.c15
-rw-r--r--source/blender/include/BIF_editarmature.h7
-rw-r--r--source/blender/include/BIF_poseobject.h2
-rw-r--r--source/blender/python/BPY_interface.c64
-rw-r--r--source/blender/python/api2_2x/Blender.c2
-rw-r--r--source/blender/python/api2_2x/Constraint.c29
-rw-r--r--source/blender/python/api2_2x/Material.c12
-rw-r--r--source/blender/python/api2_2x/Mathutils.c8
-rw-r--r--source/blender/python/api2_2x/Mathutils.h2
-rw-r--r--source/blender/render/intern/source/convertblender.c14
-rw-r--r--source/blender/src/buttons_object.c3
-rw-r--r--source/blender/src/buttons_scene.c11
-rw-r--r--source/blender/src/drawgpencil.c308
-rw-r--r--source/blender/src/drawseq.c24
-rw-r--r--source/blender/src/editarmature.c164
-rw-r--r--source/blender/src/editimasel.c6
-rw-r--r--source/blender/src/editseq.c1
-rw-r--r--source/blender/src/header_info.c53
-rw-r--r--source/blender/src/header_view3d.c81
-rw-r--r--source/blender/src/poseobject.c61
-rw-r--r--source/blender/src/space.c17
-rw-r--r--source/blender/src/toolbox.c9
-rw-r--r--source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp3
-rw-r--r--source/gameengine/Converter/KX_IpoConvert.cpp9
-rw-r--r--source/gameengine/GamePlayer/common/windows/GPW_Canvas.h2
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Application.cpp8
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp81
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.h1
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp13
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.h1
-rw-r--r--source/gameengine/Ketsji/KX_TouchEventManager.cpp12
-rw-r--r--source/gameengine/Ketsji/SConscript16
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsController.cpp5
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsController.h9
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp22
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h5
-rw-r--r--source/gameengine/PyDoc/KX_GameObject.py10
58 files changed, 1672 insertions, 825 deletions
diff --git a/SConstruct b/SConstruct
index 869ba6454c8..4c3bbf8fad7 100644
--- a/SConstruct
+++ b/SConstruct
@@ -184,15 +184,16 @@ if env['WITH_BF_OPENMP'] == 1:
env['CPPFLAGS'].append('/openmp')
env['CXXFLAGS'].append('/openmp')
else:
- if env['CC'] == 'icc':
+ if env['CC'][-3:] == 'icc': # to be able to handle CC=/opt/bla/icc case
env.Append(LINKFLAGS=['-openmp', '-static-intel'])
env['CCFLAGS'].append('-openmp')
env['CPPFLAGS'].append('-openmp')
env['CXXFLAGS'].append('-openmp')
else:
- env['CCFLAGS'].append('-fopenmp')
- env['CPPFLAGS'].append('-fopenmp')
- env['CXXFLAGS'].append('-fopenmp')
+ env.Append(CCFLAGS=['-fopenmp'])
+ env.Append(CPPFLAGS=['-fopenmp'])
+ env.Append(CXXFLAGS=['-fopenmp'])
+ # env.Append(LINKFLAGS=['-fprofile-generate'])
#check for additional debug libnames
diff --git a/intern/boolop/SConscript b/intern/boolop/SConscript
index a3f3c0b6433..bec263f251f 100644
--- a/intern/boolop/SConscript
+++ b/intern/boolop/SConscript
@@ -8,7 +8,7 @@ incs += ' ../../source/blender/makesdna ../../intern/guardedalloc'
incs += ' ../../source/blender/blenlib'
if (env['OURPLATFORM'] == 'win32-mingw'):
- env.BlenderLib ('blender_bop', sources, Split(incs) , [], libtype=['common','intern'], priority = [5,50] )
+ env.BlenderLib ('blender_bop', sources, Split(incs) , [], libtype=['common','intern'], priority = [30,85] )
else:
env.BlenderLib ('blender_bop', sources, Split(incs) , [], libtype='common', priority = 5 )
diff --git a/intern/boolop/intern/BOP_Interface.cpp b/intern/boolop/intern/BOP_Interface.cpp
index 898ca708204..c6bcb4a74ce 100644
--- a/intern/boolop/intern/BOP_Interface.cpp
+++ b/intern/boolop/intern/BOP_Interface.cpp
@@ -37,7 +37,7 @@
#include "BOP_Chrono.h"
#if defined(BOP_ORIG_MERGE) && defined(BOP_NEW_MERGE)
-#include "../../source/blender/blenkernel/BKE_global.h"
+#include "../../../source/blender/blenkernel/BKE_global.h"
#endif
BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC,
diff --git a/intern/boolop/make/msvc_7_0/boolop.vcproj b/intern/boolop/make/msvc_7_0/boolop.vcproj
index 7ae417e42d5..6e6d6abeb43 100644
--- a/intern/boolop/make/msvc_7_0/boolop.vcproj
+++ b/intern/boolop/make/msvc_7_0/boolop.vcproj
@@ -279,6 +279,9 @@ ECHO Done
RelativePath="..\..\intern\BOP_Merge.cpp">
</File>
<File
+ RelativePath="..\..\intern\BOP_Merge2.cpp">
+ </File>
+ <File
RelativePath="..\..\intern\BOP_Mesh.cpp">
</File>
<File
@@ -331,9 +334,15 @@ ECHO Done
RelativePath="..\..\intern\BOP_Merge.h">
</File>
<File
+ RelativePath="..\..\intern\BOP_Merge2.h">
+ </File>
+ <File
RelativePath="..\..\intern\BOP_Mesh.h">
</File>
<File
+ RelativePath="..\..\intern\BOP_Misc.h">
+ </File>
+ <File
RelativePath="..\..\intern\BOP_Segment.h">
</File>
<File
diff --git a/intern/bsp/SConscript b/intern/bsp/SConscript
index 88d2529ae59..39f278625a9 100644
--- a/intern/bsp/SConscript
+++ b/intern/bsp/SConscript
@@ -6,7 +6,7 @@ sources = env.Glob('intern/*.cpp')
incs = 'intern ../container ../moto/include ../memutil'
if (env['OURPLATFORM'] == 'win32-mingw'):
- env.BlenderLib ('blender_BSP', sources, Split(incs), [], libtype=['common','intern'], priority=[26,26] )
+ env.BlenderLib ('blender_BSP', sources, Split(incs), [], libtype=['common','intern'], priority=[26,69] )
else:
env.BlenderLib ('blender_BSP', sources, Split(incs), [], libtype='core', priority=26 )
diff --git a/projectfiles_vc7/blender/BPY_python/BPY_python.vcproj b/projectfiles_vc7/blender/BPY_python/BPY_python.vcproj
index a31b9130db3..97f70a26db4 100644
--- a/projectfiles_vc7/blender/BPY_python/BPY_python.vcproj
+++ b/projectfiles_vc7/blender/BPY_python/BPY_python.vcproj
@@ -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>
diff --git a/projectfiles_vc7/blender/blender.sln b/projectfiles_vc7/blender/blender.sln
index 60c2d8f2d4c..1b069fa4677 100644
--- a/projectfiles_vc7/blender/blender.sln
+++ b/projectfiles_vc7/blender/blender.sln
@@ -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
diff --git a/projectfiles_vc7/gameengine/ketsji/KX_ketsji.vcproj b/projectfiles_vc7/gameengine/ketsji/KX_ketsji.vcproj
index 9d5a9f55074..c046d434cb3 100644
--- a/projectfiles_vc7/gameengine/ketsji/KX_ketsji.vcproj
+++ b/projectfiles_vc7/gameengine/ketsji/KX_ketsji.vcproj
@@ -126,7 +126,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet"
+ AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\python\api2_2x"
PreprocessorDefinitions="JANCODEPANCO;WIN32;_LIB;EXP_PYTHON_EMBEDDING;_DEBUG;USE_SUMO_SOLID;WITH_GLEXT"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@@ -179,7 +179,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet"
+ AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\python\api2_2x"
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;USE_SUMO_SOLID;WITH_GLEXT"
StringPooling="TRUE"
RuntimeLibrary="0"
@@ -232,11 +232,12 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet"
+ AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\python\api2_2x"
PreprocessorDefinitions="JANCODEPANCO;WIN32;_LIB;EXP_PYTHON_EMBEDDING;_DEBUG;USE_SUMO_SOLID;WITH_GLEXT"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
DefaultCharIsUnsigned="TRUE"
+ RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="..\..\..\..\build\msvc_7\source\gameengine\ketsji\debug\KX_ketsji.pch"
AssemblerListingLocation="..\..\..\..\build\msvc_7\source\gameengine\ketsji\debug\"
@@ -284,7 +285,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet"
+ AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\python\api2_2x"
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;USE_SUMO_SOLID;WITH_GLEXT"
StringPooling="TRUE"
RuntimeLibrary="0"
diff --git a/projectfiles_vc7/gameengine/physics/PHY_Physics/PHY_Sumo/PHY_Sumo.vcproj b/projectfiles_vc7/gameengine/physics/PHY_Physics/PHY_Sumo/PHY_Sumo.vcproj
index a8d6e77cd58..33806e32d65 100644
--- a/projectfiles_vc7/gameengine/physics/PHY_Physics/PHY_Sumo/PHY_Sumo.vcproj
+++ b/projectfiles_vc7/gameengine/physics/PHY_Physics/PHY_Sumo/PHY_Sumo.vcproj
@@ -171,6 +171,7 @@
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
+ RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_7\source\gameengine\physics\sumo\debug\PHY_Sumo.pch"
AssemblerListingLocation="..\..\..\..\..\..\build\msvc_7\source\gameengine\physics\sumo\debug\"
diff --git a/release/scripts/import_dxf.py b/release/scripts/import_dxf.py
index ce7df610d98..09e51c22a9f 100644
--- a/release/scripts/import_dxf.py
+++ b/release/scripts/import_dxf.py
@@ -2,15 +2,15 @@
"""
Name: 'Autodesk DXF (.dxf)'
-Blender: 244
+Blender: 246
Group: 'Import'
Tooltip: 'Import for DXF geometry data (Drawing eXchange Format).'
"""
__author__ = 'Kitsu(Ed Blake) & migius(Remigiusz Fiedler)'
-__version__ = '1.0.12 - 2008.06.05 by migius'
+__version__ = '1.12 - 2008.07.04 by migius'
__url__ = ["http://blenderartists.org/forum/showthread.php?t=84319",
"http://wiki.blender.org/index.php/Scripts/Manual/Import/DXF-3D"]
-__email__ = ["Kitsune_e(at)yahoo.com", "migius(at)4d-vectors.de"]
+__email__ = ["migius(at)4d-vectors.de","Kitsune_e(at)yahoo.com"]
__bpydoc__ = """\
This script imports objects from DXF (2d/3d) into Blender.
@@ -19,7 +19,7 @@ Supported DXF format versions: from (r2.5) r12 up to 2008.
Enhanced features are:
- configurable object filtering and geometry manipulation,
- configurable material pre-processing,
-- DXF-data analyze and raporting.
+- DXF-code analyze and reporting.
Supported DXF r12 objects:
LINE,
@@ -41,10 +41,10 @@ XREF (External Reference).
Supported DXF>r12 objects:
ELLIPSE,
-LWPOLYLINE (LightWeight Polylines),
-(wip v1.0.12) SPLINE,
-(wip v1.0.13) MLINE,
-(wip v1.0.13) MTEXT
+LWPOLYLINE (LightWeight Polyline),
+SPLINE,
+(wip v1.13) MLINE,
+(wip v1.13) MTEXT
Unsupported objects:
DXF r12: DIMENSION.
@@ -60,7 +60,7 @@ Supported layout modes:
Supported scene definition objescts produced with AVE_RENDER:
scene: selection of lights assigned to the camera,
lights: DIRECT, OVERHEAD, SH_SPOT,
-(wip v1.0.13 import of AVE_RENDER material definitions)
+(wip v1.13 import of AVE_RENDER material definitions)
Hierarchy:
Entire DXF BLOCK hierarchy is preserved after import into Blender
@@ -73,7 +73,7 @@ thickness,
width,
color,
layer,
-(wip v1.0.12: XDATA, grouped status)
+(wip v1.13: XDATA, grouped status)
It is recommended to use DXF-object properties for assign Blender materials.
Notes:
@@ -109,9 +109,22 @@ History:
-- bug: Registry recall from hd_cache ?? only win32 bug??
-- support DXF-definitions of scene, lights and cameras
-- support ortho mode for VIEWs and VPORTs as cameras
- -- add support for SPLINEs
- v1.0.12: 2008.06.05 by migius
+
+ v1.12 - 2008.08.03 by migius
+ c2 warningfix: relocating of globals: layersmap, oblist
+ c2 modif UI: buttons newScene+targetLayer moved to start panel
+ v1.12 - 2008.07.04 by migius
+ c1 added control Curve's OrderU parameter
+ c1 modif UI: preset buttons X-2D-3D moved to start panel
+ b6 added handling exception of not registered LAYERs (Hammer-HL-editor DXF output)
+ b5 rebuild UI: global preset 2D for Curve-Import
+ b5 added UI-options: PL-MESH N+N plmesh_flip and normals_out
+ b5 added support for SPLINEs, added control OrderU parameter
+ b5 rewrote draw module for NURBS_curve and Bezier_curve
+ v1.12 - 2008.06.22 by migius
+ b4 change versioning system 1.0.12 -> 1.12
+ b4 print at start version-info to console
b3 bugfix: ob.name conflict with existing meshes (different ob.name/mesh.name)
v1.0.12: 2008.05.24 by migius
b2 added support for LWPOLYLINEs
@@ -310,16 +323,16 @@ except ImportError:
#print 'psyco not imported'
pass
-print '\n\n\n\n'
-print 'DXF-Importer *** start ***' #---------------------
+#try: Curve.orderU
+
+print '\n\n\n'
+print 'DXF-Importer v%s *** start ***' %(__version__) #---------------------
SCENE = None
WORLDX = Mathutils.Vector((1,0,0))
WORLDY = Mathutils.Vector((1,1,0))
WORLDZ = Mathutils.Vector((0,0,1))
-oblist = [] #to be sure, it is an empty list
-
G_SCALE = 1.0 #(0.0001-1000) global scaling factor for all dxf data
G_ORIGIN_X = 0.0 #global translation-vector (x,y,z) in DXF units
G_ORIGIN_Y = 0.0
@@ -335,12 +348,15 @@ MIN_WIDTH = MIN_DIST * 10.0 #minimal width by forced width
TRIM_LIMIT = 3.0 #limit for triming of polylines-wide-segments (values:0.0 - 5.0)
ELEVATION = 0.0 #standard elevation = coordinate Z
-TARGET_LAYER = 3 #target blender_layer
-GROUP_BYLAYER = 0 #(0/1) all entities from same layer import into one blender-group
-cur_COUNTER = 0 #counter for progress_bar
-M_OBJ = False
BYBLOCK = 0
BYLAYER = 256
+TARGET_LAYER = 3 #target blender_layer
+GROUP_BYLAYER = 0 #(0/1) all entities from same layer import into one blender-group
+LAYER_DEF_NAME = 'AAAA' #default layer name
+LAYER_DEF_COLOR = 4 #default layer color
+E_M = 0
+LAB = "*) parts under construction"
+M_OBJ = 0
FILENAME_MAX = 180 #max length of path+file_name string (FILE_MAXDIR + FILE_MAXFILE)
MAX_NAMELENGTH = 17 #max_effective_obnamelength in blender =21=17+(.001)
@@ -366,27 +382,27 @@ class View: #-----------------------------------------------------------------
self.type = obj.type
self.name = obj.get_type(2)[0]
- self.data = obj.data[:]
+# self.data = obj.data[:]
- self.centerX = getit(obj.data, 10, 0.0) #view center pointX (in DCS)
- self.centerY = getit(obj.data, 20, 0.0) #view center pointY (in DCS)
+ self.centerX = getit(obj, 10, 0.0) #view center pointX (in DCS)
+ self.centerY = getit(obj, 20, 0.0) #view center pointY (in DCS)
self.height = obj.get_type(40)[0] #view height (in DCS)
self.width = obj.get_type(41)[0] #view width (in DCS)
self.dir = [0,0,0]
- self.dir[0] = getit(obj.data, 11, 0.0) #view directionX from target (in WCS)
- self.dir[1] = getit(obj.data, 21, 0.0) #
- self.dir[2] = getit(obj.data, 31, 0.0) #
+ self.dir[0] = getit(obj, 11, 0.0) #view directionX from target (in WCS)
+ self.dir[1] = getit(obj, 21, 0.0) #
+ self.dir[2] = getit(obj, 31, 0.0) #
self.target = [0,0,0]
- self.target[0] = getit(obj.data, 12, 0.0) #target pointX(in WCS)
- self.target[1] = getit(obj.data, 22, 0.0) #
- self.target[2] = getit(obj.data, 32, 0.0) #
+ self.target[0] = getit(obj, 12, 0.0) #target pointX(in WCS)
+ self.target[1] = getit(obj, 22, 0.0) #
+ self.target[2] = getit(obj, 32, 0.0) #
self.length = obj.get_type(42)[0] #Lens length
- self.clip_front = getit(obj.data, 43) #Front clipping plane (offset from target point)
- self.clip_back = getit(obj.data, 44) #Back clipping plane (offset from target point)
+ self.clip_front = getit(obj, 43) #Front clipping plane (offset from target point)
+ self.clip_back = getit(obj, 44) #Back clipping plane (offset from target point)
self.twist = obj.get_type(50)[0] #view twist angle in degrees
self.flags = getit(obj, 70, 0)
@@ -450,28 +466,28 @@ class Vport: #-----------------------------------------------------------------
self.type = obj.type
self.name = obj.get_type(2)[0]
- self.data = obj.data[:]
+# self.data = obj.data[:]
#print 'deb:vport name, data:', self.name #-------
#print 'deb:vport data:', self.data #-------
self.height = obj.get_type(40)[0] #vport height (in DCS)
- self.centerX = getit(obj.data, 12, 0.0) #vport center pointX (in DCS)
- self.centerY = getit(obj.data, 22, 0.0) #vport center pointY (in DCS)
+ self.centerX = getit(obj, 12, 0.0) #vport center pointX (in DCS)
+ self.centerY = getit(obj, 22, 0.0) #vport center pointY (in DCS)
self.width = self.height * obj.get_type(41)[0] #vport aspect ratio - width (in DCS)
self.dir = [0,0,0]
- self.dir[0] = getit(obj.data, 16, 0.0) #vport directionX from target (in WCS)
- self.dir[1] = getit(obj.data, 26, 0.0) #
- self.dir[2] = getit(obj.data, 36, 0.0) #
+ self.dir[0] = getit(obj, 16, 0.0) #vport directionX from target (in WCS)
+ self.dir[1] = getit(obj, 26, 0.0) #
+ self.dir[2] = getit(obj, 36, 0.0) #
self.target = [0,0,0]
- self.target[0] = getit(obj.data, 17, 0.0) #target pointX(in WCS)
- self.target[1] = getit(obj.data, 27, 0.0) #
- self.target[2] = getit(obj.data, 37, 0.0) #
+ self.target[0] = getit(obj, 17, 0.0) #target pointX(in WCS)
+ self.target[1] = getit(obj, 27, 0.0) #
+ self.target[2] = getit(obj, 37, 0.0) #
self.length = obj.get_type(42)[0] #Lens length
- self.clip_front = getit(obj.data, 43) #Front clipping plane (offset from target point)
- self.clip_back = getit(obj.data, 44) #Back clipping plane (offset from target point)
+ self.clip_front = getit(obj, 43) #Front clipping plane (offset from target point)
+ self.clip_back = getit(obj, 44) #Back clipping plane (offset from target point)
self.twist = obj.get_type(51)[0] #view twist angle
self.flags = getit(obj, 70, 0)
@@ -528,29 +544,36 @@ class Layer: #-----------------------------------------------------------------
"""Class for objects representing dxf LAYERs.
"""
def __init__(self, obj, name=None, color=None, frozen=None):
- """Expects an object of type layer as input.
+ """Expects an dxfobject of type layer as input.
+ if no dxfobject - creates surogate layer with default parameters
"""
- self.type = obj.type
- self.data = obj.data[:]
-
- if name:
- self.name = name
- #self.bfname = name #--todo---see layernamesmap in f_getLayersmap ---
- else:
- self.name = obj.get_type(2)[0] #layer name of object
-
- if color:
- self.color = color
- else:
- self.color = obj.get_type(62)[0] #color of object
-
- if frozen:
- self.frozen = frozen
- else:
- self.flags = obj.get_type(70)[0]
- self.frozen = self.flags & 1
-
+ if obj==None:
+ self.type = 'layer'
+ if name: self.name = name
+ else: self.name = LAYER_DEF_NAME
+
+ if color: self.color = color
+ else: self.color = LAYER_DEF_COLOR
+
+ if frozen!=None: self.frozen = frozen
+ else: self.frozen = 0
+ else:
+ if obj.type=='layer':
+ self.type = obj.type
+ #self.data = obj.data[:]
+ if name: self.name = name
+ #self.bfname = name #--todo---see layernamesmap in f_getLayersmap ---
+ else: self.name = obj.get_type(2)[0] #layer name of object
+
+ if color: self.color = color
+ else: self.color = obj.get_type(62)[0] #color of object
+
+ if frozen!=None: self.frozen = frozen
+ else:
+ self.flags = obj.get_type(70)[0]
+ self.frozen = self.flags & 1
+
def __repr__(self):
return "%s: name - %s, color - %s" %(self.__class__.__name__, self.name, self.color)
@@ -615,15 +638,15 @@ class Solid: #-----------------------------------------------------------------
raise TypeError, "Wrong type \'%s\' for solid/trace object!" %obj.type
self.type = obj.type
- self.data = obj.data[:]
+# self.data = obj.data[:]
self.space = getit(obj, 67, 0)
self.thic = getit(obj, 39, 0)
self.color_index = getit(obj, 62, BYLAYER)
- self.layer = getit(obj.data, 8, None)
- self.extrusion = get_extrusion(obj.data)
- self.points = self.get_points(obj.data)
+ self.layer = getit(obj, 8, None)
+ self.extrusion = get_extrusion(obj)
+ self.points = self.get_points(obj)
@@ -736,16 +759,16 @@ class Line: #-----------------------------------------------------------------
if not obj.type == 'line':
raise TypeError, "Wrong type \'%s\' for line object!" %obj.type
self.type = obj.type
- self.data = obj.data[:]
+# self.data = obj.data[:]
self.space = getit(obj, 67, 0)
self.thic = getit(obj, 39, 0)
#print 'deb:self.thic: ', self.thic #---------------------
self.color_index = getit(obj, 62, BYLAYER)
- self.layer = getit(obj.data, 8, None)
- self.extrusion = get_extrusion(obj.data)
- self.points = self.get_points(obj.data)
+ self.layer = getit(obj, 8, None)
+ self.extrusion = get_extrusion(obj)
+ self.points = self.get_points(obj)
def get_points(self, data):
@@ -883,16 +906,16 @@ class Point: #-----------------------------------------------------------------
if not obj.type == 'point':
raise TypeError, "Wrong type %s for point object!" %obj.type
self.type = obj.type
- self.data = obj.data[:]
+# self.data = obj.data[:]
self.space = getit(obj, 67, 0)
self.thic = getit(obj, 39, 0)
#print 'deb:self.thic: ', self.thic #---------------------
self.color_index = getit(obj, 62, BYLAYER)
- self.layer = getit(obj.data, 8, None)
- self.extrusion = get_extrusion(obj.data)
- self.points = self.get_points(obj.data)
+ self.layer = getit(obj, 8, None)
+ self.extrusion = get_extrusion(obj)
+ self.points = self.get_points(obj)
def get_points(self, data):
@@ -922,7 +945,7 @@ class Point: #-----------------------------------------------------------------
thic = settings.var['thick_min']
if thic < settings.var['dist_min']: thic = settings.var['dist_min']
- if True: #--todo-- points_as in [1,3,4,5]:
+ if points_as in [1,3,4,5]:
if True: # points_as in [1,5]: # as 'empty'
c = 'Empty'
elif points_as == 3: # as 'thin sphere'
@@ -969,11 +992,8 @@ class Polyline: #--------------------------------------------------------------
if not obj.type == 'polyline':
raise TypeError, "Wrong type %s for polyline object!" %obj.type
self.type = obj.type
- self.data = obj.data[:]
- #print 'deb:polyline.obj.data[:]:\n', obj.data[:] #------------------------
- self.points = []
+# self.data = obj.data[:]
- # optional data (with defaults)
self.space = getit(obj, 67, 0)
self.elevation = getit(obj, 30, 0)
#print 'deb:elevation: ', self.elevation #---------------
@@ -983,7 +1003,7 @@ class Polyline: #--------------------------------------------------------------
self.flags = getit(obj, 70, 0)
self.closed = self.flags & 1 # closed in the M direction
self.curved = self.flags & 2 # Bezier-curve-fit vertices have been added
- self.spline = self.flags & 4 # Bspline-fit vertices have been added
+ self.spline = self.flags & 4 # NURBS-curve-fit vertices have been added
self.poly3d = self.flags & 8 # 3D-polyline
self.plmesh = self.flags & 16 # 3D-polygon mesh
self.closeN = self.flags & 32 # closed in the N direction
@@ -1002,18 +1022,18 @@ class Polyline: #--------------------------------------------------------------
self.vectorsN = getit(obj, 72, None) # PolyMesh: expansion in M-direction / PolyFace: number of faces
#self.resolM = getit(obj, 73, None) # resolution of surface in M direction
#self.resolN = getit(obj, 74, None) # resolution of surface in N direction
- self.curvetyp = getit(obj, 75, 0) # type of curve/surface: 0=None/5=Quadric/6=Cubic/8=Bezier
- self.curvNormal = False
- self.curvQBspline = False
- self.curvCBspline = False
+ self.curvNoFitted = False
+ self.curvQuadrati = False
+ self.curvCubicBsp = False
self.curvBezier = False
- if self.curvetyp == 0: self.curvNormal = True
- elif self.curvetyp == 5: self.curvQBspline = True
- elif self.curvetyp == 6: self.curvCBspline = True
- elif self.curvetyp == 8: self.curvBezier = True
+ curvetype = getit(obj, 75, 0) # type of curve/surface: 0=None/5=Quadric/6=Cubic/8=Bezier
+ if curvetype == 0: self.curvNoFitted = True
+ elif curvetype == 5: self.curvQuadrati = True
+ elif curvetype == 6: self.curvCubicBsp = True
+ elif curvetype == 8: self.curvBezier = True
- self.layer = getit(obj.data, 8, None)
- self.extrusion = get_extrusion(obj.data)
+ self.layer = getit(obj, 8, None)
+ self.extrusion = get_extrusion(obj)
self.points = [] #list with vertices coordinats
self.faces = [] #list with vertices assigment to faces
@@ -1026,9 +1046,65 @@ class Polyline: #--------------------------------------------------------------
+ def doubles_out(self, settings, d_points):
+ """routine to sort out of double.vertices-----------------------------
+ """
+ minimal_dist = settings.var['dist_min'] * 0.1
+ dv_count = 0
+ temp_points = []
+ for i in xrange(len(d_points)-1):
+ point = d_points[i]
+ point2 = d_points[i+1]
+ #print 'deb:double.vertex p1,p2', point, point2 #------------------------
+ delta = Mathutils.Vector(point2.loc) - Mathutils.Vector(point.loc)
+ if delta.length > minimal_dist:
+ temp_points.append(point)
+ else:
+ dv_count+=1
+ #print 'deb:drawPoly2d double.vertex sort out! count=', dv_count #------------------------
+ temp_points.append(d_points[-1]) #------ incl. last vertex -------------
+ #if self.closed: temp_points.append(d_points[1]) #------ loop start vertex -------------
+ d_points = temp_points #-----vertex.list without "double.vertices"
+ #print 'deb:drawPoly2d d_pointsList =after DV-outsorting=====:\n ', d_points #------------------------
+ return d_points
+
+
+ def tribles_out(self, settings, d_points):
+ """routine to sort out of three_in_place.vertices-----------------------------
+ """
+ minimal_dist = settings.var['dist_min'] * 0.1
+ dv_count = 0
+ temp_points = []
+ for i in xrange(len(d_points)-2):
+ point1 = d_points[i]
+ point2 = d_points[i+1]
+ point3 = d_points[i+2]
+ #print 'deb:double.vertex p1,p2', point, point2 #------------------------
+ delta12 = Mathutils.Vector(point2.loc) - Mathutils.Vector(point1.loc)
+ delta23 = Mathutils.Vector(point3.loc) - Mathutils.Vector(point2.loc)
+ if delta12.length < minimal_dist and delta23.length < minimal_dist:
+ dv_count+=1
+ else:
+ temp_points.append(point1)
+ #print 'deb:drawPoly2d double.vertex sort out! count=', dv_count #------------------------
+ point1 = d_points[-2]
+ point2 = d_points[-1]
+ delta12 = Mathutils.Vector(point2.loc) - Mathutils.Vector(point1.loc)
+ if delta12.length > minimal_dist:
+ temp_points.append(d_points[-2]) #------ incl. 2last vertex -------------
+ temp_points.append(d_points[-1]) #------ incl. 1last vertex -------------
+ #if self.closed: temp_points.append(d_points[1]) #------ loop start vertex -------------
+ d_points = temp_points #-----vertex.list without "double.vertices"
+ #print 'deb:drawPoly2d d_pointsList =after DV-outsorting=====:\n ', d_points #------------------------
+ return d_points
+
+
def draw(self, settings): #-------------%%%% DRAW POLYLINE %%%---------------
"""for POLYLINE: generate Blender_geometry.
"""
+ #print 'deb:drawPOLYLINE.START:----------------' #------------------------
+ #print 'deb:POLYLINEdraw self.pltype:', self.pltype #------------------------
+ #print 'deb:POLYLINEdraw self.points:\n', self.points #------------------------
ob = []
#---- 3dPolyFace - mesh with free topology
if self.pltype=='plface' and settings.drawTypes['plmesh']:
@@ -1036,20 +1112,28 @@ class Polyline: #--------------------------------------------------------------
#---- 3dPolyMesh - mesh with ortogonal topology
elif self.pltype=='plmesh' and settings.drawTypes['plmesh']:
ob = self.drawPlMesh(settings)
+
#---- 2dPolyline - plane polyline with arc/wide/thic segments
elif self.pltype=='poly2d' and settings.drawTypes['polyline']:
- if settings.var['plines_as'] == 5: # and self.spline:
+ if settings.var['plines_as'] in [5,6]: # and self.spline:
ob = self.drawPolyCurve(settings)
else:
ob = self.drawPoly2d(settings)
+
#---- 3dPolyline - non-plane polyline (thin segments = without arc/wide/thic)
elif self.pltype=='poly3d' and settings.drawTypes['pline3']:
- if settings.var['plines3_as'] == 5: # and self.spline:
+ if settings.var['plines3_as'] in [5,6]: # and self.spline:
ob = self.drawPolyCurve(settings)
else:
ob = self.drawPoly2d(settings)
- return ob
+ #---- Spline - curved polyline (thin segments = without arc/wide/thic)
+ elif self.pltype=='spline' and settings.drawTypes['spline']:
+ if settings.var['splines_as'] in [5,6]:
+ ob = self.drawPolyCurve(settings)
+ else:
+ ob = self.drawPoly2d(settings)
+ return ob
def drawPlFace(self, settings): #---- 3dPolyFace - mesh with free topology
@@ -1065,6 +1149,10 @@ class Polyline: #--------------------------------------------------------------
else:
points.append(point.loc)
+ if settings.var['plmesh_flip']: # ----------------------
+ for face in faces:
+ face.reverse()
+ face = [face[-1]] + face[:-1]
#print 'deb:drawPlFace: len of points_list:\n', len(points) #-----------------------
#print 'deb:drawPlFace: len of faces_list:\n', len(faces) #-----------------------
@@ -1076,6 +1164,10 @@ class Polyline: #--------------------------------------------------------------
ob = SCENE.objects.new(me) # create a new mesh_object
me.verts.extend(points) # add vertices to mesh
me.faces.extend(faces) # add faces to the mesh
+ if settings.var['normals_out']: # ----------------------
+ #me.flipNormals()
+ me.recalcNormals(0)
+ #me.update()
#print 'deb:drawPlFace: len of me.faces:\n', len(me.faces) #-----------------------
if settings.var['meshSmooth_on']: # ----------------------
@@ -1123,7 +1215,10 @@ class Polyline: #--------------------------------------------------------------
ob = SCENE.objects.new(me) # create a new mesh_object
me.verts.extend([point.loc for point in self.points]) # add vertices to mesh
me.faces.extend(faces) # add faces to the mesh
-
+ if settings.var['normals_out']: # ----------------------
+ #me.flipNormals()
+ me.recalcNormals(0)
+ #me.update()
if settings.var['meshSmooth_on']: # ----------------------
for i in xrange(len(faces)):
me.faces[i].smooth = True
@@ -1142,9 +1237,9 @@ class Polyline: #--------------------------------------------------------------
#print 'deb:drawPoly2d exit, cause POLYLINE has less than 2 vertices' #---------
return
- if self.spline: pline_typ = 'ps' # Polyline-nurbSpline
- elif self.curved: pline_typ = 'pc' # Polyline-bezierCurve
- else: pline_typ = 'pl' # Polyline
+ if self.spline: pline_typ = 'ps' # Polyline-NURBSpline
+ elif self.curved: pline_typ = 'pc' # Polyline-BezierCurve
+ else: pline_typ = 'pl' # Polyline classic
obname = '%s_%s' %(pline_typ, self.layer) # create object_name from layer name
obname = obname[:MAX_NAMELENGTH]
d_points = []
@@ -1160,6 +1255,10 @@ class Polyline: #--------------------------------------------------------------
point.loc[2] = self.elevation
d_points.append(point)
+ #d_points = self.tribles_out(settings, d_points)
+ #d_points = self.doubles_out(settings, d_points)
+ #print 'deb:drawPolyCurve d_pointsList =after DV-outsorting=====:\n ', d_points #------------------------
+
thic = set_thick(self.thic, settings)
if thic != 0.0: #hack: Blender<2.45 curve-extrusion
LocZ = d_points[0].loc[2]
@@ -1173,12 +1272,14 @@ class Polyline: #--------------------------------------------------------------
pline = Curve.New(obname) # create new curve data
#pline.setResolu(24) #--todo-----
- if self.spline: # NURBSplines-----OK-----
+ if False: #old self.spline: # NURBSplines-----OK-----
#print 'deb:polyline2dCurve.draw self.spline!' #---------------
weight1 = 0.5
weight2 = 1.0
- # generate middlepoints except start/end-segments ---
- if self.curvQBspline:
+ if self.curvQuadrati:
+ # Bezier-curve form simulated in NURBS-curve
+ # generate middlepoints except start/end-segments ---
+ #print 'deb:polyline2dCurve.draw extraQBspline!' #---------------
temp_points = []
point = d_points[0].loc
point.append(weight1)
@@ -1231,7 +1332,27 @@ class Polyline: #--------------------------------------------------------------
else:
curve.flagU = 0 # Set curve not cyclic=open
- elif self.curved: #--Bezier-curves---OK-------
+ if self.spline: # NURBSplines-----OK-----
+ #print 'deb:polyline2dCurve.draw self.spline!' #---------------
+ nurbs_points = []
+ for d in d_points:
+ pkt = d.loc
+ pkt.append(d.weight)
+ nurbs_points.append(pkt)
+ firstpoint = nurbs_points[0]
+ curve = pline.appendNurb(firstpoint)
+ curve.setType(4) # set curvetype NURBS
+ for point in nurbs_points[1:]:
+ curve.append(point)
+ if self.closed:
+ curve.flagU = 1+0 # Set curve cyclic=close and uni
+ else:
+ curve.flagU = 0+2 # Set curve not cyclic=open
+ try: curve.orderU = 5 # works only with >2.46svn080625
+ except AttributeError: pass
+ #print 'deb: dir(curve):', dir(curve) #----------------
+
+ elif False: #orig self.curved: #--Bezier-curves---OK-------
#print 'deb:polyline2dCurve.draw self.curved!' #---------------
curve = pline.appendNurb(BezTriple.New(d_points[0]))
for p in d_points[1:]:
@@ -1245,7 +1366,45 @@ class Polyline: #--------------------------------------------------------------
curve[0].handleTypes = [FREE, ALIGN] #remi--todo-----
curve[-1].handleTypes = [ALIGN, FREE] #remi--todo-----
- else: #--straight line- and arc-segments----OK------
+ elif self.curved: #--SPLINE as Bezier-curves---wip------
+ #print 'deb:polyline2dCurve.draw self.curved!' #---------------
+ begtangent, endtangent = None, None
+ if d_points[0].tangent:
+ begtangent = d_points[0]
+ d_points = d_points[1:]
+ if d_points[-1].tangent:
+ endtangent = d_points[-1]
+ d_points = d_points[:-1]
+ curve = pline.appendNurb(BezTriple.New(d_points[0]))
+ for p in d_points[1:]:
+ curve.append(BezTriple.New(p))
+ for point in curve:
+ point.handleTypes = [AUTO, AUTO]
+ #curve.setType(1) #Bezier curve
+ if self.closed:
+ curve.flagU = 5 #1 # Set curve cyclic=close
+ else:
+ curve.flagU = 4 #0 # Set curve not cyclic=open
+ if begtangent:
+ #print 'deb:polyline2dCurve.draw curve[0].vec:', curve[0].vec #-----
+ #print 'deb:polyline2dCurve.draw begtangent:', begtangent #-----
+ p0h1,p0,p0h2 = curve[0].vec
+ p0h1 = [p0h1[i]+begtangent[i] for i in range(3)]
+ curve.__setitem__(0,BezTriple.New(p0h1+p0+p0h2))
+ curve[0].handleTypes = [FREE, ALIGN] #remi--todo-----
+ if endtangent:
+ #print 'deb:polyline2dCurve.draw curve[-1].vec:', curve[-1].vec #-----
+ #print 'deb:polyline2dCurve.draw endtangent:', endtangent #-----
+ p0h1,p0,p0h2 = curve[-1].vec
+ p0h2 = [p0h2[i]+endtangent[i] for i in range(3)]
+ #print 'deb:drawPlineCurve: p0h2:', p0h2 #----------
+ curve.__setitem__(-1,BezTriple.New(p0h1+p0+p0h2))
+ #print 'deb:polyline2dCurve.draw curve[-1].vec:', curve[-1].vec #-----
+ curve[-1].handleTypes = [ALIGN, FREE] #remi--todo-----
+
+
+
+ else: #-- only straight line- and arc-segments----OK------
#print 'deb:polyline2dCurve.draw curve:', curve #-----
points = []
arc_res = settings.var['curve_arc']
@@ -1403,8 +1562,10 @@ class Polyline: #--------------------------------------------------------------
#print 'deb:drawPoly2d len of d_pointsList ====== ', len(d_points) #------------------------
#print 'deb:drawPoly2d d_pointsList ======:\n ', d_points #------------------------
+ d_points = self.doubles_out(settings, d_points)
+ #print 'deb:drawPolyCurve d_pointsList =after DV-outsorting=====:\n ', d_points #------------------------
- # routine to sort out of "double.vertices" ------------------------------------
+ """# routine to sort out of "double.vertices" ------------------------------------
minimal_dist = settings.var['dist_min'] * 0.1
temp_points = []
for i in xrange(len(d_points)-1):
@@ -1419,6 +1580,7 @@ class Polyline: #--------------------------------------------------------------
#if self.closed: temp_points.append(d_points[1]) #------ loop start vertex -------------
d_points = temp_points #-----vertex.list without "double.vertices"
#print 'deb:drawPoly2d d_pointsList =after DV-outsorting=====:\n ', d_points #------------------------
+ """
#print 'deb:drawPoly2d len of d_pointsList ====== ', len(d_points) #------------------------
if len(d_points) < 2: #if too few vertex, then return
@@ -1836,12 +1998,16 @@ class Vertex(object): #--------------------------------------------------------
self.swidth = None #0
self.ewidth = None #0
self.bulge = 0
+ self.tangent = False
+ self.weight = 1.0
if obj is not None:
if not obj.type == 'vertex':
raise TypeError, "Wrong type %s for vertex object!" %obj.type
self.type = obj.type
- self.data = obj.data[:]
- self.get_props(obj.data)
+# self.data = obj.data[:]
+ self.get_props(obj)
+ else:
+ pass
#print 'deb:Vertex.init.END:----------------' #------------------------
@@ -1862,18 +2028,22 @@ class Vertex(object): #--------------------------------------------------------
self.flags = getit(data, 70, 0) # flags
self.curved = self.flags&1 # Bezier-curve-fit:additional-vertex
- self.curv_t = self.flags&2 # Bezier-curve-fit:tangent exists
- self.spline = self.flags&8 # Bspline-fit:additional-vertex
- self.splin2 = self.flags&16 # Bspline-fit:control-vertex
+ self.curved_t = self.flags&2 # Bezier-curve-fit:tangent exists
+ self.spline = self.flags&8 # NURBSpline-fit:additional-vertex
+ self.spline_c = self.flags&16 # NURBSpline-fit:control-vertex
self.poly3d = self.flags&32 # polyline3d:control-vertex
self.plmesh = self.flags&64 # polymesh3d:control-vertex
self.plface = self.flags&128 # polyface
# if PolyFace.Vertex with Face_definition
- if self.curv_t:
- self.curv_tangent = getit(data, 50, None) # curve_tangent
-
- if self.plface and not self.plmesh:
+ if self.curved_t:
+ self.curve_tangent = getit(data, 50, None) # curve_tangent
+ if not self.curve_tangent==None:
+ self.tangent = True
+ #elif self.spline_c: # NURBSpline:control-vertex
+ # self.weight = getit(data, 41, 1.0) # weight od control point
+
+ elif self.plface and not self.plmesh:
v1 = getit(data, 71, 0) # polyface:Face.vertex 1.
v2 = getit(data, 72, 0) # polyface:Face.vertex 2.
v3 = getit(data, 73, 0) # polyface:Face.vertex 3.
@@ -1938,8 +2108,7 @@ class Vertex(object): #--------------------------------------------------------
class Spline(Polyline): #-----------------------------------------------------------------
"""Class for objects representing dxf SPLINEs.
"""
- def __init__(self, obj):
- """Expects an entity object of type spline as input.
+ """Expects an entity object of type spline as input.
100 - Subclass marker (AcDbSpline)
210,220, 230 - Normal vector (omitted if the spline is nonplanar) X,Y,Z values of normal vector
70 - Spline flag (bit coded):
@@ -1963,12 +2132,13 @@ class Spline(Polyline): #------------------------------------------------------
DXF: X value; APP: 3D point, Y and Z values of control points (in WCS) (one entry per control point)
11,21, 31 - Fit points (in WCS) one entry per fit point.
X,Y,Z values of fit points (in WCS) (one entry per fit point)
- """
+ """
+ def __init__(self, obj):
#print 'deb:Spline.START:----------------' #------------------------
if not obj.type == 'spline':
raise TypeError, "Wrong type %s for spline object!" %obj.type
self.type = obj.type
- self.data = obj.data[:]
+# self.data = obj.data[:]
# required data
self.num_points = obj.get_type(73)[0]
@@ -1992,30 +2162,42 @@ DXF: X value; APP: 3D point, Y and Z values of control points (in WCS) (one entr
self.planar = self.flags & 8 # Planar
self.linear = self.flags & 16 # Linear (and Planar)
- self.degree = getit(obj, 71, 0) # Degree of the spline curve
- self.curvNormal = False
- self.curvQBspline = False
- self.curvCBspline = False
+ self.curvNoFitted = False
+ self.curvQuadrati = False
+ self.curvCubicBsp = False
self.curvBezier = False
- if self.degree == 0: self.curvNormal = True
- elif self.degree == 1: self.curvQBspline = True
- elif self.degree == 2: self.curvCBspline = True
+ self.degree = getit(obj, 71, 0) # Degree of the spline curve
+ if self.degree == 0: self.curvNoFitted = True
+ elif self.degree == 1: self.curvQuadrati = True
+ elif self.degree == 2: self.curvCubicBsp = True
#elif self.degree == 3: self.curvBezier = True
- elif self.degree == 3: self.spline = True
+ #elif self.degree == 3: self.spline = True
- self.num_knots = getit(obj, 72, 0) # Number of knots
- self.num_contr = getit(obj, 73, 0) # Number of control points
- self.num_fitpk = getit(obj, 74, 0) # Number of fit points (if any)
+ self.knotpk_len = getit(obj, 72, 0) # Number of knots
+ self.ctrlpk_len = getit(obj, 73, 0) # Number of control points
+ self.fit_pk_len = getit(obj, 74, 0) # Number of fit points (if any)
+
+ #print 'deb:Spline self.fit_pk_len=', self.fit_pk_len #------------------------
+ #self.fit_pk_len = 0 # temp for debug
+ if self.fit_pk_len and 'spline_as'==5:
+ self.spline = False
+ self.curved = True
+ else:
+ self.spline = True
+ self.curved = False
- self.layer = getit(obj.data, 8, None)
- self.extrusion = get_extrusion(obj.data)
+ self.knotpk_tol = getit(obj, 42, 0.0000001) # Knot tolerance (default = 0.0000001)
+ self.ctrlpk_tol = getit(obj, 43, 0.0000001) # Control-point tolerance (default = 0.0000001)
+ self.fit_pk_tol = getit(obj, 44, 0.0000000001) # Fit tolerance (default = 0.0000000001)
- self.points = self.get_points(obj.data)
+ self.layer = getit(obj, 8, None)
+ self.extrusion = get_extrusion(obj)
- if self.planar: self.pltype = 'poly2d'
- else: self.pltype = 'poly3d'
- self.curved = False
- #self.curved = False
+ self.pltype = 'spline' # spline is a 2D- or 3D-polyline
+
+ self.points = self.get_points(obj.data)
+ #self.knots_val = self.get_knots_val(obj.data) # 40 - Knot value (one entry per knot)
+ #self.knots_wgh = self.get_knots_wgh(obj.data) # 41 - Weight (default 1)
#print 'deb:Spline obj.data:\n', obj.data #------------------------
#print 'deb:Spline self.points:\n', self.points #------------------------
@@ -2032,61 +2214,70 @@ DXF: X value; APP: 3D point, Y and Z values of control points (in WCS) (one entr
20:yvalue
for each vert
"""
- num = self.num_contr
point = None
points = []
+ pointend = None
#point = Vertex()
- for item in data:
- #print 'deb:Spline item:', item #------------------------
- if item[0] == 10: # control point
- if point: points.append(point)
- point = Vertex()
- point.curved = True
- point.x = item[1]
- elif item[0] == 20: # 20 = y
- point.y = item[1]
- elif item[0] == 30: # 30 = z
- point.z = item[1]
-
- elif item[0] == 11: # fit point
- if point: points.append(point)
- point = Vertex()
- point.curved = True
- point.x = item[1]
- elif item[0] == 21: # 20 = y
- point.y = item[1]
- elif item[0] == 31: # 30 = z
- point.z = item[1]
-
- elif item[0] == 12: # start tangent
- if point: points.append(point)
- point = Vertex()
- point.curved = True
- point.x = item[1]
- elif item[0] == 22: # = y
- point.y = item[1]
- elif item[0] == 32: # = z
- point.z = item[1]
-
- elif item[0] == 13: # end tangent
- if point: points.append(point)
- point = Vertex()
- point.curved = True
- point.x = item[1]
- elif item[0] == 23: # 20 = y
- point.y = item[1]
- elif item[0] == 33: # 30 = z
- point.z = item[1]
+ if self.spline: # NURBSpline definition
+ for item in data:
+ #print 'deb:Spline.get_points spilne_item:', item #------------------------
+ if item[0] == 10: # control point
+ if point: points.append(point)
+ point = Vertex()
+ point.curved = True
+ point.x = item[1]
+ elif item[0] == 20: # 20 = y
+ point.y = item[1]
+ elif item[0] == 30: # 30 = z
+ point.z = item[1]
+ elif item[0] == 41: # 41 = weight
+ point.weight = item[1]
+ #print 'deb:Spline.get_points control point:', point #------------------------
+
+ elif self.curved: # Bezier definition
+ for item in data:
+ #print 'deb:Spline.get_points curved_item:', item #------------------------
+ if item[0] == 11: # fit point
+ if point: points.append(point)
+ point = Vertex()
+ point.tangent = False
+ point.x = item[1]
+ elif item[0] == 21: # 20 = y
+ point.y = item[1]
+ elif item[0] == 31: # 30 = z
+ point.z = item[1]
+ #print 'deb:Spline.get_points fit point:', point #------------------------
+
+ elif item[0] == 12: # start tangent
+ if point: points.append(point)
+ point = Vertex()
+ point.tangent = True
+ point.x = item[1]
+ elif item[0] == 22: # = y
+ point.y = item[1]
+ elif item[0] == 32: # = z
+ point.z = item[1]
+ #print 'deb:Spline.get_points fit begtangent:', point #------------------------
+
+ elif item[0] == 13: # end tangent
+ if point: points.append(point)
+ pointend = Vertex()
+ pointend.tangent = True
+ pointend.x = item[1]
+ elif item[0] == 23: # 20 = y
+ pointend.y = item[1]
+ elif item[0] == 33: # 30 = z
+ pointend.z = item[1]
+ #print 'deb:Spline.get_points fit endtangent:', pointend #------------------------
points.append(point)
+ if self.curved and pointend:
+ points.append(pointend)
#print 'deb:Spline points:\n', points #------------------------
return points
-
-
def __repr__(self):
return "%s: layer - %s, points - %s" %(self.__class__.__name__, self.layer, self.points)
-
class LWpolyline(Polyline): #-------------------------------------------------------------
@@ -2099,7 +2290,7 @@ class LWpolyline(Polyline): #--------------------------------------------------
if not obj.type == 'lwpolyline':
raise TypeError, "Wrong type %s for polyline object!" %obj.type
self.type = obj.type
- self.data = obj.data[:]
+# self.data = obj.data[:]
# required data
self.num_points = obj.get_type(90)[0]
@@ -2118,8 +2309,8 @@ class LWpolyline(Polyline): #--------------------------------------------------
self.flags = getit(obj, 70, 0)
self.closed = self.flags&1 # byte coded, 1 = closed, 128 = plinegen
- self.layer = getit(obj.data, 8, None)
- self.extrusion = get_extrusion(obj.data)
+ self.layer = getit(obj, 8, None)
+ self.extrusion = get_extrusion(obj)
self.points = self.get_points(obj.data)
@@ -2167,72 +2358,10 @@ class LWpolyline(Polyline): #--------------------------------------------------
return points
-
def __repr__(self):
return "%s: layer - %s, points - %s" %(self.__class__.__name__, self.layer, self.points)
- def draw_old(self, settings):
- """for LWPOLYLINE: generate Blender_geometry.
- """
- #print 'deb:LWpolyline.draw.START:----------------' #------------------------
- points = []
- obname = 'lw_%s' %self.layer # create object name from layer name
- obname = obname[:MAX_NAMELENGTH]
- #settings.var['curves_on'] == True
- #print 'deb:index_len: ', len(self.points) #------------------
- for i, point in enumerate(self.points):
- #print 'deb:index: ', i #------------------
- if not point.bulge:
- points.append(point.loc)
- elif point.bulge and not self.closed and i == len(self.points)-1:
- points.append(point.loc)
- elif point.bulge: #
- if i == len(self.points)-1:
- point2 = self.points[0]
- else:
- point2 = self.points[i+1]
- arc_res = settings.var['arc_res']/sqrt(settings.var['arc_rad'])
- verts, center = calcBulge(point, point2, arc_res)
-# if i == len(self.points)-1:
-# if self.closed:
-# verts.pop() #remove last(=first) vertex
-# else:
-# verts.pop() #remove last vertex, because this point will be writen as the next vertex
- points.extend(verts)
-
- thic = self.thic
- if settings.var['thick_force'] and thic == 0: thic = settings.var['thick_min']
- if settings.var['thick_on'] and thic != 0:
- len1 = len(points)
- points.extend([[point[0], point[1], point[2]+thic] for point in points])
- faces = []
- #print 'deb:len1:', len1 #-----------------------
- faces = [[num, num+1, num+len1+1, num+len1] for num in xrange(len1 - 1)]
- if self.closed:
- faces.append([len1-1, 0, len1, 2*len1-1])
- #print 'deb:faces_list:\n', faces #-----------------------
- me = Mesh.New(obname) # create a new mesh
- ob = SCENE.objects.new(me) # create a new mesh_object
- me.verts.extend(points) # add vertices to mesh
- me.faces.extend(faces) # add faces to the mesh
- else:
- edges = [[num, num+1] for num in xrange(len(points)-1)]
- if self.closed:
- edges.append([len(points)-1, 0])
- #print 'deb:edges_list:\n', edges #-----------------------
- me = Mesh.New(obname) # create a new mesh
- ob = SCENE.objects.new(me) # create a new mesh_object
- me.verts.extend(points) # add vertices to mesh
- me.edges.extend(edges) # add edges to the mesh
-
- ob.LocZ = self.elevation
- transform(self.extrusion, 0, ob)
-
- #print 'deb:LWpolyline.draw.END:----------------' #------------------------
- return ob
-
-
class Text: #-----------------------------------------------------------------
"""Class for objects representing dxf TEXT.
"""
@@ -2242,7 +2371,7 @@ class Text: #-----------------------------------------------------------------
if not obj.type == 'text':
raise TypeError, "Wrong type %s for text object!" %obj.type
self.type = obj.type
- self.data = obj.data[:]
+# self.data = obj.data[:]
# required data
self.height = 1.7 * obj.get_type(40)[0] #text.height
@@ -2274,14 +2403,13 @@ class Text: #-----------------------------------------------------------------
#3=aligned, 4=middle, 5=fit
self.halignment = getit(obj, 72, 0)
- self.layer = getit(obj.data, 8, None)
- self.loc1, self.loc2 = self.get_loc(obj.data)
+ self.layer = getit(obj, 8, None)
+ self.loc1, self.loc2 = self.get_loc(obj)
if self.loc2[0] != None and self.halignment != 5:
self.loc = self.loc2
else:
self.loc = self.loc1
- self.extrusion = get_extrusion(obj.data)
-
+ self.extrusion = get_extrusion(obj)
def get_loc(self, data):
@@ -2390,13 +2518,13 @@ class Mtext: #-----------------------------------------------------------------
if not obj.type == 'mtext':
raise TypeError, "Wrong type %s for mtext object!" %obj.type
self.type = obj.type
- self.data = obj.data[:]
+# self.data = obj.data[:]
# required data
self.height = obj.get_type(40)[0]
self.width = obj.get_type(41)[0]
self.alignment = obj.get_type(71)[0] # alignment 1=TL, 2=TC, 3=TR, 4=ML, 5=MC, 6=MR, 7=BL, 8=BC, 9=BR
- self.value = self.get_text(obj.data) # The text string value
+ self.value = self.get_text(obj) # The text string value
# optional data (with defaults)
self.space = getit(obj, 67, 0)
@@ -2406,9 +2534,9 @@ class Mtext: #-----------------------------------------------------------------
self.width_factor = getit(obj, 42, 1) # Scaling factor along local x axis
self.line_space = getit(obj, 44, 1) # percentage of default
- self.layer = getit(obj.data, 8, None)
- self.loc = self.get_loc(obj.data)
- self.extrusion = get_extrusion(obj.data)
+ self.layer = getit(obj, 8, None)
+ self.loc = self.get_loc(obj)
+ self.extrusion = get_extrusion(obj)
def get_text(self, data):
@@ -2487,7 +2615,7 @@ class Circle: #----------------------------------------------------------------
if not obj.type == 'circle':
raise TypeError, "Wrong type %s for circle object!" %obj.type
self.type = obj.type
- self.data = obj.data[:]
+# self.data = obj.data[:]
# required data
self.radius = obj.get_type(40)[0]
@@ -2497,9 +2625,9 @@ class Circle: #----------------------------------------------------------------
self.thic = getit(obj, 39, 0)
self.color_index = getit(obj, 62, BYLAYER)
- self.layer = getit(obj.data, 8, None)
- self.loc = self.get_loc(obj.data)
- self.extrusion = get_extrusion(obj.data)
+ self.layer = getit(obj, 8, None)
+ self.loc = self.get_loc(obj)
+ self.extrusion = get_extrusion(obj)
@@ -2700,7 +2828,7 @@ class Arc: #-----------------------------------------------------------------
if not obj.type == 'arc':
raise TypeError, "Wrong type %s for arc object!" %obj.type
self.type = obj.type
- self.data = obj.data[:]
+# self.data = obj.data[:]
# required data
self.radius = obj.get_type(40)[0]
@@ -2712,9 +2840,9 @@ class Arc: #-----------------------------------------------------------------
self.thic = getit(obj, 39, 0)
self.color_index = getit(obj, 62, BYLAYER)
- self.layer = getit(obj.data, 8, None)
- self.loc = self.get_loc(obj.data)
- self.extrusion = get_extrusion(obj.data)
+ self.layer = getit(obj, 8, None)
+ self.loc = self.get_loc(obj)
+ self.extrusion = get_extrusion(obj)
#print 'deb:Arc__init__: center, radius, start, end:\n', self.loc, self.radius, self.start_angle, self.end_angle #---------
@@ -2898,7 +3026,7 @@ class BlockRecord: #-----------------------------------------------------------
if not obj.type == 'block_record':
raise TypeError, "Wrong type %s for block_record object!" %obj.type
self.type = obj.type
- self.data = obj.data[:]
+# self.data = obj.data[:]
# required data
self.name = getit(obj, 2, None)
@@ -2954,8 +3082,8 @@ class Block: #-----------------------------------------------------------------
self.entities = dxfObject('block_contents') #creates empty entities_container for this block
self.entities.data = objectify([ent for ent in obj.data if type(ent) != list])
- self.layer = getit(obj.data, 8, None)
- self.loc = self.get_loc(obj.data)
+ self.layer = getit(obj, 8, None)
+ self.loc = self.get_loc(obj)
#print 'deb:Block %s data:\n%s' %(self.name, self.data) #------------
#print 'deb:Block %s self.entities.data:\n%s' %(self.name, self.entities.data) #------------
@@ -2999,11 +3127,11 @@ class Insert: #----------------------------------------------------------------
self.space = getit(obj, 67, 0)
self.color_index = getit(obj, 62, BYLAYER)
- self.layer = getit(obj.data, 8, None)
- self.loc = self.get_loc(obj.data)
- self.scale = self.get_scale(obj.data)
- self.rows, self.columns = self.get_array(obj.data)
- self.extrusion = get_extrusion(obj.data)
+ self.layer = getit(obj, 8, None)
+ self.loc = self.get_loc(obj)
+ self.scale = self.get_scale(obj)
+ self.rows, self.columns = self.get_array(obj)
+ self.extrusion = get_extrusion(obj)
#self.flags = getit(obj.data, 66, 0) #
#self.attrib = self.flags & 1
@@ -3205,7 +3333,7 @@ class Ellipse: #---------------------------------------------------------------
if not obj.type == 'ellipse':
raise TypeError, "Wrong type %s for ellipse object!" %obj.type
self.type = obj.type
- self.data = obj.data[:]
+# self.data = obj.data[:]
# required data
self.ratio = obj.get_type(40)[0] # Ratio of minor axis to major axis
@@ -3217,10 +3345,10 @@ class Ellipse: #---------------------------------------------------------------
self.thic = getit(obj, 39, 0.0)
self.color_index = getit(obj, 62, BYLAYER)
- self.layer = getit(obj.data, 8, None)
- self.loc = self.get_loc(obj.data)
- self.major = self.get_major(obj.data)
- self.extrusion = get_extrusion(obj.data)
+ self.layer = getit(obj, 8, None)
+ self.loc = self.get_loc(obj)
+ self.major = self.get_major(obj)
+ self.extrusion = get_extrusion(obj)
def get_loc(self, data):
@@ -3468,14 +3596,14 @@ class Face: #-----------------------------------------------------------------
if not obj.type == '3dface':
raise TypeError, "Wrong type %s for 3dface object!" %obj.type
self.type = obj.type
- self.data = obj.data[:]
+# self.data = obj.data[:]
# optional data (with defaults)
self.space = getit(obj, 67, 0)
self.color_index = getit(obj, 62, BYLAYER)
- self.layer = getit(obj.data, 8, None)
- self.points = self.get_points(obj.data)
+ self.layer = getit(obj, 8, None)
+ self.points = self.get_points(obj)
def get_points(self, data):
@@ -3582,11 +3710,11 @@ type_map = {
'point':Point,
'3dface':Face,
'line':Line,
-# 'mline':MLine,
+# 'mline':MLine,
'polyline':Polyline,
'lwpolyline':LWpolyline,
'spline':Spline,
-# 'region':Region,
+# 'region':Region,
'trace':Solid,
'solid':Solid,
'text':Text,
@@ -3623,12 +3751,12 @@ def objectify(data): #---------------------------------------------------------
if item.type == 'vertex':
#print 'deb:objectify gosub Vertex--------' #-------------
v = Vertex(item)
- if pline.spline: # if Bspline-curve
+ if pline.spline: # if NURBSpline-curve
# then for Blender-mesh filter only additional_vertices
# OR
# then for Blender-curve filter only spline_control_vertices
- if (v.spline and not curves_on) or (curves_on and v.splin2): #correct for real NURBS-import
- #if (v.spline and not curves_on) or (curves_on and not v.splin2): #fake for Bezier-emulation of NURBS-import
+ if (v.spline and not curves_on) or (curves_on and v.spline_c): #correct for real NURBS-import
+ #if (v.spline and not curves_on) or (curves_on and not v.spline_c): #fake for Bezier-emulation of NURBS-import
pline.points.append(v)
elif pline.curved: # if Bezier-curve
# then for Blender-mesh filter only curve_additional_vertices
@@ -3685,7 +3813,7 @@ class MatColors: #-------------------------------------------------------------
the material.
"""
- def __init__(self, layersmap):
+ def __init__(self):
"""Expects a map - a dictionary mapping layer names to layers.
"""
#self.layersmap = layersmap # a dictionary of layername:layerobject
@@ -3709,8 +3837,9 @@ class MatColors: #-------------------------------------------------------------
#layer = Layer(name=color, color=256, frozen=False)
#layersmap[color] = layer
#color = 0
- if layersmap: color = layersmap[color].color
- if color == 256: # color 0 = BYLAYER
+ if color in layersmap.keys():
+ color = layersmap[color].color
+ if color == 256: # color 256 = BYLAYER
#--todo-- should looking for color of LAYER
#if layersmap: color = layersmap[color].color
color = 3
@@ -3749,7 +3878,7 @@ class MatLayers: #-------------------------------------------------------------
the material.
"""
- def __init__(self, layersmap):
+ def __init__(self):
"""Expects a map - a dictionary mapping layer names to layers.
"""
#self.layersmap = layersmap # a dictionary of layername:layer
@@ -3896,6 +4025,11 @@ class Settings: #--------------------------------------------------------------
'0'
]
+ self.var['groupFilter_on'] = False #deb:remi------------
+ self.acceptedLayers = ['3',
+ '0'
+ ]
+
#self.var['blockFilter_on'] = 0 #deb:remi------------
self.acceptedBlocks = ['WALL_1871',
'BOX02'
@@ -3953,8 +4087,8 @@ class Settings: #--------------------------------------------------------------
if self.var['optimization'] == 0: self.var['one_mesh_on'] = 0
# The section:tables may be partialy or completely missing.
self.layersTable = False
- self.colMaterials = MatColors({}) #A container for dxf-color based materials
- self.layMaterials = MatLayers({}) #A container for dxf-layer based materials
+ self.colMaterials = MatColors() #A container for dxf-color based materials
+ self.layMaterials = MatLayers() #A container for dxf-layer based materials
#self.collayMaterials = MatColLayers({}) #A container for dxf-color+layer based materials
global layersmap, layernamesmap
layersmap, layernamesmap = {}, {}
@@ -3974,8 +4108,8 @@ class Settings: #--------------------------------------------------------------
if layers: #----------------------------------
# Read the layers table and get the layer colors
layersmap, layernamesmap = getLayersmap(layers)
- self.colMaterials = MatColors(layersmap)
- self.layMaterials = MatLayers(layersmap)
+ #self.colMaterials = MatColors()
+ #self.layMaterials = MatLayers()
else:
self.write("File contains no table:layers!")
@@ -4441,19 +4575,20 @@ def rotXY_Vec(rotation, vec): #------------------------------------------------
-def getLayersmap(layers): #------------------------------------------------------
+def getLayersmap(dxflayers): #------------------------------------------------------
"""Build two dictionaries: 1.layername:layer object, and 2.layername:layername_short
+ gets set of layers from TABLES SECTION LAYERS
"""
layersmap = {}
layernamesmap = {}
- for item in layers.data:
+ for item in dxflayers.data:
if type(item) != list and item.type == 'layer':
layersmap[item.name] = item
layername_short = item.name[:MAX_NAMELENGTH-1]
i = 0 #sufix for layernames cause Blender-objectnames-limits
while layername_short in layernamesmap.keys():
i += 1
- suffix = str(i)
+ suffix = str(i) #--todo--set zero-leading number format
layername_short = layername_short[:-2] + suffix
layernamesmap[item.name] = layername_short
@@ -4546,6 +4681,7 @@ def drawer(_type, entities, settings, block_def): #----------------------------
If 'block_def': the entities are to be added to the Blender 'group'.
"""
+ global layersmap, layersmapshort
#print 'deb:drawer _type, entities:\n ', _type, entities #-----------------------
if entities:
@@ -4579,6 +4715,21 @@ def drawer(_type, entities, settings, block_def): #----------------------------
#entities = [entity for entity in entities if entity.layer[0] in ['M','3','0'] and not entity.layer.endswith('H')]
entities = [entity for entity in entities if entity.layer in settings.acceptedLayers]
+ # patch for incomplete layer table in HL2-DXF-files
+ if layersmap:
+ for entity in entities:
+ oblayer = entity.layer
+ if oblayer not in layersmap.keys():
+ layer_obj = Layer(None, name=oblayer)
+ layersmap[oblayer] = layer_obj
+ layername_short = oblayer[:MAX_NAMELENGTH-1]
+ i = 0 #sufix for layernames cause Blender-objectnames-limits
+ while layername_short in layernamesmap.keys():
+ i += 1
+ suffix = str(i) #--todo--set zero-leading number format
+ layername_short = layername_short[:-2] + suffix
+ layernamesmap[oblayer] = layername_short
+
# filtering only objects on not-frozen layers
if layersmap and not settings.var['layFrozen_on']:
entities = [entity for entity in entities if not layersmap[entity.layer].frozen]
@@ -4785,7 +4936,7 @@ def setMaterial_from(entity, ob, settings, block_def): #-----------------------
mat = settings.colMaterials(entity.color_index)
elif settings.var['material_from'] == 2: # 2= material from layer_name
- mat = settings.layMaterials(layername = entity.layer)
+ mat = settings.layMaterials(layername=entity.layer)
elif settings.var['material_from'] == 3: # 3= material from layer+color
mat = settings.layMaterials(layername=entity.layer, color=entity.color_index)
@@ -5104,7 +5255,7 @@ EVENT_HELP = 9
EVENT_PRESETCURV = 10
EVENT_PRESETS = 11
EVENT_DXF_DIR = 12
-EVENT_DXF_NAME = 13
+# = 13
EVENT_LIST = 14
EVENT_ORIGIN = 15
EVENT_SCALE = 16
@@ -5119,12 +5270,12 @@ GUI_B = {} # GUI-buttons dictionary for drawingTypes
# settings default, initialize ------------------------
points_as_menu = "convert to: %t|empty %x1|mesh.vertex %x2|thin sphere %x3|thin box %x4|*curve.vertex %x5"
-lines_as_menu = "convert to: %t|*edge %x1|mesh %x2|*thin cylinder %x3|thin box %x4|curve %x5"
+lines_as_menu = "convert to: %t|*edge %x1|mesh %x2|*thin cylinder %x3|thin box %x4|Bezier-curve %x5|NURBS-curve %x6"
mlines_as_menu = "convert to: %t|*edge %x1|*mesh %x2|*thin cylinder %x3|*thin box %x|*curve %x5"
-plines_as_menu = "convert to: %t|*edge %x1|mesh %x2|*thin cylinder %x3|*thin box %x4|curve %x5"
-splines_as_menu = "convert to: %t|*edge %x1|mesh %x2|*thin cylinder %x3|*thin box %x4|curve %x5"
-plines3_as_menu = "convert to: %t|*edge %x1|mesh %x2|*thin cylinder %x3|*thin box %x4|curve %x5"
-plmesh_as_menu = "convert to: %t|*edge %x1|mesh %x2"
+plines_as_menu = "convert to: %t|*edge %x1|mesh %x2|*thin cylinder %x3|*thin box %x4|Bezier-curve %x5|NURBS-curve %x6"
+splines_as_menu = "convert to: %t|mesh %x2|*thin cylinder %x3|*thin box %x4|Bezier-curve %x5|NURBS-curve %x6"
+plines3_as_menu = "convert to: %t|*edge %x1|mesh %x2|*thin cylinder %x3|*thin box %x4|Bezier-curve %x5|NURBS-curve %x6"
+plmesh_as_menu = "convert to: %t|*edge %x1|mesh %x2|NURBS-surface %x6"
solids_as_menu = "convert to: %t|*edge %x1|mesh %x2"
blocks_as_menu = "convert to: %t|dupliGroup %x1|*real.Group %x2|*exploded %x3"
texts_as_menu = "convert to: %t|text %x1|*mesh %x2|*curve %x5"
@@ -5166,6 +5317,9 @@ keywords_org = {
'xref_on' : 1,
'block_nn': 0,
'blockFilter_on': 0,
+ 'layerFilter_on': 0,
+ 'colorFilter_on': 0,
+ 'groupFilter_on': 0,
'newScene_on' : 1,
'target_layer' : TARGET_LAYER,
'group_bylayer_on' : GROUP_BYLAYER,
@@ -5187,7 +5341,6 @@ keywords_org = {
'dist_force': 0,
'material_on': 1,
'material_from': 2,
- 'pl_3d' : 1,
'fill_on' : 1,
'meshSmooth_on': 1,
'curve_res' : CURV_RESOLUTION,
@@ -5197,6 +5350,8 @@ keywords_org = {
'thin_res' : THIN_RESOLUTION,
'pl_trim_max' : TRIM_LIMIT,
'pl_trim_on': 1,
+ 'plmesh_flip': 0,
+ 'normals_out': 0,
'paper_space_on': 0,
'layFrozen_on': 0,
'Z_force_on': 0,
@@ -5205,7 +5360,7 @@ keywords_org = {
'lines_as' : 2,
'mlines_as' : 2,
'plines_as' : 2,
- 'splines_as' : 2,
+ 'splines_as' : 5,
'plines3_as': 2,
'plmesh_as' : 2,
'solids_as' : 2,
@@ -5221,7 +5376,7 @@ drawTypes_org = {
'ellipse': 1,
'mline' : 0,
'polyline': 1,
- 'spline': 0,
+ 'spline': 1,
'plmesh': 1,
'pline3': 1,
'lwpolyline': 1,
@@ -5244,6 +5399,9 @@ for k, v in drawTypes_org.iteritems():
GUI_B[k] = Draw.Create(v)
#print 'deb:init GUI_A: ', GUI_A #---------------
#print 'deb:init GUI_B: ', GUI_B #---------------
+
+model_space_on = Draw.Create(1)
+
# initialize settings-object controls how dxf entities are drawn
settings = Settings(keywords_org, drawTypes_org)
@@ -5397,12 +5555,13 @@ def resetDefaultConfig(): #-----------------------------------------------
updateConfig(keywords_org, drawTypes_org)
-def presetConfig_curv(): #-----------------------------------------------
+def presetConfig_curv(activate): #-----------------------------------------------
"""Sets settings/config/materials for curve representation.
"""
global GUI_A
- if GUI_A['curves_on'].val == 1:
+ if activate:
+ GUI_A['curves_on'].val = 1
GUI_A['points_as'].val = 5
GUI_A['lines_as'].val = 5
GUI_A['mlines_as'].val = 5
@@ -5410,11 +5569,12 @@ def presetConfig_curv(): #-----------------------------------------------
GUI_A['splines_as'].val = 5
GUI_A['plines3_as'].val = 5
else:
+ GUI_A['curves_on'].val = 0
GUI_A['points_as'].val = 2
GUI_A['lines_as'].val = 2
GUI_A['mlines_as'].val = 2
GUI_A['plines_as'].val = 2
- GUI_A['splines_as'].val = 2
+ GUI_A['splines_as'].val = 6
GUI_A['plines3_as'].val = 2
@@ -5422,7 +5582,7 @@ def resetDefaultConfig_2D(): #-----------------------------------------------
"""Sets settings/config/materials to defaults 2D.
"""
-# presetConfig_curv()
+ presetConfig_curv(1)
keywords2d = {
'views_on' : 0,
'cams_on' : 0,
@@ -5434,7 +5594,6 @@ def resetDefaultConfig_2D(): #-----------------------------------------------
'width_force': 0,
'dist_on' : 1,
'dist_force': 0,
- 'pl_3d' : 0,
'fill_on' : 0,
'pl_trim_on': 1,
'Z_force_on': 0,
@@ -5452,9 +5611,9 @@ def resetDefaultConfig_2D(): #-----------------------------------------------
'ellipse': 1,
'mline' : 0,
'polyline': 1,
- 'spline': 0,
+ 'spline': 1,
'plmesh': 0,
- 'pline3': 0,
+ 'pline3': 1,
'lwpolyline': 1,
'text' : 1,
'mtext' : 0,
@@ -5472,8 +5631,11 @@ def resetDefaultConfig_3D(): #-----------------------------------------------
"""Sets settings/config/materials to defaults 3D.
"""
-# presetConfig_curv()
+ presetConfig_curv(0)
keywords3d = {
+# 'views_on' : 1,
+# 'cams_on' : 1,
+# 'lights_on' : 1,
'vGroup_on' : 1,
'thick_on' : 1,
'thick_force': 0,
@@ -5481,7 +5643,6 @@ def resetDefaultConfig_3D(): #-----------------------------------------------
'width_force': 0,
'dist_on' : 1,
'dist_force': 0,
- 'pl_3d' : 0,
'fill_on' : 1,
'pl_trim_on': 1,
'Z_force_on': 0,
@@ -5499,11 +5660,11 @@ def resetDefaultConfig_3D(): #-----------------------------------------------
'ellipse': 1,
'mline' : 0,
'polyline': 1,
- 'spline': 0,
+ 'spline': 1,
'plmesh': 1,
'pline3': 1,
'lwpolyline': 1,
- 'text' : 1,
+ 'text' : 0,
'mtext' : 0,
'block' : 1,
'insert': 1,
@@ -5557,6 +5718,7 @@ def draw_UI(): #---------------------------------------------------------------
"""
global GUI_A, GUI_B #__version__
global user_preset, iniFileName, dxfFileName, config_UI, g_scale_as
+ global model_space_on
# This is for easy layout changes
but_0c = 70 #button 1.column width
@@ -5567,8 +5729,8 @@ def draw_UI(): #---------------------------------------------------------------
butt_margin = 10
menu_w = (3 * butt_margin) + but_0c + but_1c + but_2c + but_3c #menu width
- simple_menu_h = 80
- extend_menu_h = 370
+ simple_menu_h = 100
+ extend_menu_h = 350
y = simple_menu_h # y is menu upper.y
if config_UI.val: y += extend_menu_h
x = 20 #menu left.x
@@ -5584,7 +5746,7 @@ def draw_UI(): #---------------------------------------------------------------
y += 30
colorbox(x, y+20, x+menu_w+menu_margin*2, menu_margin)
- Draw.Label("DXF-Importer ver." + __version__, but0c, y, menu_w, 20)
+ Draw.Label("DXF-Importer v" + __version__, but0c, y, menu_w, 20)
if config_UI.val:
b0, b0_ = but0c, but_0c + butt_margin
@@ -5645,25 +5807,23 @@ def draw_UI(): #---------------------------------------------------------------
y -= 10
y -= 20
Draw.BeginAlign()
- GUI_B['plmesh'] = Draw.Toggle('POLY-MESH/FACE', EVENT_NONE, b0, y, b0_+b1_, 20, GUI_B['plmesh'].val, "support dxf-POLYMESH/POLYFACE on/off")
+ GUI_B['plmesh'] = Draw.Toggle('PL-MESH/FACE', EVENT_NONE, b0, y, b0_+b1_-40, 20, GUI_B['plmesh'].val, "support dxf-POLYMESH/POLYFACE on/off")
# GUI_A['plmesh_as'] = Draw.Menu(plmesh_as_menu, EVENT_NONE, but1c, y, but_1c, 20, GUI_A['plmesh_as'].val, "select target Blender-object")
+ GUI_A['plmesh_flip'] = Draw.Toggle('N', EVENT_NONE, b1+b1_-40, y, 20, 20, GUI_A['plmesh_flip'].val, "flip DXF normals on/off")
+ GUI_A['normals_out'] = Draw.Toggle('N', EVENT_NONE, b1+b1_-20, y, 20, 20, GUI_A['normals_out'].val, "force Blender normals to outside on/off")
Draw.EndAlign()
y -= 20
- Draw.BeginAlign()
GUI_B['solid'] = Draw.Toggle('SOLID', EVENT_NONE, b0, y, b0_, 20, GUI_B['solid'].val, "support dxf-SOLID and TRACE on/off")
GUI_B['face'] = Draw.Toggle('3DFACE', EVENT_NONE, b1, y, b1_, 20, GUI_B['face'].val, "support dxf-3DFACE on/off")
# GUI_A['solids_as'] = Draw.Menu(solids_as_menu, EVENT_NONE, but3c, y, but_3c, 20, GUI_A['solids_as'].val, "select target Blender-object")
- Draw.EndAlign()
#print 'deb:support solid, trace', GUI_B['trace'].val, GUI_B['solid'].val # ------------
y -= 20
- Draw.BeginAlign()
GUI_B['text'] = Draw.Toggle('TEXT', EVENT_NONE, b0, y, b0_, 20, GUI_B['text'].val, "support dxf-TEXT on/off")
GUI_B['mtext'] = Draw.Toggle('*MTEXT', EVENT_NONE, b1, y, b1_, 20, GUI_B['mtext'].val, "(*wip)support dxf-MTEXT on/off")
# GUI_A['texts_as'] = Draw.Menu(texts_as_menu, EVENT_NONE, but3c, y, but_3c, 20, GUI_A['texts_as'].val, "select target Blender-object")
- Draw.EndAlign()
y -= 20
Draw.BeginAlign()
@@ -5671,13 +5831,14 @@ def draw_UI(): #---------------------------------------------------------------
GUI_B['insert'].val = GUI_B['block'].val
if GUI_B['block'].val:
GUI_A['block_nn'] = Draw.Toggle('n', EVENT_NONE, b1-30, y, 15, 20, GUI_A['block_nn'].val, "support hatch/noname BLOCKs *X... on/off")
- GUI_A['blockFilter_on'] = Draw.Toggle('F', EVENT_NONE, b1-15, y, 15, 20, GUI_A['blockFilter_on'].val, "(*wip) support name filtering of BLOCKs on/off")
- GUI_A['xref_on'] = Draw.Toggle('Xref', EVENT_NONE, b1, y, 20, 20, GUI_A['xref_on'].val, "support place holder for XREF-BLOCKs on/off")
+ GUI_A['xref_on'] = Draw.Toggle('Xref', EVENT_NONE, b1-15, y, 35, 20, GUI_A['xref_on'].val, "support for XREF-BLOCKs (place holders) on/off")
GUI_A['blocks_as'] = Draw.Menu(blocks_as_menu, EVENT_NONE, b1+20, y, b1_-20, 20, GUI_A['blocks_as'].val, "select target representation for imported BLOCKs")
Draw.EndAlign()
y -= 20
+ y -= 20
+
Draw.BeginAlign()
GUI_A['views_on'] = Draw.Toggle('views', EVENT_NONE, b0, y, b0_-25, 20, GUI_A['views_on'].val, "imports VIEWs and VIEWPORTs as cameras on/off")
GUI_A['cams_on'] = Draw.Toggle('*cams', EVENT_NONE, b1-25, y, b1_-25, 20, GUI_A['cams_on'].val, "(*wip) support ASHADE cameras on/off")
@@ -5688,19 +5849,28 @@ def draw_UI(): #---------------------------------------------------------------
if y < y_down: y_down = y
# -----end supported objects--------------------------------------
- b0, b0_ = but0c, but_0c + butt_margin
- b1, b1_ = but1c, but_1c
-
y_top = y_down
y = y_top
y -= 10
y -= 20
+ but_ = menu_w / 6
+ b0 = but0c + (menu_w - but_*6)/2
Draw.BeginAlign()
- GUI_A['material_on'] = Draw.Toggle('material', EVENT_REDRAW, b0, y, b0_-20, 20, GUI_A['material_on'].val, "support for material assignment on/off")
- if GUI_A['material_on'].val:
- GUI_A['material_from'] = Draw.Menu(material_from_menu, EVENT_NONE, b1-20, y, b1_+20, 20, GUI_A['material_from'].val, "material assignment from?")
+ GUI_A['paper_space_on'] = Draw.Toggle('paper', EVENT_NONE, b0+but_*0, y, but_, 20, GUI_A['paper_space_on'].val, "import only from Paper-Space on/off")
+ GUI_A['layFrozen_on'] = Draw.Toggle ('frozen', EVENT_NONE, b0+but_*1, y, but_, 20, GUI_A['layFrozen_on'].val, "import also from frozen LAYERs on/off")
+ GUI_A['layerFilter_on'] = Draw.Toggle('layer', EVENT_NONE, b0+but_*2, y, but_, 20, GUI_A['layerFilter_on'].val, "(*wip) LAYER filtering on/off")
+ GUI_A['colorFilter_on'] = Draw.Toggle('color', EVENT_NONE, b0+but_*3, y, but_, 20, GUI_A['colorFilter_on'].val, "(*wip) COLOR filtering on/off")
+ GUI_A['groupFilter_on'] = Draw.Toggle('group', EVENT_NONE, b0+but_*4, y, but_, 20, GUI_A['groupFilter_on'].val, "(*wip) GROUP filtering on/off")
+ GUI_A['blockFilter_on'] = Draw.Toggle('block', EVENT_NONE, b0+but_*5, y, but_, 20, GUI_A['blockFilter_on'].val, "(*wip) BLOCK filtering on/off")
+ #GUI_A['dummy_on'] = Draw.Toggle('-', EVENT_NONE, but3c, y, but_3c, 20, GUI_A['dummy_on'].val, "dummy on/off")
Draw.EndAlign()
+ # -----end filters--------------------------------------
+
+ b0, b0_ = but0c, but_0c + butt_margin
+ b1, b1_ = but1c, but_1c
+
+ y -= 10
y -= 20
Draw.BeginAlign()
GUI_A['g_origin_on'] = Draw.Toggle('glob.reLoc', EVENT_REDRAW, b0, y, b0_, 20, GUI_A['g_origin_on'].val, "global relocate all DXF objects on/off")
@@ -5750,9 +5920,9 @@ def draw_UI(): #---------------------------------------------------------------
y -= 10
y -= 20
Draw.BeginAlign()
- GUI_A['meshSmooth_on'] = Draw.Toggle('smooth', EVENT_NONE, b0, y, b0_-20, 20, GUI_A['meshSmooth_on'].val, "mesh smooth for circles/arcsegments on/off")
- GUI_A['pl_trim_on'] = Draw.Toggle('trim', EVENT_NONE, b1-20, y, 32, 20, GUI_A['pl_trim_on'].val, "intersection of POLYLINE-wide-segments on/off")
- GUI_A['pl_trim_max'] = Draw.Number('', EVENT_NONE, b1+12, y, b1_-12, 20, GUI_A['pl_trim_max'].val, 0, 5, "limit for intersection of POLYLINE-wide-segments: 0.0-5.0")
+ GUI_A['meshSmooth_on'] = Draw.Toggle('smooth', EVENT_NONE, b0, y, b0_-20, 20, GUI_A['meshSmooth_on'].val, "mesh smooth for circles/arc-segments on/off")
+ GUI_A['pl_trim_on'] = Draw.Toggle('trim', EVENT_NONE, b1-20, y, 32, 20, GUI_A['pl_trim_on'].val, "clean intersection of POLYLINE-wide-segments on/off")
+ GUI_A['pl_trim_max'] = Draw.Number('', EVENT_NONE, b1+12, y, b1_-12, 20, GUI_A['pl_trim_max'].val, 0, 5, "threshold intersection of POLYLINE-wide-segments: 0.0-5.0")
Draw.EndAlign()
y -= 20
@@ -5765,21 +5935,21 @@ def draw_UI(): #---------------------------------------------------------------
y -= 20
Draw.BeginAlign()
- GUI_A['curves_on'] = Draw.Toggle('to Curves', EVENT_PRESETCURV, b0, y, b0_, 20, GUI_A['curves_on'].val, "import into curves instead into meshes on/off")
- GUI_A['curve_arc'] = Draw.Number('', EVENT_NONE, b1, y, b1_/2, 20, GUI_A['curve_arc'].val, 3, 32, "Bezier circle: amount of segments: 3-32")
- GUI_A['curve_res'] = Draw.Number('', EVENT_NONE, b1+b1_/2, y, b1_/2, 20, GUI_A['curve_res'].val, 1, 128, "Set the Curve's U-resolution value: 1-128")
+ GUI_A['curve_arc'] = Draw.Number('', EVENT_NONE, b0, y, b0_/2, 20, GUI_A['curve_arc'].val, 3, 32, "Bezier circle: amount of segments: 3-32")
+ GUI_A['curve_res'] = Draw.Number('', EVENT_NONE, b0+b0_/2, y, b0_/2, 20, GUI_A['curve_res'].val, 1, 128, "Set the Curve's U-resolution value: 1-128")
+ GUI_A['curves_on'] = Draw.Toggle('to Curves', EVENT_PRESETCURV, b1, y, b1_, 20, GUI_A['curves_on'].val, "set Curve as target object type on/off")
Draw.EndAlign()
y -= 20
- GUI_A['group_bylayer_on'] = Draw.Toggle('Lay', EVENT_NONE, b0, y, 30, 20, GUI_A['group_bylayer_on'].val, "grouping entities from the same layer on/off")
- GUI_A['vGroup_on'] = Draw.Toggle('vGroups', EVENT_NONE, b0+30, y, b1_-10, 20, GUI_A['vGroup_on'].val, "support Blender-VertexGroups on/off")
+ GUI_A['group_bylayer_on'] = Draw.Toggle('Layer', EVENT_NONE, b0, y, 30, 20, GUI_A['group_bylayer_on'].val, "DXF-entities group by layer on/off")
+ GUI_A['vGroup_on'] = Draw.Toggle('vGroups', EVENT_NONE, b0+30, y, b1_-10, 20, GUI_A['vGroup_on'].val, "sort faces into VertexGroups on/off")
GUI_A['one_mesh_on'] = Draw.Toggle('oneMesh', EVENT_NONE, b1+10, y, b1_-10, 20, GUI_A['one_mesh_on'].val, "draw DXF-entities into one mesh-object. Recommended for big DXF-files. on/off")
y -= 30
Draw.BeginAlign()
- GUI_A['paper_space_on'] = Draw.Toggle('paper space', EVENT_NONE, b0, y, b0_+20, 20, GUI_A['paper_space_on'].val, "import only layout (paper space) on/off")
- GUI_A['layFrozen_on'] = Draw.Toggle('frozen', EVENT_NONE, b1+20, y, b1_-20, 20, GUI_A['layFrozen_on'].val, "import also from frozen layers on/off")
- #GUI_A['dummy_on'] = Draw.Toggle('-', EVENT_NONE, but3c, y, but_3c, 20, GUI_A['dummy_on'].val, "dummy on/off")
+ GUI_A['material_on'] = Draw.Toggle('material', EVENT_REDRAW, b0, y, b0_-20, 20, GUI_A['material_on'].val, "support for material assignment on/off")
+ if GUI_A['material_on'].val:
+ GUI_A['material_from'] = Draw.Menu(material_from_menu, EVENT_NONE, b1-20, y, b1_+20, 20, GUI_A['material_from'].val, "material assignment from?")
Draw.EndAlign()
y_down = y
@@ -5821,8 +5991,9 @@ def draw_UI(): #---------------------------------------------------------------
Draw.EndAlign()
y -= 30
- GUI_A['newScene_on'] = Draw.Toggle('newScene', EVENT_NONE, b0, y, b0_, 20, GUI_A['newScene_on'].val, "creates new Blender-Scene for each import on/off")
- GUI_A['target_layer'] = Draw.Number('layer', EVENT_NONE, b1, y, b1_, 20, GUI_A['target_layer'].val, 1, 18, "imports into this Blender-layer (<19> reserved for block_definitions)")
+ but, but_ = but2c, 25
+ Draw.BeginAlign()
+ Draw.EndAlign()
if y < y_down: y_down = y
# -----end options --------------------------------------
@@ -5835,45 +6006,60 @@ def draw_UI(): #---------------------------------------------------------------
y -= 30
Draw.BeginAlign()
Draw.PushButton('INI file >', EVENT_CHOOSE_INI, but0c, y, but_0c, 20, 'Select INI-file from project directory')
- iniFileName = Draw.String(' :', EVENT_NONE, but1c, y, menu_w-but_0c-butt_margin, 20, iniFileName.val, FILENAME_MAX, "write here the name of the INI-file")
+ iniFileName = Draw.String(' :', EVENT_NONE, but1c, y, menu_w-but_1c-60, 20, iniFileName.val, FILENAME_MAX, "write here the name of the INI-file")
+ but = but4c-60
+ Draw.PushButton('#', EVENT_PRESETS, but, y, 20, 20, "toggle Preset-INI-files")
+ Draw.PushButton('L', EVENT_LOAD_INI, but+20, y, 20, 20, 'Loads configuration from ini-file: %s' % iniFileName.val)
+ Draw.PushButton('S', EVENT_SAVE_INI, but+40, y, 20, 20, 'Saves configuration to ini-file: %s' % iniFileName.val)
Draw.EndAlign()
- y -= 20
- Draw.BeginAlign()
- Draw.PushButton('#', EVENT_PRESETS, but0c, y, 20, 20, "tipist for Preset-INI-files")
- Draw.PushButton('Load', EVENT_LOAD_INI, but0c+20, y, but_0c-20, 20, '.Loads configuration from ini-file: %s' % iniFileName.val)
- Draw.PushButton('Save', EVENT_SAVE_INI, but1c, y, but_1c-20, 20, 'Saves configuration to ini-file: %s' % iniFileName.val)
- Draw.EndAlign()
- but_ = (but_2c+but_3c)/4
- but = but2c
- Draw.PushButton('reset', EVENT_RESET, but, y, but_, 20, "reset configuration to defaults")
- Draw.PushButton('2D', EVENT_PRESET2D, but+but_, y, but_, 20, 'set configuration for 2D import')
- Draw.PushButton('3D', EVENT_PRESET3D, but+but_*2, y, but_, 20, 'set configuration for 3D import')
- GUI_A['optimization'] = Draw.Number('', EVENT_NONE, but4c-35, y, 35, 20, GUI_A['optimization'].val, 0, 3, "Optimization Level: 0=Debug/directDrawing, 1=Verbose, 2=ProgressBar, 3=silentMode/fastest")
+ b0, b0_ = but2c, but_2c + butt_margin
+ b1, b1_ = but3c, but_3c
y = simple_menu_h
+ bm = butt_margin/2
+
+ #y -= 10
Draw.BeginAlign()
Draw.PushButton('DXFfile >', EVENT_CHOOSE_DXF, but0c, y, but_0c, 20, 'Select DXF-file from project directory')
dxfFileName = Draw.String(' :', EVENT_NONE, but1c, y, but_1c+but_2c+but_3c-20, 20, dxfFileName.val, FILENAME_MAX, "type the name of DXF-file or type *.dxf for multi-import")
- Draw.PushButton('*.*', EVENT_DXF_DIR, but3c+but_3c-20, y, 20, 20, 'Set asterisk * as filter')
+ Draw.PushButton('*.*', EVENT_DXF_DIR, but3c+but_3c-20, y, 20, 20, 'import all dxf files from this directory')
Draw.EndAlign()
+ y -= 30
+ config_UI = Draw.Toggle('CONFIG', EVENT_REDRAW, but0c, y, but_0c+bm, 20, config_UI.val, 'Advanced configuration on/off' )
+ Draw.BeginAlign()
+ but, but_ = but1c, but_1c+bm
+ but_ /= 3
+ Draw.PushButton('X', EVENT_RESET, but, y, 15, 20, "reset configuration to defaults")
+ Draw.PushButton('2D', EVENT_PRESET2D, but+but_, y, but_, 20, 'set configuration for 2D import')
+ Draw.PushButton('3D', EVENT_PRESET3D, but+(but_*2), y, but_, 20, 'set configuration for 3D import')
+ Draw.EndAlign()
- y -= 50
Draw.BeginAlign()
- Draw.PushButton('EXIT', EVENT_EXIT, but0c, y, but_0c, 40, '' )
- Draw.PushButton('HELP', EVENT_HELP, but1c, y, but_1c-20, 20, 'calls BlenderWiki for Manual, Updates and Support.')
- Draw.PushButton('?', EVENT_LIST, but1c+but_1c-20, y, 20, 20, 'DXF analyze tool: print listing of LAYERs and BLOCKs into the text file .INF')
- Draw.PushButton('START IMPORT', EVENT_START, but2c, y, but_2c+but_3c+butt_margin, 40, 'Start the import procedure')
+ GUI_A['newScene_on'] = Draw.Toggle('newScene', EVENT_NONE, but2c, y, but_2c, 20, GUI_A['newScene_on'].val, "create new Scene for each imported dxf file on/off")
+ GUI_A['target_layer'] = Draw.Number('layer', EVENT_NONE, but3c, y, but_3c, 20, GUI_A['target_layer'].val, 1, 18, "target Blender-layer (<19> reserved for block_definitions)")
Draw.EndAlign()
- config_UI = Draw.Toggle('CONFIG', EVENT_REDRAW, but1c-butt_margin/2, y+20, but_1c+butt_margin, 20, config_UI.val, 'Advanced configuration on/off' )
+ y -= 40
+ Draw.PushButton('EXIT', EVENT_EXIT, but0c, y, but_0c+bm, 20, '' )
+ Draw.PushButton('HELP', EVENT_HELP, but1c, y, but_1c+bm, 20, 'calls DXF-Importer Manual Page on Wiki.Blender.org')
+ Draw.BeginAlign()
+ GUI_A['optimization'] = Draw.Number('', EVENT_NONE, but2c, y+20, 40, 20, GUI_A['optimization'].val, 0, 3, "Optimization Level: 0=Debug/directDrawing, 1=Verbose, 2=ProgressBar, 3=SilentMode")
+ Draw.EndAlign()
+ Draw.BeginAlign()
+ Draw.PushButton('TEST', EVENT_LIST, but2c, y, 40, 20, 'DXF-Analyze-Tool: reads data from selected dxf file and writes report in project_directory/dxf_blendname.INF')
+ Draw.PushButton('START IMPORT', EVENT_START, but2c+40, y, but_2c-40+but_3c+butt_margin, 40, 'Start the import process. For Cancel go to console and hit Ctrl-C')
+ Draw.EndAlign()
+
+
+
y -= 20
Draw.BeginAlign()
Draw.Label(' ', but0c-menu_margin, y, menu_margin, 20)
- Draw.Label("*) parts under construction", but0c, y, menu_w, 20)
+ Draw.Label(LAB, but0c, y, menu_w, 20)
Draw.Label(' ', but0c+menu_w, y, menu_margin, 20)
Draw.EndAlign()
@@ -5930,7 +6116,7 @@ def bevent(evt):
resetDefaultConfig_3D()
Draw.Redraw()
elif (evt==EVENT_PRESETCURV):
- presetConfig_curv()
+ presetConfig_curv(GUI_A['curves_on'].val)
Draw.Redraw()
elif (evt==EVENT_PRESETS):
user_preset += 1
@@ -5974,11 +6160,6 @@ http://wiki.blender.org/index.php?title=Scripts/Manual/Import/DXF-3D')
# update_RegistryKey('dxfFileName', dxfFileName.val)
GUI_A['newScene_on'].val = 1
Draw.Redraw()
-# elif (evt==EVENT_DXF_NAME):
-# dirname == Blender.sys.dirname(Blender.Get('filename'))
-# update_RegistryKey('DirName', dirname)
-# #print 'deb:EVENT_DXF_NAME dxfFileName.val:', dxfFileName.val #--------------
-# update_RegistryKey('dxfFileName', dxfFileName.val)
elif (evt==EVENT_CHOOSE_DXF):
filename = '' # '*.dxf'
if dxfFileName.val: filename = dxfFileName.val
@@ -5986,6 +6167,7 @@ http://wiki.blender.org/index.php?title=Scripts/Manual/Import/DXF-3D')
elif (evt==EVENT_START):
dxfFile = dxfFileName.val
#print 'deb: dxfFile file: ', dxfFile #----------------------
+ if E_M: dxfFileName.val, dxfFile = e_mode(dxfFile) #evaluation mode
update_RegistryKey('dxfFileName', dxfFileName.val)
if dxfFile.lower().endswith('*.dxf'):
if Draw.PupMenu('DXF importer: OK?|will import all DXF-files from:|%s' % dxfFile) == 1:
diff --git a/release/scripts/weightpaint_clean.py b/release/scripts/weightpaint_clean.py
index ba1896f011e..ca2184bade4 100644
--- a/release/scripts/weightpaint_clean.py
+++ b/release/scripts/weightpaint_clean.py
@@ -25,7 +25,7 @@ It removes very low weighted verts from the current group with a weight option.
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -51,13 +51,14 @@ def weightClean(me, PREF_THRESH, PREF_KEEP_SINGLE, PREF_OTHER_GROUPS):
for wd in vWeightDict:
l = len(wd)
if not PREF_KEEP_SINGLE or l > 1:
+ # cant use iteritems because the dict is having items removed
for group in wd.keys():
w= wd[group]
if w <= PREF_THRESH:
# small weight, remove.
del wd[group]
rem_count +=1
- l-=1
+ l-=1
if PREF_KEEP_SINGLE and l == 1:
break
@@ -117,4 +118,4 @@ def main():
Draw.PupMenu('Removed %i verts from groups' % rem_count)
if __name__=='__main__':
- main() \ No newline at end of file
+ main()
diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h
index fade0f8cbaa..c162a04e055 100644
--- a/source/blender/blenkernel/BKE_texture.h
+++ b/source/blender/blenkernel/BKE_texture.h
@@ -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
diff --git a/source/blender/blenkernel/bad_level_call_stubs/stubs.c b/source/blender/blenkernel/bad_level_call_stubs/stubs.c
index 3ad11a61de3..561d8d7c2a6 100644
--- a/source/blender/blenkernel/bad_level_call_stubs/stubs.c
+++ b/source/blender/blenkernel/bad_level_call_stubs/stubs.c
@@ -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){}
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 5b3cec25772..cfcab54058d 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -1291,116 +1291,6 @@ int cloth_collision_moving ( ClothModifierData *clmd, CollisionModifierData *col
return 1;
}
-int cloth_do_selfcollisions(ClothModifierData * clmd)
-{
- int ret2 = 0, l;
- Cloth *cloth = clmd->clothObject;
-
- if ( clmd->clothObject->bvhselftree )
- {
- for(l = 0; l < clmd->coll_parms->self_loop_count; l++)
- {
- BVHTreeOverlap *overlap = NULL;
- ClothVertex *verts = clmd->clothObject->verts; // needed for openMP
- int k;
- int ret = 0, result = 0;
-
- // search for overlapping collision pairs
- overlap = BLI_bvhtree_overlap ( cloth->bvhselftree, cloth->bvhselftree, &result );
-
-// #pragma omp parallel for private(k, i, j) schedule(static)
- for ( k = 0; k < result; k++ )
- {
- float temp[3];
- float length = 0;
- float mindistance;
- int i, j;
-
- i = overlap[k].indexA;
- j = overlap[k].indexB;
-
- mindistance = clmd->coll_parms->selfepsilon* ( cloth->verts[i].avg_spring_len + cloth->verts[j].avg_spring_len );
-
- if ( clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL )
- {
- if ( ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED )
- && ( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED ) )
- {
- continue;
- }
- }
-
- VECSUB ( temp, verts[i].tx, verts[j].tx );
-
- if ( ( ABS ( temp[0] ) > mindistance ) || ( ABS ( temp[1] ) > mindistance ) || ( ABS ( temp[2] ) > mindistance ) ) continue;
-
- // check for adjacent points (i must be smaller j)
- if ( BLI_edgehash_haskey ( cloth->edgehash, MIN2(i, j), MAX2(i, j) ) )
- {
- continue;
- }
-
- length = Normalize ( temp );
-
- if ( length < mindistance )
- {
- float correction = mindistance - length;
-
- if ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED )
- {
- VecMulf ( temp, -correction );
- VECADD ( verts[j].tx, verts[j].tx, temp );
- }
- else if ( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED )
- {
- VecMulf ( temp, correction );
- VECADD ( verts[i].tx, verts[i].tx, temp );
- }
- else
- {
- VecMulf ( temp, -correction*0.5 );
- VECADD ( verts[j].tx, verts[j].tx, temp );
-
- VECSUB ( verts[i].tx, verts[i].tx, temp );
- }
- ret = 1;
- ret2 += ret;
- }
- else
- {
- // check for approximated time collisions
- }
- }
-
- if ( overlap )
- MEM_freeN ( overlap );
-
- if(!ret)
- break;
-
- }
- ////////////////////////////////////////////////////////////
-
- ////////////////////////////////////////////////////////////
- // SELFCOLLISIONS: update velocities
- ////////////////////////////////////////////////////////////
- if ( ret2 )
- {
- int i;
- ClothVertex *verts = clmd->clothObject->verts; // needed for openMP
-
- for ( i = 0; i < cloth->numverts; i++ )
- {
- if ( ! ( verts [i].flags & CLOTH_VERT_FLAG_PINNED ) )
- {
- VECSUB ( verts[i].tv, verts[i].tx, verts[i].txold );
- }
- }
- }
- ////////////////////////////////////////////////////////////
- }
- return ret2;
-}
// return all collision objects in scene
// collision object will exclude self
@@ -1547,7 +1437,7 @@ int cloth_bvh_objcollision ( Object *ob, ClothModifierData * clmd, float step, f
{
Cloth *cloth=NULL;
BVHTree *cloth_bvh=NULL;
- int i=0, numfaces = 0, numverts = 0;
+ int i=0, numfaces = 0, numverts = 0, k, l, j;
int rounds = 0; // result counts applied collisions; ic is for debug output;
ClothVertex *verts = NULL;
int ret = 0, ret2 = 0;
@@ -1647,21 +1537,122 @@ int cloth_bvh_objcollision ( Object *ob, ClothModifierData * clmd, float step, f
VECADD ( verts[i].tx, verts[i].txold, verts[i].tv );
}
////////////////////////////////////////////////////////////
-
+
////////////////////////////////////////////////////////////
// Test on *simple* selfcollisions
////////////////////////////////////////////////////////////
if ( clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_SELF )
{
- ret2 += cloth_do_selfcollisions(clmd);
+ for(l = 0; l < clmd->coll_parms->self_loop_count; l++)
+ {
+ // TODO: add coll quality rounds again
+ BVHTreeOverlap *overlap = NULL;
+ int result = 0;
+
+ // collisions = 1;
+ verts = cloth->verts; // needed for openMP
+
+ numfaces = clmd->clothObject->numfaces;
+ numverts = clmd->clothObject->numverts;
+
+ verts = cloth->verts;
+
+ if ( cloth->bvhselftree )
+ {
+ // search for overlapping collision pairs
+ overlap = BLI_bvhtree_overlap ( cloth->bvhselftree, cloth->bvhselftree, &result );
+
+ // #pragma omp parallel for private(k, i, j) schedule(static)
+ for ( k = 0; k < result; k++ )
+ {
+ float temp[3];
+ float length = 0;
+ float mindistance;
+
+ i = overlap[k].indexA;
+ j = overlap[k].indexB;
+
+ mindistance = clmd->coll_parms->selfepsilon* ( cloth->verts[i].avg_spring_len + cloth->verts[j].avg_spring_len );
+
+ if ( clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL )
+ {
+ if ( ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED )
+ && ( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED ) )
+ {
+ continue;
+ }
+ }
+
+ VECSUB ( temp, verts[i].tx, verts[j].tx );
+
+ if ( ( ABS ( temp[0] ) > mindistance ) || ( ABS ( temp[1] ) > mindistance ) || ( ABS ( temp[2] ) > mindistance ) ) continue;
+
+ // check for adjacent points (i must be smaller j)
+ if ( BLI_edgehash_haskey ( cloth->edgehash, MIN2(i, j), MAX2(i, j) ) )
+ {
+ continue;
+ }
+
+ length = Normalize ( temp );
+
+ if ( length < mindistance )
+ {
+ float correction = mindistance - length;
+
+ if ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED )
+ {
+ VecMulf ( temp, -correction );
+ VECADD ( verts[j].tx, verts[j].tx, temp );
+ }
+ else if ( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED )
+ {
+ VecMulf ( temp, correction );
+ VECADD ( verts[i].tx, verts[i].tx, temp );
+ }
+ else
+ {
+ VecMulf ( temp, -correction*0.5 );
+ VECADD ( verts[j].tx, verts[j].tx, temp );
+
+ VECSUB ( verts[i].tx, verts[i].tx, temp );
+ }
+ ret = 1;
+ ret2 += ret;
+ }
+ else
+ {
+ // check for approximated time collisions
+ }
+ }
+
+ if ( overlap )
+ MEM_freeN ( overlap );
+
+ }
+ }
+ ////////////////////////////////////////////////////////////
+
+ ////////////////////////////////////////////////////////////
+ // SELFCOLLISIONS: update velocities
+ ////////////////////////////////////////////////////////////
+ if ( ret2 )
+ {
+ for ( i = 0; i < cloth->numverts; i++ )
+ {
+ if ( ! ( verts [i].flags & CLOTH_VERT_FLAG_PINNED ) )
+ {
+ VECSUB ( verts[i].tv, verts[i].tx, verts[i].txold );
+ }
+ }
+ }
+ ////////////////////////////////////////////////////////////
}
- ////////////////////////////////////////////////////////////
}
while ( ret2 && ( clmd->coll_parms->loop_count>rounds ) );
if(collobjs)
- + MEM_freeN(collobjs);
+ MEM_freeN(collobjs);
return MIN2 ( ret, 1 );
}
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 9012adb09b7..2c1f6bb84c1 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -265,14 +265,34 @@ static void layerSwap_tface(void *data, int *corner_indices)
{
MTFace *tf = data;
float uv[4][2];
+ const static short pin_flags[4] =
+ { TF_PIN1, TF_PIN2, TF_PIN3, TF_PIN4 };
+ const static char sel_flags[4] =
+ { TF_SEL1, TF_SEL2, TF_SEL3, TF_SEL4 };
+ short unwrap = tf->unwrap & ~(TF_PIN1 | TF_PIN2 | TF_PIN3 | TF_PIN4);
+ char flag = tf->flag & ~(TF_SEL1 | TF_SEL2 | TF_SEL3 | TF_SEL4);
int j;
for(j = 0; j < 4; ++j) {
- uv[j][0] = tf->uv[corner_indices[j]][0];
- uv[j][1] = tf->uv[corner_indices[j]][1];
+ int source_index = corner_indices[j];
+
+ uv[j][0] = tf->uv[source_index][0];
+ uv[j][1] = tf->uv[source_index][1];
+
+ // swap pinning flags around
+ if(tf->unwrap & pin_flags[source_index]) {
+ unwrap |= pin_flags[j];
+ }
+
+ // swap selection flags around
+ if(tf->flag & sel_flags[source_index]) {
+ flag |= sel_flags[j];
+ }
}
memcpy(tf->uv, uv, sizeof(tf->uv));
+ tf->unwrap = unwrap;
+ tf->flag = flag;
}
static void layerDefault_tface(void *data, int count)
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 89de5ee9e45..0eb01e823aa 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -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"
@@ -1133,8 +1134,18 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
mface[numFaces].v1 = vert_map[mface[numFaces].v1];
mface[numFaces].v2 = vert_map[mface[numFaces].v2];
mface[numFaces].v3 = vert_map[mface[numFaces].v3];
- if(mface[numFaces].v4)
+ if(mface[numFaces].v4) {
mface[numFaces].v4 = vert_map[mface[numFaces].v4];
+
+ test_index_face(&mface[numFaces], &result->faceData,
+ numFaces, 4);
+ }
+ else
+ {
+ test_index_face(&mface[numFaces], &result->faceData,
+ numFaces, 3);
+ }
+
origindex[numFaces] = ORIGINDEX_NONE;
numFaces++;
@@ -1224,8 +1235,17 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
mface[numFaces].v1 = vert_map[mface[numFaces].v1];
mface[numFaces].v2 = vert_map[mface[numFaces].v2];
mface[numFaces].v3 = vert_map[mface[numFaces].v3];
- if(mface[numFaces].v4)
+ if(mface[numFaces].v4) {
mface[numFaces].v4 = vert_map[mface[numFaces].v4];
+
+ test_index_face(&mface[numFaces], &result->faceData,
+ numFaces, 4);
+ }
+ else
+ {
+ test_index_face(&mface[numFaces], &result->faceData,
+ numFaces, 3);
+ }
origindex[numFaces] = ORIGINDEX_NONE;
numFaces++;
@@ -2983,6 +3003,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)
{
@@ -7479,6 +7513,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;
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 24a3d348ae7..643f90637ad 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3744,6 +3744,9 @@ int psys_get_particle_state(Object *ob, ParticleSystem *psys, int p, ParticleKey
/* TODO: pa_clump vgroup */
do_clump(state,key1,t,part->clumpfac,part->clumppow,1.0);
+
+ if(psys->lattice)
+ calc_latt_deform(state->co,1.0f);
}
else{
if (pa) { /* TODO PARTICLE - should this ever be NULL? - Campbell */
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index ad139220785..da1dcfa6c5b 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -845,3 +845,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;
+}
+
+/* ------------------------------------------------------------------------- */
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index fcac5df934e..ebc0fb70863 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -865,7 +865,7 @@ void BLI_bvhtree_balance(BVHTree *tree)
// create root node
BVHNode *node = tree->nodes[tree->totleaf] = &(tree->nodearray[tree->totleaf]);
tree->totbranch++;
-
+<
// refit root bvh node
refit_kdop_hull(tree, node, 0, tree->totleaf);
@@ -875,6 +875,7 @@ void BLI_bvhtree_balance(BVHTree *tree)
// verify_tree(tree);
}
*/
+
}
// overlap - is it possbile for 2 bv's to collide ?
diff --git a/source/blender/blenlib/intern/boxpack2d.c b/source/blender/blenlib/intern/boxpack2d.c
index acd53e5d516..db7bae8a91d 100644
--- a/source/blender/blenlib/intern/boxpack2d.c
+++ b/source/blender/blenlib/intern/boxpack2d.c
@@ -42,6 +42,8 @@
#define TRF 2
#define TLF 4
#define BRF 8
+#define CORNERFLAGS (BLF|TRF|TLF|BRF)
+
#define BL 0
#define TR 1
#define TL 2
@@ -159,7 +161,7 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height)
vert->blb = vert->brb = vert->tlb =\
vert->isect_cache[0] = vert->isect_cache[1] =\
vert->isect_cache[2] = vert->isect_cache[3] = NULL;
- vert->free = 15 &~ TRF;
+ vert->free = CORNERFLAGS &~ TRF;
vert->trb = box;
vert->index = i; i++;
box->v[BL] = vert; vert++;
@@ -167,7 +169,7 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height)
vert->trb= vert->brb = vert->tlb =\
vert->isect_cache[0] = vert->isect_cache[1] =\
vert->isect_cache[2] = vert->isect_cache[3] = NULL;
- vert->free = 15 &~ BLF;
+ vert->free = CORNERFLAGS &~ BLF;
vert->blb = box;
vert->index = i; i++;
box->v[TR] = vert; vert++;
@@ -175,7 +177,7 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height)
vert->trb = vert->blb = vert->tlb =\
vert->isect_cache[0] = vert->isect_cache[1] =\
vert->isect_cache[2] = vert->isect_cache[3] = NULL;
- vert->free = 15 &~ BRF;
+ vert->free = CORNERFLAGS &~ BRF;
vert->brb = box;
vert->index = i; i++;
box->v[TL] = vert; vert++;
@@ -183,7 +185,7 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height)
vert->trb = vert->blb = vert->brb =\
vert->isect_cache[0] = vert->isect_cache[1] =\
vert->isect_cache[2] = vert->isect_cache[3] = NULL;
- vert->free = 15 &~ TLF;
+ vert->free = CORNERFLAGS &~ TLF;
vert->tlb = box;
vert->index = i; i++;
box->v[BR] = vert; vert++;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 73abf362d12..3a70438dd13 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2275,7 +2275,7 @@ static int handle_append_runtime(int handle, char *exename, char **cause_r) {
unsigned char buf[1024];
int count, progfd= -1;
- if (!runtime) {
+ if (!BLI_exists(runtime)) {
cause= "Unable to find runtime";
goto cleanup;
}
diff --git a/source/blender/imbuf/intern/anim.c b/source/blender/imbuf/intern/anim.c
index 720f5b0f7c8..c0e84b73e47 100644
--- a/source/blender/imbuf/intern/anim.c
+++ b/source/blender/imbuf/intern/anim.c
@@ -612,6 +612,7 @@ static int startffmpeg(struct anim * anim) {
av_free(anim->pFrameRGB);
av_free(anim->pFrameDeinterlaced);
av_free(anim->pFrame);
+ anim->pCodecCtx = NULL;
return -1;
}
@@ -639,7 +640,19 @@ static int startffmpeg(struct anim * anim) {
PIX_FMT_BGR32,
SWS_FAST_BILINEAR | SWS_PRINT_INFO,
NULL, NULL, NULL);
-
+
+ if (!anim->img_convert_ctx) {
+ fprintf (stderr,
+ "Can't transform color space??? Bailing out...\n");
+ avcodec_close(anim->pCodecCtx);
+ av_close_input_file(anim->pFormatCtx);
+ av_free(anim->pFrameRGB);
+ av_free(anim->pFrameDeinterlaced);
+ av_free(anim->pFrame);
+ anim->pCodecCtx = NULL;
+ return -1;
+ }
+
return (0);
}
diff --git a/source/blender/include/BIF_editarmature.h b/source/blender/include/BIF_editarmature.h
index da98eb3d4f1..13c16749612 100644
--- a/source/blender/include/BIF_editarmature.h
+++ b/source/blender/include/BIF_editarmature.h
@@ -108,7 +108,8 @@ void mouse_armature(void);
void remake_editArmature(void);
void selectconnected_armature(void);
void selectconnected_posearmature(void);
-void select_bone_parent(void);
+void armature_select_hierarchy(short direction, short add_to_sel);
+
void setflag_armature(short mode);
void unique_editbone_name (struct ListBase *ebones, char *name);
@@ -143,6 +144,10 @@ void set_locks_armature_bones(short lock);
#define BONESEL_NOSEL 0x80000000 /* Indicates a negative number */
+/* used in bone_select_hierachy() */
+#define BONE_SELECT_PARENT 0
+#define BONE_SELECT_CHILD 1
+
#endif
diff --git a/source/blender/include/BIF_poseobject.h b/source/blender/include/BIF_poseobject.h
index 58c67ff102a..ab96f7ec03e 100644
--- a/source/blender/include/BIF_poseobject.h
+++ b/source/blender/include/BIF_poseobject.h
@@ -65,6 +65,8 @@ void pose_assign_to_posegroup(short active);
void pose_remove_from_posegroups(void);
void pgroup_operation_with_menu(void);
+void pose_select_hierarchy(short direction, short add_to_sel);
+
void pose_select_grouped(short nr);
void pose_select_grouped_menu(void);
diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c
index 7120e97a62f..69bff059356 100644
--- a/source/blender/python/BPY_interface.c
+++ b/source/blender/python/BPY_interface.c
@@ -160,11 +160,10 @@ ScriptError g_script_error;
* Function prototypes
***************************************************************************/
PyObject *RunPython( Text * text, PyObject * globaldict );
-char *GetName( Text * text );
PyObject *CreateGlobalDictionary( void );
void ReleaseGlobalDictionary( PyObject * dict );
void DoAllScriptsFromList( ListBase * list, short event );
-PyObject *importText( char *name );
+static PyObject *importText( char *name );
void init_ourImport( void );
void init_ourReload( void );
PyObject *blender_import( PyObject * self, PyObject * args );
@@ -651,7 +650,7 @@ int BPY_txt_do_python_Text( struct Text *text )
}
/* Create a new script structure and initialize it: */
- script = alloc_libblock( &G.main->script, ID_SCRIPT, GetName( text ) );
+ script = alloc_libblock( &G.main->script, ID_SCRIPT, text->id.name+2 );
if( !script ) {
printf( "couldn't allocate memory for Script struct!" );
@@ -662,8 +661,7 @@ int BPY_txt_do_python_Text( struct Text *text )
* an error after it will call BPY_Err_Handle below, but the text struct
* will have been deallocated already, so we need to copy its name here.
*/
- BLI_strncpy( textname, GetName( text ),
- strlen( GetName( text ) ) + 1 );
+ BLI_strncpy( textname, text->id.name+2, 21 );
script->id.us = 1;
script->flags = SCRIPT_RUNNING;
@@ -1106,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;
+ }
}
/*****************************************************************************
@@ -2724,8 +2720,7 @@ PyObject *RunPython( Text * text, PyObject * globaldict )
buf = txt_to_buf( text );
text->compiled =
- Py_CompileString( buf, GetName( text ),
- Py_file_input );
+ Py_CompileString( buf, text->id.name+2, Py_file_input );
MEM_freeN( buf );
@@ -2740,15 +2735,6 @@ PyObject *RunPython( Text * text, PyObject * globaldict )
}
/*****************************************************************************
-* Description: This function returns the value of the name field of the
-* given Text struct.
-*****************************************************************************/
-char *GetName( Text * text )
-{
- return ( text->id.name + 2 );
-}
-
-/*****************************************************************************
* Description: This function creates a new Python dictionary object.
*****************************************************************************/
PyObject *CreateGlobalDictionary( void )
@@ -2792,49 +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 ) {
- if( !strcmp( txtname, GetName( text ) ) )
+ for(text = G.main->text.first; text; text = text->id.next) {
+ if( !strcmp( txtname, text->id.name+2 ) )
break;
- text = text->id.next;
}
- if( !text ) {
- free( txtname );
+ if( !text )
return NULL;
- }
if( !text->compiled ) {
buf = txt_to_buf( text );
- text->compiled =
- Py_CompileString( buf, GetName( text ),
- Py_file_input );
+ text->compiled = Py_CompileString( buf, text->id.name+2, Py_file_input );
MEM_freeN( buf );
if( PyErr_Occurred( ) ) {
PyErr_Print( );
BPY_free_compiled_text( text );
- free( txtname );
return NULL;
}
}
- free( txtname );
return PyImport_ExecCodeModule( name, text->compiled );
}
@@ -2905,7 +2880,7 @@ static PyObject *reimportText( PyObject *module )
/* look up the text object */
text = ( Text * ) & ( G.main->text.first );
while( text ) {
- if( !strcmp( txtname, GetName( text ) ) )
+ if( !strcmp( txtname, text->id.name+2 ) )
break;
text = text->id.next;
}
@@ -2922,8 +2897,7 @@ static PyObject *reimportText( PyObject *module )
/* compile the buffer */
buf = txt_to_buf( text );
- text->compiled = Py_CompileString( buf, GetName( text ),
- Py_file_input );
+ text->compiled = Py_CompileString( buf, text->id.name+2, Py_file_input );
MEM_freeN( buf );
/* if compile failed.... return this error */
diff --git a/source/blender/python/api2_2x/Blender.c b/source/blender/python/api2_2x/Blender.c
index 420d292cdce..2b190a6c828 100644
--- a/source/blender/python/api2_2x/Blender.c
+++ b/source/blender/python/api2_2x/Blender.c
@@ -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());
diff --git a/source/blender/python/api2_2x/Constraint.c b/source/blender/python/api2_2x/Constraint.c
index 8db6a49465e..a62a5ee7ed8 100644
--- a/source/blender/python/api2_2x/Constraint.c
+++ b/source/blender/python/api2_2x/Constraint.c
@@ -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;
diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c
index c36213950b0..ccd24a437b5 100644
--- a/source/blender/python/api2_2x/Material.c
+++ b/source/blender/python/api2_2x/Material.c
@@ -131,11 +131,11 @@
#define EXPP_MAT_RAYMIRRGLOSS_MIN 0.0
#define EXPP_MAT_RAYMIRRGLOSS_MAX 1.0
#define EXPP_MAT_RAYMIRRGLOSSSAMPLES_MIN 0
-#define EXPP_MAT_RAYMIRRGLOSSSAMPLES_MAX 255
+#define EXPP_MAT_RAYMIRRGLOSSSAMPLES_MAX 1024
#define EXPP_MAT_RAYTRANSPGLOSS_MIN 0.0
#define EXPP_MAT_RAYTRANSPGLOSS_MAX 1.0
#define EXPP_MAT_RAYTRANSPGLOSSSAMPLES_MIN 0
-#define EXPP_MAT_RAYTRANSPGLOSSSAMPLES_MAX 255
+#define EXPP_MAT_RAYTRANSPGLOSSSAMPLES_MAX 1024
#define EXPP_MAT_FILTER_MIN 0.0
#define EXPP_MAT_FILTER_MAX 1.0
#define EXPP_MAT_TRANSLUCENCY_MIN 0.0
@@ -738,8 +738,10 @@ static PyMethodDef BPy_Material_methods[] = {
"() - Return fresnel power for refractions factor"},
{"getRayTransGloss", ( PyCFunction ) Material_getGlossTrans, METH_NOARGS,
"() - Return amount refraction glossiness"},
+ {"getRayTransGlossSamples", ( PyCFunction ) Material_getGlossTransSamples, METH_NOARGS,
+ "() - Return number of sampels for transparent glossiness"},
{"getRayMirrGlossSamples", ( PyCFunction ) Material_getGlossMirrSamples, METH_NOARGS,
- "() - Return amount mirror glossiness"},
+ "() - Return number of sampels for mirror glossiness"},
{"getFilter", ( PyCFunction ) Material_getFilter, METH_NOARGS,
"() - Return the amount of filtering when transparent raytrace is enabled"},
{"getTranslucency", ( PyCFunction ) Material_getTranslucency, METH_NOARGS,
@@ -847,8 +849,10 @@ static PyMethodDef BPy_Material_methods[] = {
"(f) - Set blend fac for mirror fresnel - [1.0, 5.0]"},
{"setRayTransGloss", ( PyCFunction ) Material_setGlossTrans, METH_VARARGS,
"(f) - Set amount refraction glossiness - [0.0, 1.0]"},
+ {"setRayTransGlossSamples", ( PyCFunction ) Material_setGlossTransSamples, METH_VARARGS,
+ "(i) - Set number transparent gloss samples - [1, 1024]"},
{"setRayMirrGlossSamples", ( PyCFunction ) Material_setGlossMirrSamples, METH_VARARGS,
- "(f) - Set amount mirror glossiness - [0.0, 1.0]"},
+ "(i) - Set number mirror gloss samples - [1, 1024]"},
{"setFilter", ( PyCFunction ) Matr_oldsetFilter, METH_VARARGS,
"(f) - Set the amount of filtering when transparent raytrace is enabled"},
{"setTranslucency", ( PyCFunction ) Matr_oldsetTranslucency, METH_VARARGS,
diff --git a/source/blender/python/api2_2x/Mathutils.c b/source/blender/python/api2_2x/Mathutils.c
index 85c56a61628..217e096060f 100644
--- a/source/blender/python/api2_2x/Mathutils.c
+++ b/source/blender/python/api2_2x/Mathutils.c
@@ -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----------------------------
diff --git a/source/blender/python/api2_2x/Mathutils.h b/source/blender/python/api2_2x/Mathutils.h
index dd9aae2abed..76d53cb6c4c 100644
--- a/source/blender/python/api2_2x/Mathutils.h
+++ b/source/blender/python/api2_2x/Mathutils.h
@@ -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);
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index faa7a68f754..e4a5ad67631 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -1865,9 +1865,17 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
num= cpa->num;
/* get orco */
- psys_particle_on_emitter(ob, psmd,
- (part->childtype == PART_CHILD_FACES)? PART_FROM_FACE: PART_FROM_PARTICLE,
- cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,co,nor,0,0,orco,0);
+ if(part->childtype == PART_CHILD_FACES) {
+ psys_particle_on_emitter(ob, psmd,
+ PART_FROM_FACE, cpa->num,DMCACHE_ISCHILD,
+ cpa->fuv,cpa->foffset,co,nor,0,0,orco,0);
+ }
+ else {
+ ParticleData *par = psys->particles + cpa->parent;
+ psys_particle_on_emitter(ob, psmd, part->from,
+ par->num,DMCACHE_ISCHILD,par->fuv,
+ par->foffset,co,nor,0,0,orco,0);
+ }
if(uvco){
if(part->from!=PART_FROM_PARTICLE && part->childtype==PART_CHILD_FACES){
diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c
index efa82e03d5f..524a18a9f3d 100644
--- a/source/blender/src/buttons_object.c
+++ b/source/blender/src/buttons_object.c
@@ -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);
diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c
index 3b0167d673c..fb6a7636e16 100644
--- a/source/blender/src/buttons_scene.c
+++ b/source/blender/src/buttons_scene.c
@@ -763,7 +763,16 @@ static void seq_panel_input()
}
if (last_seq->type == SEQ_IMAGE) {
- StripElem * se = give_stripelem(last_seq, CFRA);
+ int cfra = CFRA;
+ StripElem * se;
+
+ if(last_seq->startdisp >cfra) {
+ cfra = last_seq->startdisp;
+ } else if (last_seq->enddisp <= cfra) {
+ cfra = last_seq->enddisp - 1;
+ }
+
+ se = give_stripelem(last_seq, cfra);
if (se) {
uiDefBut(block, TEX,
diff --git a/source/blender/src/drawgpencil.c b/source/blender/src/drawgpencil.c
index 733310bfda7..ee28049e2c0 100644
--- a/source/blender/src/drawgpencil.c
+++ b/source/blender/src/drawgpencil.c
@@ -310,6 +310,8 @@ short draw_gpencil_panel (uiBlock *block, bGPdata *gpd, ScrArea *sa)
/* ************************************************** */
/* GREASE PENCIL DRAWING */
+/* ----- General Defines ------ */
+
/* flags for sflag */
enum {
GP_DRAWDATA_NOSTATUS = (1<<0), /* don't draw status info */
@@ -317,7 +319,9 @@ enum {
GP_DRAWDATA_ONLYV2D = (1<<2), /* only draw 'canvas' strokes */
};
-/* draw stroke in buffer */
+/* ----- Tool Buffer Drawing ------ */
+
+/* draw stroke defined in buffer (simple ogl lines/points for now, as dotted lines) */
static void gp_draw_stroke_buffer (tGPspoint *points, int totpoints, short thickness, short dflag, short sflag)
{
tGPspoint *pt;
@@ -377,115 +381,232 @@ static void gp_draw_stroke_buffer (tGPspoint *points, int totpoints, short thick
}
}
-/* draw a given stroke */
-static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness, short dflag, short sflag, short debug, int winx, int winy)
+/* ----- Existing Strokes Drawing (3D and Point) ------ */
+
+/* draw a given stroke - just a single dot (only one point) */
+static void gp_draw_stroke_point (bGPDspoint *points, short sflag, int winx, int winy)
+{
+ /* draw point */
+ if (sflag & GP_STROKE_3DSPACE) {
+ glBegin(GL_POINTS);
+ glVertex3f(points->x, points->y, points->z);
+ glEnd();
+ }
+ else if (sflag & GP_STROKE_2DSPACE) {
+ glBegin(GL_POINTS);
+ glVertex2f(points->x, points->y);
+ glEnd();
+ }
+ else {
+ const float x= (points->x / 1000 * winx);
+ const float y= (points->y / 1000 * winy);
+
+ glBegin(GL_POINTS);
+ glVertex2f(x, y);
+ glEnd();
+ }
+}
+
+/* draw a given stroke in 3d (i.e. in 3d-space), using simple ogl lines */
+static void gp_draw_stroke_3d (bGPDspoint *points, int totpoints, short thickness, short dflag, short sflag, short debug, int winx, int winy)
{
bGPDspoint *pt;
+ float oldpressure = 0.0f;
int i;
- /* error checking */
- if ((points == NULL) || (totpoints <= 0))
- return;
-
- /* check if stroke can be drawn */
- if ((dflag & GP_DRAWDATA_ONLY3D) && !(sflag & GP_STROKE_3DSPACE))
- return;
- if (!(dflag & GP_DRAWDATA_ONLY3D) && (sflag & GP_STROKE_3DSPACE))
- return;
- if ((dflag & GP_DRAWDATA_ONLYV2D) && !(sflag & GP_STROKE_2DSPACE))
- return;
- if (!(dflag & GP_DRAWDATA_ONLYV2D) && (sflag & GP_STROKE_2DSPACE))
- return;
-
- /* if drawing a single point, draw it larger */
- if (totpoints == 1) {
- /* draw point */
- if (sflag & GP_STROKE_3DSPACE) {
- glBegin(GL_POINTS);
- glVertex3f(points->x, points->y, points->z);
+ /* draw stroke curve */
+ glBegin(GL_LINE_STRIP);
+ for (i=0, pt=points; i < totpoints && pt; i++, pt++) {
+ if (fabs(pt->pressure - oldpressure) > 0.2f) {
glEnd();
- }
- else if (sflag & GP_STROKE_2DSPACE) {
- glBegin(GL_POINTS);
- glVertex2f(points->x, points->y);
- glEnd();
- }
- else {
- const float x= (points->x / 1000 * winx);
- const float y= (points->y / 1000 * winy);
+ glLineWidth(pt->pressure * thickness);
+ glBegin(GL_LINE_STRIP);
- glBegin(GL_POINTS);
- glVertex2f(x, y);
- glEnd();
+ glVertex3f(pt->x, pt->y, pt->z);
+
+ oldpressure = pt->pressure;
}
+ else
+ glVertex3f(pt->x, pt->y, pt->z);
}
- else {
- float oldpressure = 0.0f;
+ glEnd();
+
+ /* draw debug points of curve on top? */
+ if (debug) {
+ glBegin(GL_POINTS);
+ for (i=0, pt=points; i < totpoints && pt; i++, pt++)
+ glVertex3f(pt->x, pt->y, pt->z);
+ glEnd();
+ }
+}
+
+/* ----- Fancy 2D-Stroke Drawing ------ */
+
+/* draw a given stroke in 2d */
+static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness, short dflag, short sflag, short debug, int winx, int winy)
+{
+ /* if thickness is less than 3, 'smooth' opengl lines look better */
+ if ((thickness < 3) || (G.rt==0)) {
+ bGPDspoint *pt;
+ int i;
- /* draw stroke curve */
glBegin(GL_LINE_STRIP);
for (i=0, pt=points; i < totpoints && pt; i++, pt++) {
- float x, y, z;
-
- if (sflag & GP_STROKE_3DSPACE) {
- x= pt->x;
- y= pt->y;
- z= pt->z;
+ if (sflag & GP_STROKE_2DSPACE) {
+ glVertex2f(pt->x, pt->y);
+ }
+ else {
+ const float x= (pt->x / 1000 * winx);
+ const float y= (pt->y / 1000 * winy);
+
+ glVertex2f(x, y);
}
- else if (sflag & GP_STROKE_2DSPACE) {
- x= pt->x;
- y= pt->y;
- z= 0;
+ }
+ glEnd();
+ }
+ else { /* tesselation code: currently only enabled with rt != 0 */
+ bGPDspoint *pt1, *pt2;
+ float p0[2], p1[2], pm[2];
+ int i;
+
+ glShadeModel(GL_FLAT);
+ glBegin(GL_QUAD_STRIP);
+
+ for (i=0, pt1=points, pt2=points+1; i < (totpoints-1); i++, pt1++, pt2++) {
+ float s0[2], s1[2]; /* segment 'center' points */
+ float t0[2], t1[2]; /* tesselated coordinates */
+ float m1[2], m2[2]; /* gradient and normal */
+ float pthick, dist; /* thickness at segment point, and length of segment */
+ float sminorang; /* minor angle between strokes */
+
+ /* get x and y coordinates from points */
+ if (sflag & GP_STROKE_2DSPACE) {
+ s0[0]= pt1->x; s0[1]= pt1->y;
+ s1[0]= pt2->x; s1[1]= pt2->y;
}
else {
- x= (pt->x / 1000 * winx);
- y= (pt->y / 1000 * winy);
- z= 0;
+ s0[0]= (pt1->x / 1000 * winx);
+ s0[1]= (pt1->y / 1000 * winy);
+ s1[0]= (pt2->x / 1000 * winx);
+ s1[1]= (pt2->y / 1000 * winy);
+ }
+
+ /* calculate gradient and normal - 'angle'=(ny/nx) */
+ m1[1]= s1[1] - s0[1];
+ m1[0]= s1[0] - s0[0];
+ dist = Vec2Lenf(s0, s1);
+ m2[1]= -(m1[0]) / dist;
+ m2[0]= m1[1] / dist;
+
+ /* if the first segment, initialise the first segment using segment's normal */
+ if (i == 0) {
+ pthick= (pt1->pressure * thickness);
+
+ // TODO: also draw/do a round end-cap first
+
+ p0[0]= s0[0] - (pthick * m2[0]);
+ p0[1]= s0[1] - (pthick * m2[1]);
+ p1[0]= s1[0] + (pthick * m2[0]);
+ p1[1]= s1[1] + (pthick * m2[1]);
+
+ Vec2Copyf(pm, m1);
}
- if (fabs(pt->pressure - oldpressure) > 0.2f) {
- glEnd();
- glLineWidth(pt->pressure * thickness);
- glBegin(GL_LINE_STRIP);
+ /* if the minor angle between the current segment and the previous one is less than 90 degrees */
+ if (i)
+ sminorang= NormalizedVecAngle2_2D(pm, m1);
+ else
+ sminorang= 0.0f;
+
+ if ((IS_EQ(sminorang, 0)==0) && (abs(sminorang) < M_PI_2) )
+ {
+ float closep[2];
- if (sflag & GP_STROKE_3DSPACE)
- glVertex3f(x, y, z);
+ /* recalculate startpoint of segment, where the new start-line:
+ * - starts a new gl-quad-strip
+ * - uses the vert of old startpoint closer to our endpoint
+ * - distance between new startpoints = distance between old startpoints
+ * - new startpoints occur on same gradient as old segment does (has potential for some 'minor' overlap, but ok)
+ */
+
+ /* find the closer vertex, and distance between startpoints */
+ if (Vec2Lenf(p0, s1) > Vec2Lenf(p1, s1))
+ Vec2Copyf(closep, p1);
else
- glVertex2f(x, y);
+ Vec2Copyf(closep, p0);
+
+ /* determine which side this closer vertex should be on */
+ pthick= (pt1->pressure * thickness * 2);
+ if ( ((closep[0] - s0[0]) > 0) || ((closep[1] - s0[1]) > 0) ) {
+ /* assumes this is the 'second' point, (i.e. the 'plus' one), so the other is subtracting */
+ p0[0]= closep[0] - (pthick * pm[0]);
+ p0[1]= closep[1] - (pthick * pm[1]);
+ p1[0]= closep[0];
+ p1[1]= closep[1];
+ }
+ else if ( ((closep[0] - s0[0]) < 0) || ((closep[1] - s0[1]) < 0) ) {
+ /* assumes this is the 'first' point, (i.e. the 'minus' one), so the other is adding */
+ p0[0]= closep[0];
+ p0[1]= closep[1];
+ p1[0]= closep[0] + (pthick * pm[0]);
+ p1[1]= closep[1] + (pthick * pm[1]);
+ }
- oldpressure = pt->pressure;
+ /* reset gl-states! */
+ glEnd();
+ glBegin(GL_QUAD_STRIP);
}
- else {
- if (sflag & GP_STROKE_3DSPACE)
- glVertex3f(x, y, z);
- else
- glVertex2f(x, y);
+
+ /* do the end of this segment */
+ pthick= (pt2->pressure * thickness);
+ t0[0] = s1[0] - (pthick * m2[0]);
+ t0[1] = s1[1] - (pthick * m2[1]);
+ t1[0] = s1[0] + (pthick * m2[0]);
+ t1[1] = s1[1] + (pthick * m2[1]);
+
+ /* draw this segment */
+ glVertex2f(p0[0], p0[1]);
+ glVertex2f(p1[0], p1[1]);
+ glVertex2f(t0[0], t0[1]);
+ glVertex2f(t1[0], t1[1]);
+
+ // TODO: draw end cap if last segment
+ if (i == totpoints-2) {
+
}
+
+ /* store current points for next segment to use */
+ Vec2Copyf(p0, t0);
+ Vec2Copyf(p1, t1);
+ Vec2Copyf(pm, m1);
}
+
glEnd();
+ }
+
+ /* draw debug points of curve on top? (original stroke points) */
+ if (debug) {
+ bGPDspoint *pt;
+ int i;
- /* draw debug points of curve on top? */
- if (debug) {
- glBegin(GL_POINTS);
- for (i=0, pt=points; i < totpoints && pt; i++, pt++) {
- if (sflag & GP_STROKE_3DSPACE) {
- glVertex3f(pt->x, pt->y, pt->z);
- }
- else if (sflag & GP_STROKE_2DSPACE) {
- glVertex2f(pt->x, pt->y);
- }
- else {
- const float x= (pt->x / 1000 * winx);
- const float y= (pt->y / 1000 * winy);
-
- glVertex2f(x, y);
- }
+ glBegin(GL_POINTS);
+ for (i=0, pt=points; i < totpoints && pt; i++, pt++) {
+ if (sflag & GP_STROKE_2DSPACE) {
+ glVertex2f(pt->x, pt->y);
+ }
+ else {
+ const float x= (pt->x / 1000 * winx);
+ const float y= (pt->y / 1000 * winy);
+
+ glVertex2f(x, y);
}
- glEnd();
}
+ glEnd();
}
}
+/* ----- General Drawing ------ */
+
/* draw a set of strokes */
static void gp_draw_strokes (bGPDframe *gpf, int winx, int winy, int dflag, short debug,
short lthick, float color[4])
@@ -495,9 +616,26 @@ static void gp_draw_strokes (bGPDframe *gpf, int winx, int winy, int dflag, shor
/* set color first (may need to reset it again later too) */
glColor4f(color[0], color[1], color[2], color[3]);
- for (gps= gpf->strokes.first; gps; gps= gps->next) {
- /* just draw the stroke once */
- gp_draw_stroke(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, winx, winy);
+ for (gps= gpf->strokes.first; gps; gps= gps->next) {
+ /* check if stroke can be drawn */
+ if ((dflag & GP_DRAWDATA_ONLY3D) && !(gps->flag & GP_STROKE_3DSPACE))
+ continue;
+ if (!(dflag & GP_DRAWDATA_ONLY3D) && (gps->flag & GP_STROKE_3DSPACE))
+ continue;
+ if ((dflag & GP_DRAWDATA_ONLYV2D) && !(gps->flag & GP_STROKE_2DSPACE))
+ continue;
+ if (!(dflag & GP_DRAWDATA_ONLYV2D) && (gps->flag & GP_STROKE_2DSPACE))
+ continue;
+ if ((gps->points == 0) || (gps->totpoints < 1))
+ continue;
+
+ /* check which stroke-drawer to use */
+ if (gps->totpoints == 1)
+ gp_draw_stroke_point(gps->points, gps->flag, winx, winy);
+ else if (dflag & GP_DRAWDATA_ONLY3D)
+ gp_draw_stroke_3d(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, winx, winy);
+ else if (gps->totpoints > 1)
+ gp_draw_stroke(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, winx, winy);
}
}
@@ -656,7 +794,7 @@ static void gp_draw_data (bGPdata *gpd, int winx, int winy, int dflag)
glColor4f(0, 0, 0, 1);
}
-/* ----------- */
+/* ----- Grease Pencil Sketches Drawing API ------ */
/* draw grease-pencil sketches to specified 2d-view assuming that matrices are already set correctly
* Note: this gets called twice - first time with onlyv2d=1 to draw 'canvas' strokes, second time with onlyv2d=0 for screen-aligned strokes
diff --git a/source/blender/src/drawseq.c b/source/blender/src/drawseq.c
index cc431c73a2e..71a777c9056 100644
--- a/source/blender/src/drawseq.c
+++ b/source/blender/src/drawseq.c
@@ -98,7 +98,7 @@
int no_rightbox=0, no_leftbox= 0;
static void draw_seq_handle(Sequence *seq, SpaceSeq *sseq, float pixelx, short direction);
static void draw_seq_extensions(Sequence *seq, SpaceSeq *sseq);
-static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2);
+static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2, char *background_col);
static void draw_shadedstrip(Sequence *seq, char *col, float x1, float y1, float x2, float y2);
static void draw_seq_strip(struct Sequence *seq, struct ScrArea *sa, struct SpaceSeq *sseq, int outline_tint, float pixelx);
@@ -604,7 +604,7 @@ static void draw_seq_extensions(Sequence *seq, SpaceSeq *sseq)
}
/* draw info text on a sequence strip */
-static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2)
+static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2, char *background_col)
{
float v1[2], v2[2];
int len, size;
@@ -670,8 +670,13 @@ static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2)
mval[1]= 1;
areamouseco_to_ipoco(G.v2d, mval, &x1, &x2);
- if(seq->flag & SELECT) cpack(0xFFFFFF);
- else cpack(0);
+ if(seq->flag & SELECT){
+ cpack(0xFFFFFF);
+ }else if ((((int)background_col[0] + (int)background_col[1] + (int)background_col[2]) / 3) < 50){
+ cpack(0x505050); /* use lighter text colour for dark background */
+ }else{
+ cpack(0);
+ }
glRasterPos3f(x1, y1+SEQ_STRIP_OFSBOTTOM, 0.0);
BMF_DrawString(G.font, strp);
}
@@ -740,7 +745,7 @@ so wave file sample drawing precission is zoom adjusted
static void draw_seq_strip(Sequence *seq, ScrArea *sa, SpaceSeq *sseq, int outline_tint, float pixelx)
{
float x1, x2, y1, y2;
- char col[3], is_single_image;
+ char col[3], background_col[3], is_single_image;
/* we need to know if this is a single image/color or not for drawing */
is_single_image = (char)check_single_seq(seq);
@@ -755,13 +760,14 @@ static void draw_seq_strip(Sequence *seq, ScrArea *sa, SpaceSeq *sseq, int outli
/* get the correct color per strip type*/
- get_seq_color3ubv(seq, col);
+ //get_seq_color3ubv(seq, col);
+ get_seq_color3ubv(seq, background_col);
/* draw the main strip body */
if (is_single_image) /* single image */
- draw_shadedstrip(seq, col, seq_tx_get_final_left(seq, 0), y1, seq_tx_get_final_right(seq, 0), y2);
+ draw_shadedstrip(seq, background_col, seq_tx_get_final_left(seq, 0), y1, seq_tx_get_final_right(seq, 0), y2);
else /* normal operation */
- draw_shadedstrip(seq, col, x1, y1, x2, y2);
+ draw_shadedstrip(seq, background_col, x1, y1, x2, y2);
/* draw additional info and controls */
if (seq->type == SEQ_RAM_SOUND)
@@ -814,7 +820,7 @@ static void draw_seq_strip(Sequence *seq, ScrArea *sa, SpaceSeq *sseq, int outli
/* nice text here would require changing the view matrix for texture text */
if( (x2-x1) / pixelx > 32) {
- draw_seq_text(seq, x1, x2, y1, y2);
+ draw_seq_text(seq, x1, x2, y1, y2, background_col);
}
}
diff --git a/source/blender/src/editarmature.c b/source/blender/src/editarmature.c
index 3d0f26960d6..80c24f3a989 100644
--- a/source/blender/src/editarmature.c
+++ b/source/blender/src/editarmature.c
@@ -1033,87 +1033,6 @@ static void *get_nearest_bone (short findunsel)
return NULL;
}
-/* used by posemode and editmode */
-void select_bone_parent (void)
-{
- Object *ob;
- bArmature *arm;
-
- /* get data */
- if (G.obedit)
- ob= G.obedit;
- else if (OBACT)
- ob= OBACT;
- else
- return;
- arm= (bArmature *)ob->data;
-
- /* determine which mode armature is in */
- if ((!G.obedit) && (ob->flag & OB_POSEMODE)) {
- /* deal with pose channels */
- /* channels are sorted on dependency, so the loop below won't result in a flood-select */
- bPoseChannel *pchan=NULL;
-
- for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- /* check if bone in original selection */
- if (pchan->bone->flag & BONE_SELECTED) {
- bPoseChannel *chanpar= pchan->parent;
-
- /* check if any parent */
- if ((chanpar) && ((chanpar->bone->flag & BONE_SELECTED)==0)) {
- chanpar->bone->flag |= BONE_SELECTED;
- select_actionchannel_by_name (ob->action, pchan->name, 1);
- }
- }
- }
- }
- else if (G.obedit) {
- /* deal with editbones */
- EditBone *curbone, *parbone, *parpar;
-
- /* prevent floods */
- for (curbone= G.edbo.first; curbone; curbone= curbone->next)
- curbone->temp= NULL;
-
- for (curbone= G.edbo.first; curbone; curbone= curbone->next) {
- /* check if bone selected */
- if ((curbone->flag & BONE_SELECTED) && curbone->temp==NULL) {
- parbone= curbone->parent;
-
- /* check if any parent */
- if ((parbone) && ((parbone->flag & BONE_SELECTED)==0)) {
- /* select the parent bone */
- parbone->flag |= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
-
- /* check if parent has parent */
- parpar= parbone->parent;
-
- if ((parpar) && (parbone->flag & BONE_CONNECTED)) {
- parpar->flag |= BONE_TIPSEL;
- }
- /* tag this bone to not flood selection */
- parbone->temp= parbone;
- }
- }
- }
-
- /* to be sure... */
- for (curbone= G.edbo.first; curbone; curbone= curbone->next)
- curbone->temp= NULL;
-
- }
-
- /* undo + redraw pushes */
- countall(); // flushes selection!
-
- allqueue (REDRAWVIEW3D, 0);
- allqueue (REDRAWBUTSEDIT, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWOOPS, 0);
-
- BIF_undo_push("Select Parent");
-}
-
/* helper for setflag_sel_bone() */
static void bone_setflag (int *bone, int flag, short mode)
{
@@ -1139,6 +1058,89 @@ static void bone_setflag (int *bone, int flag, short mode)
}
}
+/* Get the first available child of an editbone */
+static EditBone *editbone_get_child(EditBone *pabone, short use_visibility)
+{
+ Object *ob;
+ bArmature *arm;
+ EditBone *curbone, *chbone=NULL;
+
+ if (!G.obedit) return NULL;
+ else ob= G.obedit;
+ arm= (bArmature *)ob->data;
+
+ for (curbone= G.edbo.first; curbone; curbone= curbone->next) {
+ if (curbone->parent == pabone) {
+ if (use_visibility) {
+ if ((arm->layer & curbone->layer) && !(pabone->flag & BONE_HIDDEN_A))
+ chbone = curbone;
+ }
+ else
+ chbone = curbone;
+ }
+ }
+
+ return chbone;
+}
+
+void armature_select_hierarchy(short direction, short add_to_sel)
+{
+ Object *ob;
+ bArmature *arm;
+ EditBone *curbone, *pabone, *chbone;
+
+ if (!G.obedit) return;
+ else ob= G.obedit;
+ arm= (bArmature *)ob->data;
+
+ for (curbone= G.edbo.first; curbone; curbone= curbone->next) {
+ if (arm->layer & curbone->layer) {
+ if (curbone->flag & (BONE_ACTIVE)) {
+ if (direction == BONE_SELECT_PARENT) {
+ if (curbone->parent == NULL) continue;
+ else pabone = curbone->parent;
+
+ if ((arm->layer & pabone->layer) && !(pabone->flag & BONE_HIDDEN_A)) {
+ pabone->flag |= (BONE_ACTIVE|BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
+ if (pabone->parent) pabone->parent->flag |= BONE_TIPSEL;
+
+ if (!add_to_sel) curbone->flag &= ~(BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
+ curbone->flag &= ~BONE_ACTIVE;
+ break;
+ }
+
+ } else { // BONE_SELECT_CHILD
+ chbone = editbone_get_child(curbone, 1);
+ if (chbone == NULL) continue;
+
+ if ((arm->layer & chbone->layer) && !(chbone->flag & BONE_HIDDEN_A)) {
+ chbone->flag |= (BONE_ACTIVE|BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
+
+ if (!add_to_sel) {
+ curbone->flag &= ~(BONE_SELECTED|BONE_ROOTSEL);
+ if (curbone->parent) curbone->parent->flag &= ~BONE_TIPSEL;
+ }
+ curbone->flag &= ~BONE_ACTIVE;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ countall(); // flushes selection!
+
+ allqueue (REDRAWVIEW3D, 0);
+ allqueue (REDRAWBUTSEDIT, 0);
+ allqueue (REDRAWBUTSOBJECT, 0);
+ allqueue (REDRAWOOPS, 0);
+
+ if (direction==BONE_SELECT_PARENT)
+ BIF_undo_push("Select edit bone parent");
+ if (direction==BONE_SELECT_CHILD)
+ BIF_undo_push("Select edit bone child");
+}
+
/* used by posemode and editmode */
void setflag_armature (short mode)
{
diff --git a/source/blender/src/editimasel.c b/source/blender/src/editimasel.c
index 67e10d771e0..97ddc2e0f1d 100644
--- a/source/blender/src/editimasel.c
+++ b/source/blender/src/editimasel.c
@@ -1076,6 +1076,12 @@ void winqreadimaselspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
toggle_blockhandler(sa, IMASEL_HANDLER_IMAGE, UI_PNL_UNSTOW);
scrarea_queue_winredraw(sa);
break;
+ case HKEY:
+ simasel->flag ^= FILE_HIDE_DOT;
+ BIF_filelist_free(simasel->files);
+ do_draw= 1;
+ do_headdraw= 1;
+ break;
case PKEY:
if(G.qual & LR_SHIFTKEY) {
extern char bprogname[]; /* usiblender.c */
diff --git a/source/blender/src/editseq.c b/source/blender/src/editseq.c
index 12019a9dab9..e9d0b57a166 100644
--- a/source/blender/src/editseq.c
+++ b/source/blender/src/editseq.c
@@ -644,6 +644,7 @@ static int seq_is_parent(Sequence *par, Sequence *seq)
static int seq_is_predecessor(Sequence *pred, Sequence *seq)
{
+ if (!pred) return 0;
if(pred == seq) return 0;
else if(seq_is_parent(pred, seq)) return 1;
else if(pred->seq1 && seq_is_predecessor(pred->seq1, seq)) return 1;
diff --git a/source/blender/src/header_info.c b/source/blender/src/header_info.c
index dac7c7bc2c6..a9280d9dd19 100644
--- a/source/blender/src/header_info.c
+++ b/source/blender/src/header_info.c
@@ -540,6 +540,42 @@ static void check_packAll()
}
}
+#ifdef _WIN32
+static void copy_game_dll(char *dll_filename, char *source_dir, char *dest_dir)
+{
+ char source_filename[FILE_MAX];
+ char dest_filename[FILE_MAX];
+
+ strcpy( source_filename, source_dir );
+ strcat( source_filename, dll_filename );
+
+ strcpy( dest_filename, dest_dir );
+ strcat( dest_filename, dll_filename );
+
+ if(!BLI_exists(dest_filename)) {
+ BLI_copy_fileops( source_filename, dest_filename );
+ }
+}
+
+static void copy_all_game_dlls(char *str)
+{
+#define GAME_DLL_COUNT 7
+ char *game_dll_list[GAME_DLL_COUNT]={"gnu_gettext.dll", "libpng.dll", "libtiff.dll", "pthreadVC2.dll", "python25.dll", "SDL.dll", "zlib.dll"};
+
+ char dest_dir[FILE_MAX];
+ char source_dir[FILE_MAX];
+ int i;
+
+ strcpy(source_dir, get_install_dir());
+ strcat(source_dir, "\\");
+ BLI_split_dirfile_basic(str, dest_dir, NULL);
+
+ for (i= 0; i< GAME_DLL_COUNT; i++) {
+ copy_game_dll(game_dll_list[i], source_dir, dest_dir );
+ };
+}
+#endif
+
static int write_runtime(char *str, char *exename)
{
char *freestr= NULL;
@@ -587,7 +623,14 @@ static void write_runtime_check(char *str)
#endif
write_runtime(str, player);
+
+#ifdef _WIN32
+ // get a list of the .DLLs in the Blender folder and copy all of these to the destination folder if they don't exist
+ copy_all_game_dlls(str);
+#endif
}
+
+
/* end keyed functions */
/************************** MAIN MENU *****************************/
@@ -1026,7 +1069,7 @@ static uiBlock *info_externalfiles(void *arg_unused)
block= uiNewBlock(&curarea->uiblocks, "info_externalfiles", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
uiBlockSetButmFunc(block, do_info_externalfiles, NULL);
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pack into Blend", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 1, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pack into .blend file", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 1, "");
#if 0
uiDefBut(block, BUTM, 1, "Unpack Data to current dir", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 2, "Removes all packed files from the project and saves them to the current directory");
#endif
@@ -1036,8 +1079,8 @@ static uiBlock *info_externalfiles(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make all Paths Relative", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 10, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make all Paths Absolute", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 11, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Report Missing Files", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 12, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Find Missing Files", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 13, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Report Missing Files...", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 12, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Find Missing Files...", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 13, "");
uiBlockSetDirection(block, UI_RIGHT);
uiTextBoundsBlock(block, 60);
@@ -1078,9 +1121,9 @@ static uiBlock *info_filemenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Screenshot Subwindow|Ctrl F3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 24, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Screenshot All|Ctrl Shift F3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 25, "");
#if GAMEBLENDER == 1
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save Runtime...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 22, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save Game As Runtime...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 22, "");
#ifdef _WIN32
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save Dynamic Runtime...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 23, "");
+// uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save Dynamic Runtime...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 23, "");
#endif
#endif
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c
index 0b48db461e6..948023bebfb 100644
--- a/source/blender/src/header_view3d.c
+++ b/source/blender/src/header_view3d.c
@@ -166,9 +166,9 @@ void do_layer_buttons(short event)
if(event==-1 && (G.qual & LR_CTRLKEY)) {
G.vd->scenelock= !G.vd->scenelock;
do_view3d_buttons(B_SCENELOCK);
- } else if (event==-1) {
+ } else if (event<0) {
if(G.vd->lay== (1<<20)-1) {
- if(G.qual & LR_SHIFTKEY) G.vd->lay= oldlay;
+ if(event==-2 || G.qual & LR_SHIFTKEY) G.vd->lay= oldlay;
}
else {
oldlay= G.vd->lay;
@@ -605,6 +605,9 @@ static void do_view3d_viewmenu(void *arg, int event)
case 21: /* Grease Pencil */
add_blockhandler(curarea, VIEW3D_HANDLER_GREASEPENCIL, UI_PNL_UNSTOW);
break;
+ case 22: /* View all layers */
+ do_layer_buttons(-2);
+ break;
}
allqueue(REDRAWVIEW3D, 1);
}
@@ -648,6 +651,11 @@ static uiBlock *view3d_viewmenu(void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+ if(G.vd->lay== (1<<20)-1) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Previous Layers|Shift ~", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 22, "");
+ else uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show All Layers| ~", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 22, "");
+
+ uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+
if(G.vd->localview) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Local View|NumPad /", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Local View|NumPad /", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
if(!G.vd->localview) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Global View|NumPad /", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
@@ -726,6 +734,9 @@ void do_view3d_select_object_typemenu(void *arg, int event)
case 10: /* Lamp */
selectall_type(OB_LAMP);
break;
+ case 20:
+ do_layer_buttons(-2);
+ break;
}
allqueue(REDRAWVIEW3D, 0);
}
@@ -1314,12 +1325,21 @@ static void do_view3d_select_armaturemenu(void *arg, int event)
case 2: /* Select/Deselect all */
deselectall_armature(1, 1);
break;
- case 3: /* Select Parent(s) */
- select_bone_parent();
- break;
- case 4: /* Swap Select All */
+ case 3: /* Swap Select All */
deselectall_armature(3, 1);
break;
+ case 4: /* Select parent */
+ armature_select_hierarchy(BONE_SELECT_PARENT, 0);
+ break;
+ case 5: /* Select child */
+ armature_select_hierarchy(BONE_SELECT_CHILD, 0);
+ break;
+ case 6: /* Extend Select parent */
+ armature_select_hierarchy(BONE_SELECT_PARENT, 1);
+ break;
+ case 7: /* Extend Select child */
+ armature_select_hierarchy(BONE_SELECT_CHILD, 1);
+ break;
}
allqueue(REDRAWVIEW3D, 0);
}
@@ -1337,11 +1357,18 @@ static uiBlock *view3d_select_armaturemenu(void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Inverse|Ctrl I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
+
+ uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Swap Select All|Ctrl I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Parent|[", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Child|]", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
+
+ uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Parent|Shift [", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Child|Shift ]", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Parent(s)|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
if(curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);
}
@@ -1368,12 +1395,21 @@ static void do_view3d_select_pose_armaturemenu(void *arg, int event)
case 3: /* Select Target(s) of Constraint(s) */
pose_select_constraint_target();
break;
- case 4: /* Select Bone's Parent */
- select_bone_parent();
- break;
case 5: /* Swap Select All */
deselectall_posearmature(OBACT, 3, 1);
break;
+ case 6: /* Select parent */
+ pose_select_hierarchy(BONE_SELECT_PARENT, 0);
+ break;
+ case 7: /* Select child */
+ pose_select_hierarchy(BONE_SELECT_CHILD, 0);
+ break;
+ case 8: /* Extend Select parent */
+ pose_select_hierarchy(BONE_SELECT_PARENT, 1);
+ break;
+ case 9: /* Extend Select child */
+ pose_select_hierarchy(BONE_SELECT_CHILD, 1);
+ break;
}
allqueue(REDRAWVIEW3D, 0);
}
@@ -1393,8 +1429,17 @@ static uiBlock *view3d_select_pose_armaturemenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Swap Select All|Ctrl I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Constraint Target|W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Parent(s)|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-
+
+ uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Parent|[", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Child|]", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
+
+ uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Parent|Shift [", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Child|Shift ]", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
+
if(curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);
}
@@ -2467,8 +2512,11 @@ static void do_view3d_edit_objectmenu(void *arg, int event)
case 15: /* Object Panel */
add_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_UNSTOW);
break;
+ case 16: /* make proxy object*/
+ make_proxy();
+ break;
#ifdef WITH_VERSE
- case 16: /* Share Object at Verse server */
+ case 17: /* Share Object at Verse server */
if(session_list.first != session_list.last) session = session_menu();
else session = session_list.first;
if(session) b_verse_push_object(session, ob);
@@ -2493,7 +2541,7 @@ static uiBlock *view3d_edit_objectmenu(void *arg_unused)
if (base) ob= base->object;
if(ob && (ob->type == OB_MESH) && (!ob->vnode)) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Share at Verse Server", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Share at Verse Server", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
}
}
@@ -2519,6 +2567,7 @@ static uiBlock *view3d_edit_objectmenu(void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Proxy|Ctrl Alt P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
uiDefIconTextBlockBut(block, view3d_edit_object_makelinksmenu, NULL, ICON_RIGHTARROW_THIN, "Make Links", 0, yco-=20, 120, 19, "");
uiDefIconTextBlockBut(block, view3d_edit_object_singleusermenu, NULL, ICON_RIGHTARROW_THIN, "Make Single User", 0, yco-=20, 120, 19, "");
uiDefIconTextBlockBut(block, view3d_edit_object_makelocalmenu, NULL, ICON_RIGHTARROW_THIN, "Make Local", 0, yco-=20, 120, 19, "");
diff --git a/source/blender/src/poseobject.c b/source/blender/src/poseobject.c
index b054b435002..28b8729a247 100644
--- a/source/blender/src/poseobject.c
+++ b/source/blender/src/poseobject.c
@@ -479,6 +479,67 @@ void pose_select_constraint_target(void)
}
+void pose_select_hierarchy(short direction, short add_to_sel)
+{
+ Object *ob= OBACT;
+ bArmature *arm= ob->data;
+ bPoseChannel *pchan;
+ Bone *curbone, *pabone, *chbone;
+
+ /* paranoia checks */
+ if (!ob && !ob->pose) return;
+ if (ob==G.obedit || (ob->flag & OB_POSEMODE)==0) return;
+
+ for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ curbone= pchan->bone;
+
+ if (arm->layer & curbone->layer) {
+ if (curbone->flag & (BONE_ACTIVE)) {
+ if (direction == BONE_SELECT_PARENT) {
+
+ if (pchan->parent == NULL) continue;
+ else pabone= pchan->parent->bone;
+
+ if ((arm->layer & pabone->layer) && !(pabone->flag & BONE_HIDDEN_P)) {
+
+ if (!add_to_sel) curbone->flag &= ~BONE_SELECTED;
+ curbone->flag &= ~BONE_ACTIVE;
+ pabone->flag |= (BONE_ACTIVE|BONE_SELECTED);
+
+ select_actionchannel_by_name (ob->action, pchan->name, 0);
+ select_actionchannel_by_name (ob->action, pchan->parent->name, 1);
+ break;
+ }
+ } else { // BONE_SELECT_CHILD
+
+ if (pchan->child == NULL) continue;
+ else chbone = pchan->child->bone;
+
+ if ((arm->layer & chbone->layer) && !(chbone->flag & BONE_HIDDEN_P)) {
+
+ if (!add_to_sel) curbone->flag &= ~BONE_SELECTED;
+ curbone->flag &= ~BONE_ACTIVE;
+ chbone->flag |= (BONE_ACTIVE|BONE_SELECTED);
+
+ select_actionchannel_by_name (ob->action, pchan->name, 0);
+ select_actionchannel_by_name (ob->action, pchan->child->name, 1);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ allqueue (REDRAWVIEW3D, 0);
+ allqueue (REDRAWBUTSOBJECT, 0);
+ allqueue (REDRAWOOPS, 0);
+
+ if (direction==BONE_SELECT_PARENT)
+ BIF_undo_push("Select pose bone parent");
+ if (direction==BONE_SELECT_CHILD)
+ BIF_undo_push("Select pose bone child");
+}
+
/* context: active channel */
void pose_special_editmenu(void)
{
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index b4702788e0c..8d86336e12e 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -2428,7 +2428,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
else if(G.qual==LR_ALTKEY && G.obedit->type==OB_ARMATURE)
clear_bone_parent();
else if((G.qual==0) && (G.obedit->type==OB_ARMATURE))
- select_bone_parent();
+ armature_select_hierarchy(BONE_SELECT_PARENT, 1); // 1 = add to selection
else if((G.qual==(LR_CTRLKEY|LR_ALTKEY)) && (G.obedit->type==OB_ARMATURE))
separate_armature();
else if((G.qual==0) && G.obedit->type==OB_MESH)
@@ -2458,7 +2458,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
start_RBSimulation();
}
else if((G.qual==0) && (OBACT) && (OBACT->type==OB_ARMATURE) && (OBACT->flag & OB_POSEMODE))
- select_bone_parent();
+ pose_select_hierarchy(BONE_SELECT_PARENT, 1); // 1 = add to selection
else if((G.qual==0)) {
start_game();
}
@@ -2761,6 +2761,19 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
scrarea_queue_winredraw(curarea);
break;
+ case LEFTBRACKETKEY:
+ if ((G.obedit) && (G.obedit->type == OB_ARMATURE))
+ armature_select_hierarchy(BONE_SELECT_PARENT, (G.qual == LR_SHIFTKEY));
+ else if ((ob) && (ob->flag & OB_POSEMODE))
+ pose_select_hierarchy(BONE_SELECT_PARENT, (G.qual == LR_SHIFTKEY));
+ break;
+ case RIGHTBRACKETKEY:
+ if ((G.obedit) && (G.obedit->type == OB_ARMATURE))
+ armature_select_hierarchy(BONE_SELECT_CHILD, (G.qual == LR_SHIFTKEY));
+ if ((ob) && (ob->flag & OB_POSEMODE))
+ pose_select_hierarchy(BONE_SELECT_CHILD, (G.qual == LR_SHIFTKEY));
+ break;
+
case PADSLASHKEY:
if(G.qual==0) {
if(G.vd->localview) {
diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c
index 94d38ee1635..8a8d7c8cec7 100644
--- a/source/blender/src/toolbox.c
+++ b/source/blender/src/toolbox.c
@@ -125,8 +125,6 @@
void asciitoraw(int ch, unsigned short *event, unsigned short *qual)
{
- if( isalpha(ch)==0 ) return;
-
if( isupper(ch) ) {
*qual= LEFTSHIFTKEY;
ch= tolower(ch);
@@ -804,7 +802,10 @@ static void tb_do_hotkey(void *arg, int event)
case 'd': key= PAGEDOWNKEY; break;
}
}
- else asciitoraw(event, &key, &qual[3]);
+ else if (isalpha(event))
+ asciitoraw(event, &key, &qual[3]);
+ else if (event == '~')
+ key = ACCENTGRAVEKEY;
for (i=0;i<4;i++)
{
@@ -1213,6 +1214,8 @@ static TBitem tb_view[]= {
{ 0, "Ortho/Perspective|NumPad 5", TB_PAD|'5', NULL},
{ 0, "Local/Global View|NumPad /", TB_PAD|'/', NULL},
{ 0, "SEPR", 0, NULL},
+{ 0, "Show All Layers|Shift ~", TB_SHIFT|'~', NULL},
+{ 0, "SEPR", 0, NULL},
{ 0, "Align View", 0, tb_view_alignview},
{ 0, "SEPR", 0, NULL},
{ 0, "View Selected|NumPad .", TB_PAD|'.', NULL},
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index b3a3a47152a..7de3056e382 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -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)
{
diff --git a/source/gameengine/Converter/KX_IpoConvert.cpp b/source/gameengine/Converter/KX_IpoConvert.cpp
index 7410beecaf4..ce004fa0504 100644
--- a/source/gameengine/Converter/KX_IpoConvert.cpp
+++ b/source/gameengine/Converter/KX_IpoConvert.cpp
@@ -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);
+ }
}
}
}
diff --git a/source/gameengine/GamePlayer/common/windows/GPW_Canvas.h b/source/gameengine/GamePlayer/common/windows/GPW_Canvas.h
index bb1abd71505..bf8cb720811 100644
--- a/source/gameengine/GamePlayer/common/windows/GPW_Canvas.h
+++ b/source/gameengine/GamePlayer/common/windows/GPW_Canvas.h
@@ -36,7 +36,7 @@
#include <iostream>
#include <windows.h>
-#include <gl/gl.h>
+//#include <gl/gl.h>
#include "GPC_Canvas.h"
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
index b5ebffb9378..7be3b94d8ae 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
@@ -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)
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index 02d1ad1b12b..661bf17ef23 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -914,6 +914,7 @@ PyMethodDef KX_GameObject::Methods[] = {
KX_PYMETHODTABLE(KX_GameObject, rayCastTo),
KX_PYMETHODTABLE(KX_GameObject, rayCast),
KX_PYMETHODTABLE(KX_GameObject, getDistanceTo),
+ KX_PYMETHODTABLE(KX_GameObject, getVectTo),
{NULL,NULL} //Sentinel
};
@@ -1367,14 +1368,15 @@ PyObject* KX_GameObject::PyGetMesh(PyObject* self,
{
int mesh = 0;
- if (PyArg_ParseTuple(args, "|i", &mesh))
+ if (!PyArg_ParseTuple(args, "|i", &mesh))
+ return NULL; // python sets a simple error
+
+ if (((unsigned int)mesh < m_meshes.size()) && mesh >= 0)
{
- if (((unsigned int)mesh < m_meshes.size()) && mesh >= 0)
- {
- KX_MeshProxy* meshproxy = new KX_MeshProxy(m_meshes[mesh]);
- return meshproxy;
- }
+ KX_MeshProxy* meshproxy = new KX_MeshProxy(m_meshes[mesh]);
+ return meshproxy;
}
+
Py_RETURN_NONE;
}
@@ -1488,6 +1490,9 @@ PyObject* KX_GameObject::PyAlignAxisToVect(PyObject* self,
MT_Vector3 vect;
if (PyVecTo(pyvect, vect))
{
+ if (fac<=0.0) Py_RETURN_NONE; // Nothing to do.
+ if (fac< 1.0) fac= 1.0;
+
AlignAxisToVect(vect,axis,fac);
NodeUpdateGS(0.f,true);
Py_RETURN_NONE;
@@ -1555,6 +1560,54 @@ KX_PYMETHODDEF_DOC(KX_GameObject, getDistanceTo,
return NULL;
}
+KX_PYMETHODDEF_DOC(KX_GameObject, getVectTo,
+"getVectTo(other): get vector and the distance to another point/KX_GameObject\n"
+"Returns a 3-tuple with (distance,worldVector,localVector)\n")
+{
+ MT_Point3 toPoint, fromPoint;
+ MT_Vector3 toDir, locToDir;
+ MT_Scalar distance;
+
+ PyObject *returnValue;
+ PyObject *pyother;
+
+ if (!PyVecArgTo(args, toPoint))
+ {
+ PyErr_Clear();
+ if (PyArg_ParseTuple(args, "O!", &KX_GameObject::Type, &pyother))
+ {
+ KX_GameObject *other = static_cast<KX_GameObject*>(pyother);
+ toPoint = other->NodeGetWorldPosition();
+ }else
+ {
+ PyErr_SetString(PyExc_TypeError, "Expected a 3D Vector or GameObject type");
+ return NULL;
+ }
+ }
+
+ fromPoint = NodeGetWorldPosition();
+ toDir = toPoint-fromPoint;
+ distance = toDir.length();
+
+ if (MT_fuzzyZero(distance))
+ {
+ //cout << "getVectTo() Error: Null vector!\n";
+ locToDir = toDir = MT_Vector3(0.0,0.0,0.0);
+ distance = 0.0;
+ } else {
+ toDir.normalize();
+ locToDir = toDir * NodeGetWorldOrientation();
+ }
+
+ returnValue = PyTuple_New(3);
+ if (returnValue) { // very unlikely to fail, python sets a memory error here.
+ PyTuple_SET_ITEM(returnValue, 0, PyFloat_FromDouble(distance));
+ PyTuple_SET_ITEM(returnValue, 1, PyObjectFrom(toDir));
+ PyTuple_SET_ITEM(returnValue, 2, PyObjectFrom(locToDir));
+ }
+ return returnValue;
+}
+
bool KX_GameObject::RayHit(KX_ClientObjectInfo* client, MT_Point3& hit_point, MT_Vector3& hit_normal, void * const data)
{
@@ -1588,8 +1641,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo,
char *propName = NULL;
if (!PyArg_ParseTuple(args,"O|fs", &pyarg, &dist, &propName)) {
- PyErr_SetString(PyExc_TypeError, "Invalid arguments");
- return NULL;
+ return NULL; // python sets simple error
}
if (!PyVecTo(pyarg, toPoint))
@@ -1654,8 +1706,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCast,
KX_GameObject *other;
if (!PyArg_ParseTuple(args,"O|Ofs", &pyto, &pyfrom, &dist, &propName)) {
- PyErr_SetString(PyExc_TypeError, "Invalid arguments");
- return NULL;
+ return NULL; // Python sets a simple error
}
if (!PyVecTo(pyto, toPoint))
@@ -1714,13 +1765,11 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCast,
if (m_pHitObject)
{
PyObject* returnValue = PyTuple_New(3);
- if (!returnValue) {
- PyErr_SetString(PyExc_TypeError, "PyTuple_New() failed");
- return NULL;
+ if (returnValue) { // unlikely this would ever fail, if it does python sets an error
+ PyTuple_SET_ITEM(returnValue, 0, m_pHitObject->AddRef());
+ PyTuple_SET_ITEM(returnValue, 1, PyObjectFrom(resultPoint));
+ PyTuple_SET_ITEM(returnValue, 2, PyObjectFrom(resultNormal));
}
- PyTuple_SET_ITEM(returnValue, 0, m_pHitObject->AddRef());
- PyTuple_SET_ITEM(returnValue, 1, PyObjectFrom(resultPoint));
- PyTuple_SET_ITEM(returnValue, 2, PyObjectFrom(resultNormal));
return returnValue;
}
return Py_BuildValue("OOO", Py_None, Py_None, Py_None);
diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h
index 1d36798b12f..4e435e9ddf4 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -756,6 +756,7 @@ public:
KX_PYMETHOD_DOC(KX_GameObject,rayCastTo);
KX_PYMETHOD_DOC(KX_GameObject,rayCast);
KX_PYMETHOD_DOC(KX_GameObject,getDistanceTo);
+ KX_PYMETHOD_DOC(KX_GameObject,getVectTo);
private :
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index b66c3e42606..db4793de23d 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -62,6 +62,10 @@
#include "KX_PyMath.h"
+extern "C" {
+ #include "Mathutils.h" // Blender.Mathutils module copied here so the blenderlayer can use.
+}
+
#include "PHY_IPhysicsEnvironment.h"
// FIXME: Enable for access to blender python modules. This is disabled because
// python has dependencies on a lot of other modules and is a pain to link.
@@ -733,7 +737,7 @@ PyObject* initGameLogic(KX_Scene* scene) // quick hack to get gravity hook
ErrorObject = PyString_FromString("GameLogic.error");
PyDict_SetItemString(d, "error", ErrorObject);
-
+
// XXXX Add constants here
/* To use logic bricks, we need some sort of constants. Here, we associate */
/* constants and sumbolic names. Add them to dictionary d. */
@@ -876,7 +880,7 @@ PyObject *KXpy_import(PyObject *self, PyObject *args)
/* quick hack for GamePython modules
TODO: register builtin modules properly by ExtendInittab */
if (!strcmp(name, "GameLogic") || !strcmp(name, "GameKeys") || !strcmp(name, "PhysicsConstraints") ||
- !strcmp(name, "Rasterizer")) {
+ !strcmp(name, "Rasterizer") || !strcmp(name, "Mathutils")) {
return PyImport_ImportModuleEx(name, globals, locals, fromlist);
}
@@ -1169,6 +1173,11 @@ PyObject* initGameKeys()
return d;
}
+PyObject* initMathutils()
+{
+ return Mathutils_Init("Mathutils"); // Use as a top level module in BGE
+}
+
void PHY_SetActiveScene(class KX_Scene* scene)
{
gp_KetsjiScene = scene;
diff --git a/source/gameengine/Ketsji/KX_PythonInit.h b/source/gameengine/Ketsji/KX_PythonInit.h
index 41cf7fd67b3..f094a1ca575 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.h
+++ b/source/gameengine/Ketsji/KX_PythonInit.h
@@ -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();
diff --git a/source/gameengine/Ketsji/KX_TouchEventManager.cpp b/source/gameengine/Ketsji/KX_TouchEventManager.cpp
index 7528fdbbc34..48d4cf59a2b 100644
--- a/source/gameengine/Ketsji/KX_TouchEventManager.cpp
+++ b/source/gameengine/Ketsji/KX_TouchEventManager.cpp
@@ -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);
}
diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript
index fdac5a71071..f6f744b199a 100644
--- a/source/gameengine/Ketsji/SConscript
+++ b/source/gameengine/Ketsji/SConscript
@@ -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'
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
index 5c70b071661..b872fae6138 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
@@ -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;
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.h b/source/gameengine/Physics/Bullet/CcdPhysicsController.h
index 64f1876e199..448e5622eff 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.h
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.h
@@ -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);
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index ea14c5430e2..08f40424323 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -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()
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
index fd96522037e..825a5e525f2 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
@@ -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);
diff --git a/source/gameengine/PyDoc/KX_GameObject.py b/source/gameengine/PyDoc/KX_GameObject.py
index 8f17cf26f15..a5ba5b1d634 100644
--- a/source/gameengine/PyDoc/KX_GameObject.py
+++ b/source/gameengine/PyDoc/KX_GameObject.py
@@ -253,6 +253,16 @@ class KX_GameObject:
@type other: L{KX_GameObject} or list [x, y, z]
@rtype: float
"""
+ def getVectTo(other):
+ """
+ Returns the vector and the distance to another object or point.
+ The vector is normalized unless the distance is 0, in which a NULL vector is returned.
+
+ @param other: a point or another L{KX_GameObject} to get the vector and distance to.
+ @type other: L{KX_GameObject} or list [x, y, z]
+ @rtype: 3-tuple (float, 3-tuple (x,y,z), 3-tuple (x,y,z))
+ @return: (distance, globalVector(3), localVector(3))
+ """
def rayCastTo(other,dist,prop):
"""
Look towards another point/object and find first object hit within dist that matches prop.