Merge from trunk
authorAndre Susano Pinto <andresusanopinto@gmail.com>
Fri, 9 May 2008 11:57:52 +0000 (11:57 +0000)
committerAndre Susano Pinto <andresusanopinto@gmail.com>
Fri, 9 May 2008 11:57:52 +0000 (11:57 +0000)
svn merge -r 14692:14760 https://svn.blender.org/svnroot/bf-blender/trunk/blender

79 files changed:
projectfiles_vc7/gameengine/blenderhook/KX_blenderhook.vcproj
projectfiles_vc7/gameengine/ketsji/KX_ketsji.vcproj
projectfiles_vc7/gameengine/rasterizer/RAS_rasterizer.vcproj
projectfiles_vc7/gameengine/rasterizer/openglrasterizer/RAS_openglrasterizer.vcproj
release/scripts/bpymodules/BPyAddMesh.py
release/scripts/bpymodules/dxfReader.py
release/scripts/vrml97_export.py
release/scripts/x3d_export.py
source/Makefile
source/blender/blenkernel/bad_level_call_stubs/stubs.c
source/blender/blenkernel/intern/action.c
source/blender/blenkernel/intern/anim.c
source/blender/blenkernel/intern/blender.c
source/blender/blenkernel/intern/ipo.c
source/blender/blenkernel/intern/mball.c
source/blender/blenkernel/intern/modifier.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/shrinkwrap.c
source/blender/blenloader/intern/readfile.c
source/blender/imbuf/intern/util.c
source/blender/include/BDR_editface.h
source/blender/include/BIF_imasel.h
source/blender/include/BIF_interface.h
source/blender/include/BSE_drawview.h
source/blender/include/BSE_filesel.h
source/blender/makesdna/DNA_particle_types.h
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/DNA_userdef_types.h
source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c
source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c
source/blender/python/BPY_interface.c
source/blender/python/api2_2x/Blender.c
source/blender/python/api2_2x/Material.c
source/blender/python/api2_2x/Sys.c
source/blender/python/api2_2x/doc/Material.py
source/blender/python/api2_2x/doc/Sys.py
source/blender/python/api2_2x/doc/epy_docgen-3.sh [deleted file]
source/blender/python/api2_2x/doc/epy_docgen.sh
source/blender/render/intern/source/envmap.c
source/blender/render/intern/source/rendercore.c
source/blender/render/intern/source/shadeoutput.c
source/blender/src/buttons_editing.c
source/blender/src/buttons_object.c
source/blender/src/drawimasel.c
source/blender/src/drawnla.c
source/blender/src/drawobject.c
source/blender/src/drawview.c
source/blender/src/editface.c
source/blender/src/editmesh_mods.c
source/blender/src/editnla.c
source/blender/src/editobject.c
source/blender/src/editseq.c
source/blender/src/filesel.c
source/blender/src/header_seq.c
source/blender/src/headerbuttons.c
source/blender/src/imasel.c
source/blender/src/interface.c
source/blender/src/interface_draw.c
source/blender/src/parametrizer.c
source/blender/src/parametrizer.h
source/blender/src/parametrizer_intern.h
source/blender/src/sequence.c
source/blender/src/space.c
source/blender/src/transform_conversions.c
source/blender/src/unwrapper.c
source/creator/creator.c
source/gameengine/BlenderRoutines/Makefile
source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/GamePlayer/Makefile
source/gameengine/GamePlayer/common/Makefile
source/gameengine/GamePlayer/ghost/Makefile
source/gameengine/Ketsji/KX_CameraActuator.cpp
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_GameObject.h
source/gameengine/PyDoc/KX_GameObject.py
source/gameengine/Rasterizer/Makefile
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/Makefile
source/nan_definitions.mk

index bc4204eaa44685e8e9dbd1042b155e7af5d27641..c54666c08cd546293d8bdb2e3ca752336f2f9215 100644 (file)
@@ -75,7 +75,7 @@
                                Name="VCCLCompilerTool"
                                InlineFunctionExpansion="1"
                                AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\bmfont\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender;..\..\..\source\blender\misc;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\include;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenloader;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\ketsji;..\..\..\source\gameengine\network;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\Physics\Sumo;..\..\..\source\gameengine\Physics\common;..\..\..\source\gameengine\network\loopbacknetwork;..\..\..\source\gameengine\rasterizer\ras_openglrasterizer;..\..\..\source\gameengine\Physics\Sumo\Fuzzics\include"
-                               PreprocessorDefinitions="NDEBUG;WIN32;_LIB;USE_SUMO_SOLID"
+                               PreprocessorDefinitions="NDEBUG;WIN32;_LIB;USE_SUMO_SOLID;WITH_GLEXT"
                                StringPooling="TRUE"
                                BasicRuntimeChecks="0"
                                RuntimeLibrary="0"
index d85fb6c348241983bd4fc403634609c4b0163f77..2b7a24ed7ad5a6f83522e50cbf916f80c24da474 100644 (file)
                                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;..\..\..\..\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"
-                               PreprocessorDefinitions="NDEBUG;WIN32;_LIB;USE_SUMO_SOLID"
+                               PreprocessorDefinitions="NDEBUG;WIN32;_LIB;USE_SUMO_SOLID;WITH_GLEXT"
                                StringPooling="TRUE"
                                RuntimeLibrary="0"
                                EnableFunctionLevelLinking="TRUE"
                                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;..\..\..\..\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"
-                               PreprocessorDefinitions="JANCODEPANCO;WIN32;_LIB;EXP_PYTHON_EMBEDDING;_DEBUG;USE_SUMO_SOLID"
+                               PreprocessorDefinitions="JANCODEPANCO;WIN32;_LIB;EXP_PYTHON_EMBEDDING;_DEBUG;USE_SUMO_SOLID;WITH_GLEXT"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="1"
                                DefaultCharIsUnsigned="TRUE"
                                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;..\..\..\..\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"
-                               PreprocessorDefinitions="NDEBUG;WIN32;_LIB;USE_SUMO_SOLID"
+                               PreprocessorDefinitions="NDEBUG;WIN32;_LIB;USE_SUMO_SOLID;WITH_GLEXT"
                                StringPooling="TRUE"
                                RuntimeLibrary="0"
                                EnableFunctionLevelLinking="TRUE"
index f4801b58bc8f338df5db10a78e889c190a684e59..40a92a5c181cf5223da60838c46769d425821460 100644 (file)
                                Name="VCCLCompilerTool"
                                InlineFunctionExpansion="1"
                                AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\string\include;..\..\..\source\kernel\gen_system"
-                               PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
+                               PreprocessorDefinitions="NDEBUG;WIN32;_LIB;WITH_GLEXT"
                                StringPooling="TRUE"
                                RuntimeLibrary="0"
                                EnableFunctionLevelLinking="TRUE"
                                Name="VCCLCompilerTool"
                                Optimization="0"
                                AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\string\include;..\..\..\source\kernel\gen_system"
-                               PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
+                               PreprocessorDefinitions="_DEBUG;WIN32;_LIB;WITH_GLEXT"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="1"
                                DefaultCharIsUnsigned="TRUE"
                                Name="VCCLCompilerTool"
                                InlineFunctionExpansion="1"
                                AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\string\include;..\..\..\source\kernel\gen_system"
-                               PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
+                               PreprocessorDefinitions="NDEBUG;WIN32;_LIB;WITH_GLEXT"
                                StringPooling="TRUE"
                                RuntimeLibrary="0"
                                EnableFunctionLevelLinking="TRUE"
index b96cf78daf509724b5fa6d38ab7a3ed03b871c79..b21c0fff7ee47afd82d9b358ce13d939d69e2de9 100644 (file)
                                Name="VCCLCompilerTool"
                                InlineFunctionExpansion="1"
                                AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\Rasterizer"
-                               PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
+                               PreprocessorDefinitions="NDEBUG;WIN32;_LIB;WITH_GLEXT"
                                StringPooling="TRUE"
                                RuntimeLibrary="0"
                                EnableFunctionLevelLinking="TRUE"
                                Name="VCCLCompilerTool"
                                Optimization="0"
                                AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\Rasterizer"
-                               PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
+                               PreprocessorDefinitions="_DEBUG;WIN32;_LIB;WITH_GLEXT"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="1"
                                DefaultCharIsUnsigned="TRUE"
                                Name="VCCLCompilerTool"
                                InlineFunctionExpansion="1"
                                AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\Rasterizer"
-                               PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
+                               PreprocessorDefinitions="NDEBUG;WIN32;_LIB;WITH_GLEXT"
                                StringPooling="TRUE"
                                RuntimeLibrary="0"
                                EnableFunctionLevelLinking="TRUE"
index 6ffb394320a660c36ab41daa456e64558d2baa89..bd3ee845d21cd467eb230534dad2c9f194e1302c 100644 (file)
@@ -16,13 +16,17 @@ def add_mesh_simple(name, verts, edges, faces):
        scn = bpy.data.scenes.active
        if scn.lib: return
        ob_act = scn.objects.active
-       
+
+       is_editmode = EditMode()
+
        cursor = GetCursorPos()
-       try:    quat = Blender.Mathutils.Quaternion(GetViewQuat())
-       except: quat = None
+       quat = None
+       if is_editmode or Blender.Get('add_view_align'): # Aligning seems odd for editmode, but blender does it, oh well
+               try:    quat = Blender.Mathutils.Quaternion(GetViewQuat())
+               except: pass
        
        # Exist editmode for non mesh types
-       if ob_act and ob_act.type != 'Mesh' and EditMode():
+       if ob_act and ob_act.type != 'Mesh' and is_editmode:
                EditMode(0)
        
        # We are in mesh editmode
@@ -65,8 +69,9 @@ def add_mesh_simple(name, verts, edges, faces):
                        # Mesh with no data, unlikely
                        me.edges.extend(edges)
                        me.faces.extend(faces)
-               
-               EditMode(1)
+
+               if is_editmode or Blender.Get('add_editmode'):
+                       EditMode(1)
                
        else:
                
@@ -90,8 +95,9 @@ def add_mesh_simple(name, verts, edges, faces):
                        ob_act.setMatrix(mat)
                
                ob_act.loc = cursor
-               
-               EditMode(1)
+
+               if is_editmode or Blender.Get('add_editmode'):
+                       EditMode(1)
 
 
 def write_mesh_script(filepath, me):
index d4a39cf63d6b21355ad24887159b5e4971995d55..df4ebc309e4f55f97e52378620c6054f6b8a20d3 100644 (file)
@@ -1,11 +1,12 @@
 """This module provides a function for reading dxf files and parsing them into a useful tree of objects and data.
 
-    The convert function is called by the readDXF fuction to convert dxf strings into the correct data based 
-    on their type code.  readDXF expects a (full path) file name as input.
+       The convert function is called by the readDXF fuction to convert dxf strings into the correct data based
+       on their type code.  readDXF expects a (full path) file name as input.
 """
 
 # --------------------------------------------------------------------------
 # DXF Reader v0.9 by Ed Blake (AKA Kitsu)
+#  2008.05.08 modif.def convert() by Remigiusz Fiedler (AKA migius)
 # --------------------------------------------------------------------------
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
 #from dxfImportObjects import *
 
 class Object:
-    """Empty container class for dxf objects"""
-    
-    def __init__(self, _type='', block=False):
-        """_type expects a string value."""
-        self.type = _type
-        self.name = ''
-        self.data = []
-    
-    def __str__(self):
-        if self.name:
-            return self.name
-        else:
-            return self.type
-    
-    def __repr__(self):
-        return str(self.data)
-    
-    def get_type(self, kind=''):
-        """Despite the name, this method actually returns all objects of type 'kind' from self.data."""
-        if type:
-            objects = []
-            for item in self.data:
-                if type(item) != list and item.type == kind:
-                    # we want this type of object
-                    objects.append(item)
-                elif type(item) == list and item[0] == kind:
-                    # we want this type of data
-                    objects.append(item[1])
-            return objects
-    
+       """Empty container class for dxf objects"""
+
+       def __init__(self, _type='', block=False):
+               """_type expects a string value."""
+               self.type = _type
+               self.name = ''
+               self.data = []
+
+       def __str__(self):
+               if self.name:
+                       return self.name
+               else:
+                       return self.type
+
+       def __repr__(self):
+               return str(self.data)
+
+       def get_type(self, kind=''):
+               """Despite the name, this method actually returns all objects of type 'kind' from self.data."""
+               if type:
+                       objects = []
+                       for item in self.data:
+                               if type(item) != list and item.type == kind:
+                                       # we want this type of object
+                                       objects.append(item)
+                               elif type(item) == list and item[0] == kind:
+                                       # we want this type of data
+                                       objects.append(item[1])
+                       return objects
+
 
 class InitializationError(Exception): pass
 
 class StateMachine:
-    """(finite) State Machine from the great David Mertz's great Charming Python article."""
-    
-    def __init__(self):
-        self.handlers = []
-        self.startState = None
-        self.endStates = []
-            
-    def add_state(self, handler, end_state=0):
-        """All states and handlers are functions which return
-        a state and a cargo."""
-        self.handlers.append(handler)
-        if end_state:
-            self.endStates.append(handler)    
-    def set_start(self, handler):
-        """Sets the starting handler function."""
-        self.startState = handler
-    
-    
-    def run(self, cargo=None):
-        if not self.startState:
-            raise InitializationError,\
-                  "must call .set_start() before .run()"
-        if not self.endStates:
-            raise InitializationError, \
-                  "at least one state must be an end_state"
-        handler = self.startState
-        while 1:
-            (newState, cargo) = handler(cargo)
-            #print cargo
-            if newState in self.endStates:
-                return newState(cargo)
-                #break
-            elif newState not in self.handlers:
-                raise RuntimeError, "Invalid target %s" % newState
-            else:
-                handler = newState
+       """(finite) State Machine from the great David Mertz's great Charming Python article."""
+
+       def __init__(self):
+               self.handlers = []
+               self.startState = None
+               self.endStates = []
+
+       def add_state(self, handler, end_state=0):
+               """All states and handlers are functions which return
+               a state and a cargo."""
+               self.handlers.append(handler)
+               if end_state:
+                       self.endStates.append(handler)
+       def set_start(self, handler):
+               """Sets the starting handler function."""
+               self.startState = handler
+
+
+       def run(self, cargo=None):
+               if not self.startState:
+                       raise InitializationError,\
+                                 "must call .set_start() before .run()"
+               if not self.endStates:
+                       raise InitializationError, \
+                                 "at least one state must be an end_state"
+               handler = self.startState
+               while 1:
+                       (newState, cargo) = handler(cargo)
+                       #print cargo
+                       if newState in self.endStates:
+                               return newState(cargo)
+                               #break
+                       elif newState not in self.handlers:
+                               raise RuntimeError, "Invalid target %s" % newState
+                       else:
+                               handler = newState
 
 def get_name(data):
-    """Get the name of an object from its object data.
-    
-    Returns a pair of (data_item, name) where data_item is the list entry where the name was found
-    (the data_item can be used to remove the entry from the object data).  Be sure to check 
-    name not None before using the returned values!
-    """
-    value = None
-    for item in data:
-        if item[0] == 2:
-            value = item[1]
-            break
-    return item, value
+       """Get the name of an object from its object data.
+
+       Returns a pair of (data_item, name) where data_item is the list entry where the name was found
+       (the data_item can be used to remove the entry from the object data).  Be sure to check
+       name not None before using the returned values!
+       """
+       value = None
+       for item in data:
+               if item[0] == 2:
+                       value = item[1]
+                       break
+       return item, value
 
 def get_layer(data):
-    """Expects object data as input.
-    
-    Returns (entry, layer_name) where entry is the data item that provided the layer name.
-    """
-    value = None
-    for item in data:
-        if item[0] == 8:
-            value = item[1]
-            break
-    return item, value
+       """Expects object data as input.
+
+       Returns (entry, layer_name) where entry is the data item that provided the layer name.
+       """
+       value = None
+       for item in data:
+               if item[0] == 8:
+                       value = item[1]
+                       break
+       return item, value
 
 
 def convert(code, value):
-    """Convert a string to the correct Python type based on its dxf code.
-    code types:
-        ints = 60-79, 170-179, 270-289, 370-389, 400-409, 1060-1070
-        longs = 90-99, 420-429, 440-459, 1071
-        floats = 10-39, 40-59, 110-139, 140-149, 210-239, 460-469, 1010-1059
-        hex = 105, 310-379, 390-399
-        strings = 0-9, 100, 102, 300-309, 410-419, 430-439, 470-479, 999, 1000-1009
-    """
-    if 59 < code < 80 or 169 < code < 180 or 269 < code < 290 or 369 < code < 390 or 399 < code < 410 or 1059 < code < 1071:
-        value = int(value)
-    elif 89 < code < 100 or 419 < code < 430 or 439 < code < 460 or code == 1071:
-        value = long(value)
-    elif 9 < code < 60 or 109 < code < 150 or 209 < code < 240 or 459 < code < 470 or 1009 < code < 1060:
-        value = float(value)
-    elif code == 105 or 309 < code < 380 or 389 < code < 400:
-        value = int(value, 16) # should be left as string?
-    else: # it's already a string so do nothing
-        pass
-    return value
+       """Convert a string to the correct Python type based on its dxf code.
+       code types:
+               ints = 60-79, 170-179, 270-289, 370-389, 400-409, 1060-1070
+               longs = 90-99, 420-429, 440-459, 1071
+               floats = 10-39, 40-59, 110-139, 140-149, 210-239, 460-469, 1010-1059
+               hex = 105, 310-379, 390-399
+               strings = 0-9, 100, 102, 300-309, 410-419, 430-439, 470-479, 999, 1000-1009
+       """
+       if 59 < code < 80 or 169 < code < 180 or 269 < code < 290 or 369 < code < 390 or 399 < code < 410 or 1059 < code < 1071:
+               value = int(float(value))
+       elif 89 < code < 100 or 419 < code < 430 or 439 < code < 460 or code == 1071:
+               value = long(float(value))
+       elif 9 < code < 60 or 109 < code < 150 or 209 < code < 240 or 459 < code < 470 or 1009 < code < 1060:
+               value = float(value)
+       elif code == 105 or 309 < code < 380 or 389 < code < 400:
+               value = int(value, 16) # should be left as string?
+       else: # it's already a string so do nothing
+               pass
+       return value
 
 
 def findObject(infile, kind=''):
-    """Finds the next occurance of an object."""
-    obj = False
-    while 1:
-        line = infile.readline()
-        if not line: # readline returns '' at eof
-            return False
-        if not obj: # We're still looking for our object code
-            if line.lower().strip() == '0':
-                obj = True # found it
-        else: # we are in an object definition
-            if kind: # if we're looking for a particular kind
-                if line.lower().strip() == kind:
-                    obj = Object(line.lower().strip())
-                    break
-            else: # otherwise take anything non-numeric
-                if line.lower().strip() not in string.digits:
-                    obj = Object(line.lower().strip())
-                    break
-            obj = False # whether we found one or not it's time to start over
-    return obj
+       """Finds the next occurance of an object."""
+       obj = False
+       while 1:
+               line = infile.readline()
+               if not line: # readline returns '' at eof
+                       return False
+               if not obj: # We're still looking for our object code
+                       if line.lower().strip() == '0':
+                               obj = True # found it
+               else: # we are in an object definition
+                       if kind: # if we're looking for a particular kind
+                               if line.lower().strip() == kind:
+                                       obj = Object(line.lower().strip())
+                                       break
+                       else: # otherwise take anything non-numeric
+                               if line.lower().strip() not in string.digits:
+                                       obj = Object(line.lower().strip())
+                                       break
+                       obj = False # whether we found one or not it's time to start over
+       return obj
 
 def handleObject(infile):
-    """Add data to an object until end of object is found."""
-    line = infile.readline()
-    if line.lower().strip() == 'section':
-        return 'section' # this would be a problem
-    elif line.lower().strip() == 'endsec':
-        return 'endsec' # this means we are done with a section
-    else: # add data to the object until we find a new object
-        obj = Object(line.lower().strip())
-        obj.name = obj.type
-        done = False
-        data = []
-        while not done:
-            line = infile.readline()
-            if not data:
-                if line.lower().strip() == '0':
-                    #we've found an object, time to return
-                    return obj
-                else:
-                    # first part is always an int
-                    data.append(int(line.lower().strip()))
-            else:
-                data.append(convert(data[0], line.strip()))
-                obj.data.append(data)
-                data = []
+       """Add data to an object until end of object is found."""
+       line = infile.readline()
+       if line.lower().strip() == 'section':
+               return 'section' # this would be a problem
+       elif line.lower().strip() == 'endsec':
+               return 'endsec' # this means we are done with a section
+       else: # add data to the object until we find a new object
+               obj = Object(line.lower().strip())
+               obj.name = obj.type
+               done = False
+               data = []
+               while not done:
+                       line = infile.readline()
+                       if not data:
+                               if line.lower().strip() == '0':
+                                       #we've found an object, time to return
+                                       return obj
+                               else:
+                                       # first part is always an int
+                                       data.append(int(line.lower().strip()))
+                       else:
+                               data.append(convert(data[0], line.strip()))
+                               obj.data.append(data)
+                               data = []
 
 def handleTable(table, infile):
-    """Special handler for dealing with nested table objects."""
-    item, name = get_name(table.data)
-    if name: # We should always find a name
-        table.data.remove(item)
-        table.name = name.lower()
-    # This next bit is from handleObject
-    # handleObject should be generalized to work with any section like object
-    while 1:
-        obj = handleObject(infile)
-        if obj.type == 'table':
-            print "Warning: previous table not closed!"
-            return table
-        elif obj.type == 'endtab':
-            return table # this means we are done with the table
-        else: # add objects to the table until one of the above is found
-            table.data.append(obj)
-        
-    
-    
+       """Special handler for dealing with nested table objects."""
+       item, name = get_name(table.data)
+       if name: # We should always find a name
+               table.data.remove(item)
+               table.name = name.lower()
+       # This next bit is from handleObject
+       # handleObject should be generalized to work with any section like object
+       while 1:
+               obj = handleObject(infile)
+               if obj.type == 'table':
+                       print "Warning: previous table not closed!"
+                       return table
+               elif obj.type == 'endtab':
+                       return table # this means we are done with the table
+               else: # add objects to the table until one of the above is found
+                       table.data.append(obj)
+
+
+
 
 def handleBlock(block, infile):
-    """Special handler for dealing with nested table objects."""
-    item, name = get_name(block.data)
-    if name: # We should always find a name
-        block.data.remove(item)
-        block.name = name
-    # This next bit is from handleObject
-    # handleObject should be generalized to work with any section like object
-    while 1:
-        obj = handleObject(infile)
-        if obj.type == 'block':
-            print "Warning: previous block not closed!"
-            return block
-        elif obj.type == 'endblk':
-            return block # this means we are done with the table
-        else: # add objects to the table until one of the above is found
-            block.data.append(obj)
-        
-    
-    
+       """Special handler for dealing with nested table objects."""
+       item, name = get_name(block.data)
+       if name: # We should always find a name
+               block.data.remove(item)
+               block.name = name
+       # This next bit is from handleObject
+       # handleObject should be generalized to work with any section like object
+       while 1:
+               obj = handleObject(infile)
+               if obj.type == 'block':
+                       print "Warning: previous block not closed!"
+                       return block
+               elif obj.type == 'endblk':
+                       return block # this means we are done with the table
+               else: # add objects to the table until one of the above is found
+                       block.data.append(obj)
+
+
+
 
 """These are the states/functions used in the State Machine.
 states:
@@ -250,133 +251,131 @@ states:
 """
 
 def start(cargo):
-    """Expects the infile as cargo, initializes the cargo."""
-    #print "Entering start state!"
-    infile = cargo
-    drawing = Object('drawing')
-    section = findObject(infile, 'section')
-    if section:
-        return start_section, (infile, drawing, section)
-    else:
-        return error, (infile, "Failed to find any sections!")
+       """Expects the infile as cargo, initializes the cargo."""
+       #print "Entering start state!"
+       infile = cargo
+       drawing = Object('drawing')
+       section = findObject(infile, 'section')
+       if section:
+               return start_section, (infile, drawing, section)
+       else:
+               return error, (infile, "Failed to find any sections!")
 
 def start_section(cargo):
-    """Expects [infile, drawing, section] as cargo, builds a nested section object."""
-    #print "Entering start_section state!"
-    infile = cargo[0]
-    drawing = cargo[1]
-    section = cargo[2]
-    # read each line, if it is an object declaration go to object mode
-    # otherwise create a [index, data] pair and add it to the sections data.
-    done = False
-    data = []
-    while not done:
-        line = infile.readline()
-        
-        if not data: # if we haven't found a dxf code yet
-            if line.lower().strip() == '0':
-                # we've found an object
-                while 1: # no way out unless we find an end section or a new section
-                    obj = handleObject(infile)
-                    if obj == 'section': # shouldn't happen
-                        print "Warning: failed to close previous section!"
-                        return end_section, (infile, drawing)
-                    elif obj == 'endsec': # This section is over, look for the next
-                        drawing.data.append(section)
-                        return end_section, (infile, drawing)
-                    elif obj.type == 'table': # tables are collections of data
-                        obj = handleTable(obj, infile) # we need to find all there contents
-                        section.data.append(obj) # before moving on
-                    elif obj.type == 'block': # the same is true of blocks
-                        obj = handleBlock(obj, infile) # we need to find all there contents
-                        section.data.append(obj) # before moving on
-                    else: # found another sub-object
-                        section.data.append(obj)                    
-            else:
-                data.append(int(line.lower().strip()))
-        else: # we have our code, now we just need to convert the data and add it to our list.
-            data.append(convert(data[0], line.strip()))
-            section.data.append(data)
-            data = []
+       """Expects [infile, drawing, section] as cargo, builds a nested section object."""
+       #print "Entering start_section state!"
+       infile = cargo[0]
+       drawing = cargo[1]
+       section = cargo[2]
+       # read each line, if it is an object declaration go to object mode
+       # otherwise create a [index, data] pair and add it to the sections data.
+       done = False
+       data = []
+       while not done:
+               line = infile.readline()
+
+               if not data: # if we haven't found a dxf code yet
+                       if line.lower().strip() == '0':
+                               # we've found an object
+                               while 1: # no way out unless we find an end section or a new section
+                                       obj = handleObject(infile)
+                                       if obj == 'section': # shouldn't happen
+                                               print "Warning: failed to close previous section!"
+                                               return end_section, (infile, drawing)
+                                       elif obj == 'endsec': # This section is over, look for the next
+                                               drawing.data.append(section)
+                                               return end_section, (infile, drawing)
+                                       elif obj.type == 'table': # tables are collections of data
+                                               obj = handleTable(obj, infile) # we need to find all there contents
+                                               section.data.append(obj) # before moving on
+                                       elif obj.type == 'block': # the same is true of blocks
+                                               obj = handleBlock(obj, infile) # we need to find all there contents
+                                               section.data.append(obj) # before moving on
+                                       else: # found another sub-object
+                                               section.data.append(obj)
+                       else:
+                               data.append(int(line.lower().strip()))
+               else: # we have our code, now we just need to convert the data and add it to our list.
+                       data.append(convert(data[0], line.strip()))
+                       section.data.append(data)
+                       data = []
 def end_section(cargo):
-    """Expects (infile, drawing) as cargo, searches for next section."""
-    #print "Entering end_section state!"
-    infile = cargo[0]
-    drawing = cargo[1]
-    section = findObject(infile, 'section')
-    if section:
-        return start_section, (infile, drawing, section)
-    else:
-        return end, (infile, drawing)
+       """Expects (infile, drawing) as cargo, searches for next section."""
+       #print "Entering end_section state!"
+       infile = cargo[0]
+       drawing = cargo[1]
+       section = findObject(infile, 'section')
+       if section:
+               return start_section, (infile, drawing, section)
+       else:
+               return end, (infile, drawing)
 
 def end(cargo):
-    """Expects (infile, drawing) as cargo, called when eof has been reached."""
-    #print "Entering end state!"
-    infile = cargo[0]
-    drawing = cargo[1]
-    #infile.close()
-    return drawing
+       """Expects (infile, drawing) as cargo, called when eof has been reached."""
+       #print "Entering end state!"
+       infile = cargo[0]
+       drawing = cargo[1]
+       #infile.close()
+       return drawing
 
 def error(cargo):
-    """Expects a (infile, string) as cargo, called when there is an error during processing."""
-    #print "Entering error state!"
-    infile = cargo[0]
-    err = cargo[1]
-    infile.close()
-    print "There has been an error:"
-    print err
-    return False
+       """Expects a (infile, string) as cargo, called when there is an error during processing."""
+       #print "Entering error state!"
+       infile = cargo[0]
+       err = cargo[1]
+       infile.close()
+       print "There has been an error:"
+       print err
+       return False
 
 def readDXF(filename, objectify):
-    """Given a file name try to read it as a dxf file.
-    
-    Output is an object with the following structure
-    drawing
-        header
-            header data
-        classes
-            class data
-        tables
-            table data
-        blocks
-            block data
-        entities
-            entity data
-        objects
-            object data
-    where foo data is a list of sub-objects.  True object data
-    is of the form [code, data].
-"""
-    infile = open(filename)
-
-    sm = StateMachine()
-    sm.add_state(error, True)
-    sm.add_state(end, True)
-    sm.add_state(start_section)
-    sm.add_state(end_section)
-    sm.add_state(start)
-    sm.set_start(start)
-    try:
-        drawing = sm.run(infile)
-        if drawing:
-            drawing.name = filename
-            for obj in drawing.data:
-                item, name = get_name(obj.data)
-                if name:
-                    obj.data.remove(item)
-                    obj.name = name.lower()
-                    setattr(drawing, name.lower(), obj)
-                    # Call the objectify function to cast
-                    # raw objects into the right types of object
-                    obj.data = objectify(obj.data)
-                #print obj.name
-    finally:
-        infile.close()
-    return drawing    
-if __name__ == "__main__":
-    filename = r".\examples\block-test.dxf"
-    drawing = readDXF(filename)
-    for item in drawing.entities.data:
-        print item
+       """Given a file name try to read it as a dxf file.
 
+       Output is an object with the following structure
+       drawing
+               header
+                       header data
+               classes
+                       class data
+               tables
+                       table data
+               blocks
+                       block data
+               entities
+                       entity data
+               objects
+                       object data
+       where foo data is a list of sub-objects.  True object data
+       is of the form [code, data].
+"""
+       infile = open(filename)
 
+       sm = StateMachine()
+       sm.add_state(error, True)
+       sm.add_state(end, True)
+       sm.add_state(start_section)
+       sm.add_state(end_section)
+       sm.add_state(start)
+       sm.set_start(start)
+       try:
+               drawing = sm.run(infile)
+               if drawing:
+                       drawing.name = filename
+                       for obj in drawing.data:
+                               item, name = get_name(obj.data)
+                               if name:
+                                       obj.data.remove(item)
+                                       obj.name = name.lower()
+                                       setattr(drawing, name.lower(), obj)
+                                       # Call the objectify function to cast
+                                       # raw objects into the right types of object
+                                       obj.data = objectify(obj.data)
+                               #print obj.name
+       finally:
+               infile.close()
+       return drawing
+if __name__ == "__main__":
+       filename = r".\examples\block-test.dxf"
+       drawing = readDXF(filename)
+       for item in drawing.entities.data:
+               print item
index eb3be80c99c55182590a59a661f75468f0e38036..82f95e976e12c55ef7170893c9c035c3b9d1071e 100644 (file)
@@ -3,9 +3,6 @@
 Name: 'VRML97 (.wrl)...'
 Blender: 241
 Group: 'Export'
-Submenu: 'All Objects...' all
-Submenu: 'All Objects compressed...' comp
-Submenu: 'Selected Objects...' selected
 Tooltip: 'Export to VRML97 file (.wrl)'
 """
 
@@ -55,7 +52,7 @@ want to export only selected or all relevant objects.
 
 import Blender
 from Blender import Object, Mesh, Lamp, Draw, BGL, \
-        Image, Text, sys, Mathutils
+        Image, Text, sys, Mathutils, Registry
 from Blender.Scene import Render
 
 import math
@@ -70,8 +67,9 @@ worldmat = Blender.Texture.Get()
 filename = Blender.Get('filename')
 _safeOverwrite = True
 extension = ''
-ARG=''
 
+# Matrices below are used only when export_rotate_z_to_y.val:
+#
 # Blender is Z up, VRML is Y up, both are right hand coordinate
 # systems, so to go from Blender coords to VRML coords we rotate
 # by 90 degrees around the X axis. In matrix notation, we have a
@@ -633,12 +631,10 @@ class VRML2Export:
                meshVertexList = me.verts
 
                for vertex in meshVertexList:
-                       blenvert = Mathutils.Vector(vertex.co)
-                       vrmlvert = M_blen2vrml * blenvert
-                       self.writeUnindented("%s %s %s\n " % \
-                                                                (vrmlvert[0], \
-                                                                 vrmlvert[1], \
-                                                                 vrmlvert[2]))
+                       vrmlvert = vertex.co
+                       if export_rotate_z_to_y.val:
+                               vrmlvert = M_blen2vrml * vrmlvert
+                       self.writeUnindented("%s %s %s\n " % (vrmlvert[0], vrmlvert[1], vrmlvert[2]))
                self.writeIndented("]\n", -1)
                self.writeIndented("}\n", -1)
                self.writeIndented("\n")
@@ -1016,7 +1012,10 @@ class VRML2Export:
                        return
 
                ob_matrix = Mathutils.Matrix(ob.getMatrix('worldspace'))
-               matrix = M_blen2vrml * ob_matrix * M_vrml2blen
+               if export_rotate_z_to_y.val:
+                       matrix = M_blen2vrml * ob_matrix * M_vrml2blen
+               else:
+                       matrix = ob_matrix
                e      = matrix.rotationPart().toEuler()
 
                v = matrix.translationPart()
@@ -1089,7 +1088,7 @@ class VRML2Export:
                self.writeFog()
                self.proto = 0
                allObj = []
-               if ARG == 'selected':
+               if export_selection_only.val:
                        allObj = list(scene.objects.context)
                else:
                        allObj = list(scene.objects)
@@ -1098,7 +1097,7 @@ class VRML2Export:
                for thisObj in allObj:
                        self.writeObject(thisObj)
 
-               if ARG != 'selected':
+               if not export_selection_only.val:
                        self.writeScript()
                self.cleanup()
 
@@ -1213,26 +1212,58 @@ def select_file(filename):
        wrlexport=VRML2Export(filename)
        wrlexport.export(scene, world, worldmat)
 
+#########################################################
+# UI and Registry utilities
+#########################################################
+
+export_selection_only = Draw.Create(0)
+export_rotate_z_to_y = Draw.Create(0)
+export_compressed = Draw.Create(0)
+
+def save_to_registry():
+       d = {}
+       d['selection_only'] = export_selection_only.val
+       d['rotate_z_to_y'] = export_rotate_z_to_y.val
+       d['compressed'] = export_compressed.val
+       Registry.SetKey('vrml97_export', d, True)
+
+def load_from_registry():
+       d = Registry.GetKey('vrml97_export', True)
+       if d:
+               try:
+                       export_selection_only.val = d['selection_only']
+                       export_rotate_z_to_y.val = d['rotate_z_to_y']
+                       export_compressed.val = d['compressed']
+               except: save_to_registry() # If data is not valid, rewrite it.
+
+def show_popup():
+       pup_block = [
+               ('Selection Only', export_selection_only, 'Only export objects in visible selection. Else export whole scene.'),
+               ('Rotate +Z to +Y', export_rotate_z_to_y, 'Rotate such that +Z axis (Blender up) becomes +Y (VRML up).'),
+               ('Compress', export_compressed, 'Generate a .wrz file (normal VRML compressed by gzip).')
+               ]
+       return Draw.PupBlock('Export VRML 97...', pup_block) 
 
 #########################################################
 # main routine
 #########################################################
 
-try:
-       ARG = __script__['arg'] # user selected argument
-except:
-       print "older version"
-
-if Blender.Get('version') < 235:
-       print "Warning: VRML97 export failed, wrong blender version!"
-       print " You aren't running blender version 2.35 or greater"
-       print " download a newer version from http://blender3d.org/"
-else:
-       if ARG == 'comp':
-               extension=".wrz"
-               from gzip import *
+load_from_registry()
+
+# Note that show_popup must be done before Blender.Window.FileSelector,
+# because export_compressed affects the suggested extension of resulting
+# file.
+
+if show_popup():
+       save_to_registry()
+       if export_compressed.val:
+               try:
+                       extension=".wrz"
+                       from gzip import *
+               except:
+                       print "could not import gzip, file will be exported uncompressed"
+                       pass
        else:
                extension=".wrl"
        Blender.Window.FileSelector(select_file, "Export VRML97", \
                                                                sys.makename(ext=extension))
-
index ac4a8e9ca5be2a0d0e3b6acabc70cf4d35f6070b..b12ff67d8a606842d8851cfbce7c506900c910aa 100644 (file)
@@ -57,6 +57,8 @@ import Blender
 from Blender import Object, Lamp, Draw, Image, Text, sys, Mesh
 from Blender.Scene import Render
 import math
+import BPyObject
+import BPyMesh
 
 # 
 DEG2RAD=0.017453292519943295
@@ -68,14 +70,14 @@ MATWORLD= Blender.Mathutils.RotationMatrix(-90, 4, 'x')
 
 filename = Blender.Get('filename')
 _safeOverwrite = True
-ARG=''
+
 extension = ''
 
 ##########################################################
 # Functions for writing output file
 ##########################################################
 
-class VRML2Export:
+class x3d_class:
 
        def __init__(self, filename):
                #--- public you can change these ---
@@ -101,7 +103,18 @@ class VRML2Export:
                self.meshNames={}   # dictionary of meshNames
                self.indentLevel=0 # keeps track of current indenting
                self.filename=filename
-               self.file = open(filename, "w")
+               self.file = None
+               if filename.lower().endswith('.x3dz'):
+                       try:
+                               import gzip
+                               self.file = gzip.open(filename, "w")                            
+                       except:
+                               print "failed to import compression modules, exporting uncompressed"
+                               self.filename = filename[:-1] # remove trailing z
+               
+               if self.file == None:
+                       self.file = open(self.filename, "w")
+
                self.bNav=0
                self.nodeID=0
                self.namesReserved=[ "Anchor","Appearance","Arc2D","ArcClose2D","AudioClip","Background","Billboard",
@@ -169,7 +182,7 @@ class VRML2Export:
                                        nameinline = nameinline+".x3d"
                                        self.file.write("url=\"%s\" />" % nameinline)
                                        self.file.write("\n\n")
-       '''
+
        
        def writeScript(self):
                textEditor = Blender.Text.Get() 
@@ -190,15 +203,17 @@ class VRML2Export:
                                        for j in xrange(nalllines):
                                                self.writeIndented(alllines[j] + "\n")
                self.writeIndented("\n")
-
-       def writeViewpoint(self, ob, scene):
+       '''
+       
+       def writeViewpoint(self, ob, mat, scene):
                context = scene.render
                ratio = float(context.imageSizeY())/float(context.imageSizeX())
                lens = (360* (math.atan(ratio *16 / ob.data.getLens()) / math.pi))*(math.pi/180)
                lens = min(lens, math.pi) 
                
                # get the camera location, subtract 90 degress from X to orient like X3D does
-               mat = ob.matrixWorld
+               # mat = ob.matrixWorld - mat is now passed!
+               
                loc = self.rotatePointForVRML(mat.translationPart())
                rot = mat.toEuler()
                rot = (((rot[0]-90)*DEG2RAD), rot[1]*DEG2RAD, rot[2]*DEG2RAD)
@@ -229,23 +244,11 @@ class VRML2Export:
                        self.file.write("visibilityRange=\"%s\" />\n\n" % round(mparam[2],self.cp))
                else:
                        return
-       '''
+       
        def writeNavigationInfo(self, scene):
-               allObj = []
-               allObj = list(scene.objects)
-               headlight = "true"
-               vislimit = 0.0
-               for ob in allObj:
-                       objType=ob.type
-                       if objType == "Camera":
-                               vislimit = ob.data.clipEnd
-                       elif objType == "Lamp":
-                               headlight = "false"
-               self.file.write("<NavigationInfo headlight=\"%s\" " % headlight)
-               self.file.write("visibilityLimit=\"%s\" " % (round(vislimit,self.cp)))
-               self.file.write("type=\"EXAMINE\", \"ANY\" avatarSize=\"0.25, 1.75, 0.75\" />\n\n")
-       '''
-       def writeSpotLight(self, ob, lamp, world):
+               self.file.write('<NavigationInfo headlight="FALSE" visibilityLimit="0.0" type=\'"EXAMINE","ANY"\' avatarSize="0.25, 1.75, 0.75" />\n')
+       
+       def writeSpotLight(self, ob, mtx, lamp, world):
                safeName = self.cleanStr(ob.name)
                if world:
                        ambi = world.amb
@@ -259,12 +262,14 @@ class VRML2Export:
                beamWidth=((lamp.spotSize*math.pi)/180.0)*.37;
                cutOffAngle=beamWidth*1.3
 
-               dx,dy,dz=self.computeDirection(ob)
+               dx,dy,dz=self.computeDirection(mtx)
                # note -dx seems to equal om[3][0]
                # note -dz seems to equal om[3][1]
                # note  dy seems to equal om[3][2]
 
-               location=(ob.matrixWorld*MATWORLD).translationPart()
+               #location=(ob.matrixWorld*MATWORLD).translationPart() # now passed
+               location=(mtx*MATWORLD).translationPart()
+               
                radius = lamp.dist*math.cos(beamWidth)
                self.file.write("<SpotLight DEF=\"%s\" " % safeName)
                self.file.write("radius=\"%s\" " % (round(radius,self.cp)))
@@ -277,7 +282,7 @@ class VRML2Export:
                self.file.write("location=\"%s %s %s\" />\n\n" % (round(location[0],3), round(location[1],3), round(location[2],3)))
                
                
-       def writeDirectionalLight(self, ob, lamp, world):
+       def writeDirectionalLight(self, ob, mtx, lamp, world):
                safeName = self.cleanStr(ob.name)
                if world:
                        ambi = world.amb
@@ -287,14 +292,14 @@ class VRML2Export:
                        ambientIntensity = 0
 
                intensity=min(lamp.energy/1.75,1.0) 
-               (dx,dy,dz)=self.computeDirection(ob)
+               (dx,dy,dz)=self.computeDirection(mtx)
                self.file.write("<DirectionalLight DEF=\"%s\" " % safeName)
                self.file.write("ambientIntensity=\"%s\" " % (round(ambientIntensity,self.cp)))
                self.file.write("color=\"%s %s %s\" " % (round(lamp.col[0],self.cp), round(lamp.col[1],self.cp), round(lamp.col[2],self.cp)))
                self.file.write("intensity=\"%s\" " % (round(intensity,self.cp)))
                self.file.write("direction=\"%s %s %s\" />\n\n" % (round(dx,4),round(dy,4),round(dz,4)))
 
-       def writePointLight(self, ob, lamp, world):
+       def writePointLight(self, ob, mtx, lamp, world):
                safeName = self.cleanStr(ob.name)
                if world:
                        ambi = world.amb
@@ -303,29 +308,30 @@ class VRML2Export:
                        ambi = 0
                        ambientIntensity = 0
                
-               location=(ob.matrixWorld*MATWORLD).translationPart()
-               intensity=min(lamp.energy/1.75,1.0) 
-               radius = lamp.dist
+               # location=(ob.matrixWorld*MATWORLD).translationPart() # now passed
+               location= (mtx*MATWORLD).translationPart()
+               
                self.file.write("<PointLight DEF=\"%s\" " % safeName)
                self.file.write("ambientIntensity=\"%s\" " % (round(ambientIntensity,self.cp)))
                self.file.write("color=\"%s %s %s\" " % (round(lamp.col[0],self.cp), round(lamp.col[1],self.cp), round(lamp.col[2],self.cp)))
-               self.file.write("intensity=\"%s\" " % (round(intensity,self.cp)))
-               self.file.write("radius=\"%s\" " % radius )
+               self.file.write("intensity=\"%s\" " % (round( min(lamp.energy/1.75,1.0) ,self.cp)))
+               self.file.write("radius=\"%s\" " % lamp.dist )
                self.file.write("location=\"%s %s %s\" />\n\n" % (round(location[0],3), round(location[1],3), round(location[2],3)))
-
-       def writeNode(self, ob):
+       '''
+       def writeNode(self, ob, mtx):
                obname=str(ob.name)
                if obname in self.namesStandard:
                        return
                else:
-                       dx,dy,dz = self.computeDirection(ob)
-                       location=(ob.matrixWorld*MATWORLD).translationPart()
+                       dx,dy,dz = self.computeDirection(mtx)
+                       # location=(ob.matrixWorld*MATWORLD).translationPart()
+                       location=(mtx*MATWORLD).translationPart()
                        self.writeIndented("<%s\n" % obname,1)
-                       self.writeIndented("# direction %s %s %s\n" % (round(dx,3),round(dy,3),round(dz,3)))
-                       self.writeIndented("# location %s %s %s\n" % (round(location[0],3), round(location[1],3), round(location[2],3)))
+                       self.writeIndented("direction=\"%s %s %s\"\n" % (round(dx,3),round(dy,3),round(dz,3)))
+                       self.writeIndented("location=\"%s %s %s\"\n" % (round(location[0],3), round(location[1],3), round(location[2],3)))
                        self.writeIndented("/>\n",-1)
                        self.writeIndented("\n")
-
+       '''
        def secureName(self, name):
                name = name + str(self.nodeID)
                self.nodeID=self.nodeID+1
@@ -345,13 +351,13 @@ class VRML2Export:
                                newname = name
                                return "%s" % (newname)
 
-       def writeIndexedFaceSet(self, ob, world, normals = 0):
+       def writeIndexedFaceSet(self, ob, mesh, mtx, world, EXPORT_TRI = False):
                imageMap={}   # set of used images
                sided={}          # 'one':cnt , 'two':cnt
                vColors={}      # 'multi':1
                meshName = self.cleanStr(ob.name)
-               mesh=ob.getData(mesh=1)
-               meshME = self.cleanStr(mesh.name)
+               
+               meshME = self.cleanStr(ob.getData(mesh=1).name) # We dont care if its the mesh name or not
                if len(mesh.faces) == 0: return
                mode = 0
                if mesh.faceUV:
@@ -371,7 +377,7 @@ class VRML2Export:
                elif not mode & Mesh.FaceModes.DYNAMIC and self.collnode == 0:
                        self.writeIndented("<Collision enabled=\"false\">\n",1)
                        self.collnode = 1
-
+               
                nIFSCnt=self.countIFSSetsNeeded(mesh, imageMap, sided, vColors)
                
                if nIFSCnt > 1:
@@ -382,7 +388,8 @@ class VRML2Export:
                else:
                        bTwoSided=0
 
-               mtx = ob.matrixWorld * MATWORLD
+               # mtx = ob.matrixWorld * MATWORLD # mtx is now passed
+               mtx = mtx * MATWORLD
                
                loc= mtx.translationPart()
                sca= mtx.scalePart()
@@ -456,12 +463,12 @@ class VRML2Export:
                                elif hasImageTexture == 1:
                                        self.writeTextureCoordinates(mesh)
                        #--- output coordinates
-                       self.writeCoordinates(ob, mesh, meshName)
+                       self.writeCoordinates(ob, mesh, meshName, EXPORT_TRI)
 
                        self.writingcoords = 1
                        self.writingtexture = 1
                        self.writingcolor = 1
-                       self.writeCoordinates(ob, mesh, meshName)
+                       self.writeCoordinates(ob, mesh, meshName, EXPORT_TRI)
                        
                        #--- output textureCoordinates if UV texture used
                        if mesh.faceUV:
@@ -498,17 +505,23 @@ class VRML2Export:
 
                self.file.write("\n")
 
-       def writeCoordinates(self, ob, mesh, meshName):
+       def writeCoordinates(self, ob, mesh, meshName, EXPORT_TRI = False):
                # create vertex list and pre rotate -90 degrees X for VRML
                
                if self.writingcoords == 0:
                        self.file.write('coordIndex="')
                        for face in mesh.faces:
                                fv = face.v
-                               if len(face)==4:
-                                       self.file.write("%i %i %i %i -1, " % (fv[0].index, fv[1].index, fv[2].index, fv[3].index))
+                               
+                               if len(face)==3:
+                                               self.file.write("%i %i %i -1, " % (fv[0].index, fv[1].index, fv[2].index))
                                else:
-                                       self.file.write("%i %i %i -1, " % (fv[0].index, fv[1].index, fv[2].index))
+                                       if EXPORT_TRI:
+                                               self.file.write("%i %i %i -1, " % (fv[0].index, fv[1].index, fv[2].index))
+                                               self.file.write("%i %i %i -1, " % (fv[0].index, fv[2].index, fv[3].index))
+                                       else:
+                                               self.file.write("%i %i %i %i -1, " % (fv[0].index, fv[1].index, fv[2].index, fv[3].index))
+                       
                        self.file.write("\">\n")
                else:
                        #-- vertices
@@ -679,43 +692,74 @@ class VRML2Export:
 # export routine
 ##########################################################
 
-       def export(self, scene, world, alltextures):
+       def export(self, scene, world, alltextures,\
+                       EXPORT_APPLY_MODIFIERS = False,\
+                       EXPORT_TRI=                             False,\
+               ):
+               
                print "Info: starting X3D export to " + self.filename + "..."
                self.writeHeader()
-               self.writeScript()
-               # self.writeNavigationInfo(scene) # This seems to position me in some strange area I cant see the model (with BS Contact) - Campbell
+               self.writeScript()
+               self.writeNavigationInfo(scene)
                self.writeBackground(world, alltextures)
                self.writeFog(world)
                self.proto = 0
                
-               for ob in scene.objects.context:
-                       objType=ob.type
-                       objName=ob.name
-                       self.matonly = 0
-                       if objType == "Camera":
-                               self.writeViewpoint(ob, scene)
-                       elif objType == "Mesh":
-                               self.writeIndexedFaceSet(ob, world, normals = 0)
-                       elif objType == "Lamp":
-                               data= ob.data
-                               datatype=data.type
-                               if datatype == Lamp.Types.Lamp:
-                                       self.writePointLight(ob, data, world)
-                               elif datatype == Lamp.Types.Spot:
-                                       self.writeSpotLight(ob, data, world)
-                               elif datatype == Lamp.Types.Sun:
-                                       self.writeDirectionalLight(ob, data, world)
+               
+               # COPIED FROM OBJ EXPORTER
+               if EXPORT_APPLY_MODIFIERS:
+                       temp_mesh_name = '~tmp-mesh'
+               
+                       # Get the container mesh. - used for applying modifiers and non mesh objects.
+                       containerMesh = meshName = tempMesh = None
+                       for meshName in Blender.NMesh.GetNames():
+                               if meshName.startswith(temp_mesh_name):
+                                       tempMesh = Mesh.Get(meshName)
+                                       if not tempMesh.users:
+                                               containerMesh = tempMesh
+                       if not containerMesh:
+                               containerMesh = Mesh.New(temp_mesh_name)
+               # -------------------------- 
+               
+               
+               for ob_main in scene.objects.context:
+                       for ob, ob_mat in BPyObject.getDerivedObjects(ob_main):
+                               objType=ob.type
+                               objName=ob.name
+                               self.matonly = 0
+                               if objType == "Camera":
+                                       self.writeViewpoint(ob, ob_mat, scene)
+                               elif objType in ("Mesh", "Curve", "Surf", "Text") :
+                                       if  EXPORT_APPLY_MODIFIERS or objType != 'Mesh':
+                                               me= BPyMesh.getMeshFromObject(ob, containerMesh, EXPORT_APPLY_MODIFIERS, False, scene)
+                                       else:
+                                               me = ob.getData(mesh=1)
+                                       
+                                       self.writeIndexedFaceSet(ob, me, ob_mat, world, EXPORT_TRI = EXPORT_TRI)
+                               elif objType == "Lamp":
+                                       data= ob.data
+                                       datatype=data.type
+                                       if datatype == Lamp.Types.Lamp:
+                                               self.writePointLight(ob, ob_mat, data, world)
+                                       elif datatype == Lamp.Types.Spot:
+                                               self.writeSpotLight(ob, ob_mat, data, world)
+                                       elif datatype == Lamp.Types.Sun:
+                                               self.writeDirectionalLight(ob, ob_mat, data, world)
+                                       else:
+                                               self.writeDirectionalLight(ob, ob_mat, data, world)
+                               # do you think x3d could document what to do with dummy objects?
+                               #elif objType == "Empty" and objName != "Empty":
+                               #       self.writeNode(ob, ob_mat)
                                else:
-                                       self.writeDirectionalLight(ob, data, world)
-                       elif objType == "Empty" and objName != "Empty":
-                               self.writeNode(ob)
-                       else:
-                               #print "Info: Ignoring [%s], object type [%s] not handle yet" % (object.name,object.getType)
-                               print ""
+                                       #print "Info: Ignoring [%s], object type [%s] not handle yet" % (object.name,object.getType)
+                                       pass
                
-               if ARG != 'selected':
-                       self.writeScript()
                self.file.write("\n</Scene>\n</X3D>")
+               
+               if EXPORT_APPLY_MODIFIERS:
+                       if containerMesh:
+                               containerMesh.verts = None
+               
                self.cleanup()
                
 ##########################################################
@@ -837,10 +881,10 @@ class VRML2Export:
                        round(c.b/255.0,self.cp))
                return s
 
-       def computeDirection(self, ob):
+       def computeDirection(self, mtx):
                x,y,z=(0,-1.0,0) # point down
                
-               ax,ay,az = (ob.matrixWorld*MATWORLD).toEuler()
+               ax,ay,az = (mtx*MATWORLD).toEuler()
                
                ax *= DEG2RAD
                ay *= DEG2RAD
@@ -931,7 +975,36 @@ class VRML2Export:
 # Callbacks, needed before Main
 ##########################################################
 
-def select_file(filename):
+def x3d_export(filename, \
+               EXPORT_APPLY_MODIFIERS= False,\
+               EXPORT_TRI=                             False,\
+               EXPORT_GZIP=                    False,\
+       ):
+       
+       if EXPORT_GZIP:
+               if not filename.lower().endswith('.x3dz'):
+                       filename = '.'.join(filename.split('.')[:-1]) + '.x3dz'
+       else:
+               if not filename.lower().endswith('.x3d'):
+                       filename = '.'.join(filename.split('.')[:-1]) + '.x3d'
+       
+       
+       scene = Blender.Scene.GetCurrent()
+       world = scene.world
+       alltextures = Blender.Texture.Get()
+
+       wrlexport=x3d_class(filename)
+       wrlexport.export(\
+               scene,\
+               world,\
+               alltextures,\
+               \
+               EXPORT_APPLY_MODIFIERS = EXPORT_APPLY_MODIFIERS,\
+               EXPORT_TRI = EXPORT_TRI,\
+               )
+
+
+def x3d_export_ui(filename):
        if not filename.endswith(extension):
                filename += extension
        #if _safeOverwrite and sys.exists(filename):
@@ -939,18 +1012,40 @@ def select_file(filename):
        #if(result != 1):
        #       return
        
-       scene = Blender.Scene.GetCurrent()
-       world = scene.world
-       alltextures = Blender.Texture.Get()
+       # Get user options
+       EXPORT_APPLY_MODIFIERS = Draw.Create(1)
+       EXPORT_TRI = Draw.Create(0)
+       EXPORT_GZIP = Draw.Create( filename.lower().endswith('.x3dz') )
+       
+       # Get USER Options
+       pup_block = [\
+       ('Apply Modifiers', EXPORT_APPLY_MODIFIERS, 'Use transformed mesh data from each object.'),\
+       ('Triangulate', EXPORT_TRI, 'Triangulate quads.'),\
+       ('Compress', EXPORT_GZIP, 'GZip the resulting file, requires a full python install'),\
+       ]
+
+       if not Draw.PupBlock('Export...', pup_block):
+               return
+
+       Blender.Window.EditMode(0)
+       Blender.Window.WaitCursor(1)
+       
+       x3d_export(filename,\
+               EXPORT_APPLY_MODIFIERS = EXPORT_APPLY_MODIFIERS.val,\
+               EXPORT_TRI = EXPORT_TRI.val,\
+               EXPORT_GZIP = EXPORT_GZIP.val\
+       )
+       
+       Blender.Window.WaitCursor(0)
 
-       wrlexport=VRML2Export(filename)
-       wrlexport.export(scene, world, alltextures)
 
 
 #########################################################
 # main routine
 #########################################################
 
+
 if __name__ == '__main__':
-       Blender.Window.FileSelector(select_file,"Export X3D", Blender.Get('filename').replace('.blend', '.x3d'))
-       # select_file('/shared/bed1.x3d')
+       Blender.Window.FileSelector(x3d_export_ui,"Export X3D", Blender.Get('filename').replace('.blend', '.x3d'))
+
+
index e5dffbf532d4aa5120849e104aa3ee6a580a397a..5ebff3bbbf5b8e9026fcb1542f5980bf37b7c0c0 100644 (file)
@@ -315,12 +315,10 @@ ifeq ($(WITH_BF_BLENDERPLAYER), true)
 endif
 
 ifeq ($(WITH_BF_WEBPLUGIN), true)
-    ifneq ($(NAN_NO_PLUGIN), true)
-        BINTARGETS += plugin
-        ifeq ($(OS),linux)
-            ifeq ($(CPU),i386)
-                 BINTARGETS += xplink
-             endif
+    BINTARGETS += plugin
+    ifeq ($(OS),linux)
+        ifeq ($(CPU),i386)
+             BINTARGETS += xplink
         endif
     endif
 endif
index 291dd70c801f7c81aba190a7c223c18695babea1..c913820205b4ac8cadb66fb6174f2b40414fe355 100644 (file)
@@ -355,7 +355,7 @@ TimeMarker *get_frame_marker(int frame){return 0;};
 
 /* editseq.c */
 Sequence *get_forground_frame_seq(int frame){return 0;};
-void set_last_seq(Sequence *seq){return 0;};
+void set_last_seq(Sequence *seq){};
 
 /* modifier.c stub */
 void harmonic_coordinates_bind(struct MeshDeformModifierData *mmd,
index c4df1db7627b3d9192e5b7bc3f84ea3ce1a314ef..5fb3d6f869a707bedeb4cf14aa1bd4b39257587b 100644 (file)
@@ -489,11 +489,11 @@ static float get_actionstrip_frame(bActionStrip *strip, float cframe, int invert
 {
        float length, actlength, repeat, scale;
        
-       if(strip->repeat == 0.0f) strip->repeat = 1.0f;
+       if (strip->repeat == 0.0f) strip->repeat = 1.0f;
        repeat = (strip->flag & ACTSTRIP_USESTRIDE) ? (1.0f) : (strip->repeat);
        
-       if(strip->scale == 0.0f) strip->scale= 1.0f;
-       scale = abs(strip->scale); /* scale must be positive (for now) */
+       if (strip->scale == 0.0f) strip->scale= 1.0f;
+       scale = fabs(strip->scale); /* scale must be positive (for now) */
        
        actlength = strip->actend-strip->actstart;
        if (actlength == 0.0f) actlength = 1.0f;
index 8533175ad37f2d2a8e783df143f59584aa6886ca..974754968656a4def51f9474502fd0b29f3e6182 100644 (file)
@@ -337,6 +337,7 @@ static void frames_duplilist(ListBase *lb, Object *ob, int level, int animated)
 {
        extern int enable_cu_speed;     /* object.c */
        Object copyob;
+       DupliObject *dob;
        int cfrao, ok;
        
        /* simple preventing of too deep nested groups */
@@ -360,7 +361,8 @@ static void frames_duplilist(ListBase *lb, Object *ob, int level, int animated)
                if(ok) {
                        do_ob_ipo(ob);
                        where_is_object_time(ob, (float)G.scene->r.cfra);
-                       new_dupli_object(lb, ob, ob->obmat, ob->lay, G.scene->r.cfra, OB_DUPLIFRAMES, animated);
+                       dob= new_dupli_object(lb, ob, ob->obmat, ob->lay, G.scene->r.cfra, OB_DUPLIFRAMES, animated);
+                       Mat4CpyMat4(dob->omat, copyob.obmat);
                }
        }
 
@@ -723,7 +725,7 @@ static void face_duplilist(ListBase *lb, ID *id, Object *par, float par_space_ma
 static void new_particle_duplilist(ListBase *lb, ID *id, Object *par, float par_space_mat[][4], ParticleSystem *psys, int level, int animated)
 {
        GroupObject *go;
-       Object *ob=0, **oblist=0;
+       Object *ob=0, **oblist=0, obcopy, *obcopylist=0;
        DupliObject *dob;
        ParticleSettings *part;
        ParticleData *pa;
@@ -733,7 +735,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Object *par, float par_
        ParticleSystemModifierData *psmd;
        float ctime, pa_time, scale = 1.0f;
        float tmat[4][4], mat[4][4], obrotmat[4][4], pamat[4][4], size=0.0;
-       float (*obmat)[4];
+       float (*obmat)[4], (*oldobmat)[4];
        float xvec[3] = {-1.0, 0.0, 0.0}, q[4];
        int lay, a, b, k, step_nbr = 0, counter, hair = 0;
        int totpart, totchild, totgroup=0, pa_num;
@@ -758,7 +760,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Object *par, float par_
        totchild = psys->totchild;
 
        BLI_srandom(31415926 + psys->seed);
-               
+       
        lay= G.scene->lay;
        if((part->draw_as == PART_DRAW_OB && part->dup_ob) ||
                (part->draw_as == PART_DRAW_GR && part->dup_group && part->dup_group->gobject.first)) {
@@ -778,49 +780,55 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Object *par, float par_
 
                psys->lattice = psys_get_lattice(par, psys);
 
+               /* gather list of objects or single object */
                if(part->draw_as==PART_DRAW_GR) {
                        group_handle_recalc_and_update(par, part->dup_group);
 
-                       go= part->dup_group->gobject.first;
-                       while(go) {
-                               go=go->next;
+                       for(go=part->dup_group->gobject.first; go; go=go->next)
                                totgroup++;
-                       }
 
-                       oblist= MEM_callocN(totgroup*sizeof(Object *), "dupgroup object list");
-                       go= part->dup_group->gobject.first;
-                       for(a=0; a<totgroup; a++, go=go->next)
-                               oblist[a]=go->ob;
+                       /* we also copy the actual objects to restore afterwards, since
+                        * where_is_object_time will change the object which breaks transform */
+                       oblist = MEM_callocN(totgroup*sizeof(Object *), "dupgroup object list");
+                       obcopylist = MEM_callocN(totgroup*sizeof(Object), "dupgroup copy list");
+
+                       go = part->dup_group->gobject.first;
+                       for(a=0; a<totgroup; a++, go=go->next) {
+                               oblist[a] = go->ob;
+                               obcopylist[a] = *go->ob;
+                       }
                }
-               else
+               else {
                        ob = part->dup_ob;
+                       obcopy = *ob;
+               }
 
                if(totchild==0 || part->draw & PART_DRAW_PARENT)
-                       a=0;
+                       a = 0;
                else
-                       a=totpart;
+                       a = totpart;
 
                for(pa=psys->particles,counter=0; a<totpart+totchild; a++,pa++,counter++) {
                        if(a<totpart) {
+                               /* handle parent particle */
                                if(pa->flag & (PARS_UNEXIST+PARS_NO_DISP))
                                        continue;
 
-                               pa_num=pa->num;
-
-                               pa_time=pa->time;
-
-                               size=pa->size;
+                               pa_num = pa->num;
+                               pa_time = pa->time;
+                               size = pa->size;
                        }
                        else {
-                               /* TODO: figure these two out */
-                               cpa= &psys->child[a - totpart];
+                               /* handle child particle */
+                               cpa = &psys->child[a - totpart];
+
                                pa_num = a;
                                pa_time = psys->particles[cpa->parent].time;
-
-                               size=psys_get_child_size(psys, cpa, ctime, 0);
+                               size = psys_get_child_size(psys, cpa, ctime, 0);
                        }
 
                        if(part->draw_as==PART_DRAW_GR) {
+                               /* for groups, pick the object based on settings */
                                if(part->draw&PART_DRAW_RAND_GR)
                                        b= BLI_rand() % totgroup;
                                else if(part->from==PART_FROM_PARTICLE)
@@ -829,13 +837,17 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Object *par, float par_
                                        b= a % totgroup;
 
                                ob = oblist[b];
-                               obmat= oblist[b]->obmat;
+                               obmat = oblist[b]->obmat;
+                               oldobmat = obcopylist[b].obmat;
                        }
-                       else
+                       else {
                                obmat= ob->obmat;
+                               oldobmat= obcopy.obmat;
+                       }
 
                        for(k=0; k<=step_nbr; k++, counter++) {
                                if(hair) {
+                                       /* hair we handle separate and compute transform based on hair keys */
                                        if(a < totpart) {
                                                cache = psys->pathcache[a];
                                                psys_get_dupli_path_transform(par, psys, psmd, pa, 0, cache, pamat, &scale);
@@ -848,6 +860,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Object *par, float par_
                                        VECCOPY(pamat[3], cache->co);
                                }
                                else if(step_nbr) {
+                                       /* other keys */
                                        state.time = (float)k / (float)step_nbr;
                                        psys_get_particle_on_path(par, psys, a, &state, 0);
 
@@ -856,6 +869,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Object *par, float par_
                                        pamat[3][3]= 1.0f;
                                }
                                else {
+                                       /* first key */
                                        state.time = -1.0;
                                        if(psys_get_particle_state(par, psys, a, &state, 0) == 0)
                                                continue;
@@ -876,6 +890,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Object *par, float par_
                                                        Mat4CpyMat4(mat, tmat);
 
                                                dob= new_dupli_object(lb, go->ob, mat, par->lay, counter, OB_DUPLIPARTS, animated);
+                                               Mat4CpyMat4(dob->omat, oldobmat);
                                                if(G.rendering)
                                                        psys_get_dupli_texture(par, part, psmd, pa, cpa, dob->uv, dob->orco);
                                        }
@@ -901,14 +916,27 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Object *par, float par_
                                                Mat4CpyMat4(mat, tmat);
 
                                        dob= new_dupli_object(lb, ob, mat, par->lay, counter, OB_DUPLIPARTS, animated);
+                                       Mat4CpyMat4(dob->omat, oldobmat);
                                        if(G.rendering)
                                                psys_get_dupli_texture(par, part, psmd, pa, cpa, dob->uv, dob->orco);
                                }
                        }
                }
+
+               /* restore objects since they were changed in where_is_object_time */
+               if(part->draw_as==PART_DRAW_GR) {
+                       for(a=0; a<totgroup; a++)
+                               *(oblist[a])= obcopylist[a];
+               }
+               else
+                       *ob= obcopy;
        }
+
+       /* clean up */
        if(oblist)
                MEM_freeN(oblist);
+       if(obcopylist)
+               MEM_freeN(obcopylist);
 
        if(psys->lattice) {
                end_latt_deform();
index 230b7080b38668fb23129ef14c6068a6c91712b3..81f496e97d6dfbdeb518b2a3e0305e1e4980dc23 100644 (file)
@@ -383,7 +383,8 @@ static void setup_app_data(BlendFileData *bfd, char *filename)
        /* special cases, override loaded flags: */
        if (G.f & G_DEBUG) bfd->globalf |= G_DEBUG;
        else bfd->globalf &= ~G_DEBUG;
-       if (!(G.f & G_DOSCRIPTLINKS)) bfd->globalf &= ~G_DOSCRIPTLINKS;
+
+       if ((U.flag & USER_DONT_DOSCRIPTLINKS)) bfd->globalf &= ~G_DOSCRIPTLINKS;
 
        G.f= bfd->globalf;
 
index 0b9f7615bfa821c1d8d8bb391b54a510bd6e11a1..321d4f1d37e0b23d53c66446a4ff5e7f2dc49706 100644 (file)
@@ -1917,6 +1917,9 @@ void set_icu_vars(IpoCurve *icu)
                        icu->ymin= 0.0;
                        break;
                case PART_CLUMP:
+                       icu->ymin= -1.0;
+                       icu->ymax= 1.0;
+                       break;
                case PART_DRAG:
                case PART_DAMP:
                case PART_LENGTH:
@@ -1926,6 +1929,7 @@ void set_icu_vars(IpoCurve *icu)
                case PART_KINK_SHAPE:
                        icu->ymin= -0.999;
                        icu->ymax= 0.999;
+                       break;
                }
        }
        else if(icu->blocktype==ID_CO) {
index 16916381c95b74c364d2b7e4bc46be29264d706a..0cd7736f6c3f694b47ee711bc8104a6d9cf161a9 100644 (file)
@@ -1363,8 +1363,9 @@ void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
                                        out_v = mbproc->function(out.x, out.y, out.z);
 
                                        /* find "first points" on Implicit Surface of MetaElemnt ml */
-                                       //converge(&in, &out, in_v, out_v, mbproc->function, &mbproc->start, mb, 0);
-                                       workp = in;
+                                       workp.x = in.x;
+                                       workp.y = in.y;
+                                       workp.z = in.z;
                                        workp_v = in_v;
                                        max_len = sqrt((out.x-in.x)*(out.x-in.x) + (out.y-in.y)*(out.y-in.y) + (out.z-in.z)*(out.z-in.z));
 
index 194ce65cd86cddc37070b41cf1126254a5519767..19b7ed194ebef823c887b29ed0dff4883c50a68d 100644 (file)
@@ -1507,7 +1507,8 @@ static DerivedMesh *mirrorModifier_applyModifier(
 
        result = mirrorModifier__doMirror(mmd, ob, derivedData, 0);
 
-       CDDM_calc_normals(result);
+       if(result != derivedData)
+               CDDM_calc_normals(result);
        
        return result;
 }
@@ -5515,6 +5516,7 @@ static void particleSystemModifier_deformVerts(
        DerivedMesh *dm = derivedData;
        ParticleSystemModifierData *psmd= (ParticleSystemModifierData*) md;
        ParticleSystem * psys=0;
+       Mesh *me;
        int needsFree=0;
 
        if(ob->particlesystem.first)
@@ -5522,6 +5524,14 @@ static void particleSystemModifier_deformVerts(
        else
                return;
        
+       /* multires check */
+       if(ob->type == OB_MESH) {
+               me= (Mesh*)ob->data;
+               if(me->mr && me->mr->current != 1)
+                       modifier_setError(md,
+                               "Particles only supported on first multires level.");
+       }
+
        if(!psys_check_enabled(ob, psys))
                return;
 
index 1eb47fa3da058975c9c74776db5543fabfaf19b5..fec3da752ff6bdb576b88be4c04649bcf29236dc 100644 (file)
@@ -152,6 +152,49 @@ char *psys_menu_string(Object *ob, int for_sb)
 
        return str;
 }
+
+/* we allocate path cache memory in chunks instead of a big continguous
+ * chunk, windows' memory allocater fails to find big blocks of memory often */
+
+#define PATH_CACHE_BUF_SIZE 1024
+
+static ParticleCacheKey **psys_alloc_path_cache_buffers(ListBase *bufs, int tot, int steps)
+{
+       LinkData *buf;
+       ParticleCacheKey **cache;
+       int i, totkey, totbufkey;
+
+       tot= MAX2(tot, 1);
+       totkey = 0;
+       cache = MEM_callocN(tot*sizeof(void*), "PathCacheArray");
+
+       while(totkey < tot) {
+               totbufkey= MIN2(tot-totkey, PATH_CACHE_BUF_SIZE);
+               buf= MEM_callocN(sizeof(LinkData), "PathCacheLinkData");
+               buf->data= MEM_callocN(sizeof(ParticleCacheKey)*totbufkey*steps, "ParticleCacheKey");
+
+               for(i=0; i<totbufkey; i++)
+                       cache[totkey+i] = ((ParticleCacheKey*)buf->data) + i*steps;
+
+               totkey += totbufkey;
+               BLI_addtail(bufs, buf);
+       }
+
+       return cache;
+}
+
+static void psys_free_path_cache_buffers(ParticleCacheKey **cache, ListBase *bufs)
+{
+       LinkData *buf;
+
+       if(cache)
+               MEM_freeN(cache);
+
+       for(buf= bufs->first; buf; buf=buf->next)
+               MEM_freeN(buf->data);
+       BLI_freelistN(bufs);
+}
+
 /************************************************/
 /*                     Getting stuff                                           */
 /************************************************/
@@ -250,10 +293,17 @@ int psys_in_edit_mode(ParticleSystem *psys)
 int psys_check_enabled(Object *ob, ParticleSystem *psys)
 {
        ParticleSystemModifierData *psmd;
+       Mesh *me;
 
        if(psys->flag & PSYS_DISABLED)
                return 0;
 
+       if(ob->type == OB_MESH) {
+               me= (Mesh*)ob->data;
+               if(me->mr && me->mr->current != 1)
+                       return 0;
+       }
+
        psmd= psys_get_modifier(ob, psys);
        if(psys->renderdata) {
                if(!(psmd->modifier.mode & eModifierMode_Render))
@@ -299,27 +349,16 @@ void free_keyed_keys(ParticleSystem *psys)
 }
 void free_child_path_cache(ParticleSystem *psys)
 {
-       if(psys->childcache){
-               if(psys->childcache[0])
-                       MEM_freeN(psys->childcache[0]);
-
-               MEM_freeN(psys->childcache);
-
-               psys->childcache = NULL;
-               psys->totchildcache = 0;
-       }
+       psys_free_path_cache_buffers(psys->childcache, &psys->childcachebufs);
+       psys->childcache = NULL;
+       psys->totchildcache = 0;
 }
 void psys_free_path_cache(ParticleSystem *psys)
 {
-       if(psys->pathcache){
-               if(psys->pathcache[0])
-                       MEM_freeN(psys->pathcache[0]);
-
-               MEM_freeN(psys->pathcache);
+       psys_free_path_cache_buffers(psys->pathcache, &psys->pathcachebufs);
+       psys->pathcache= NULL;
+       psys->totcached= 0;
 
-               psys->pathcache = NULL;
-               psys->totcached = 0;
-       }
        free_child_path_cache(psys);
 }
 void psys_free_children(ParticleSystem *psys)
@@ -2250,10 +2289,9 @@ void psys_cache_child_paths(Object *ob, ParticleSystem *psys, float cfra, int ed
        ParticleSettings *part = psys->part;
        ParticleThread *pthreads;
        ParticleThreadContext *ctx;
-       ParticleCacheKey **cache, *tcache;
+       ParticleCacheKey **cache;
        ListBase threads;
        int i, totchild, totparent, totthread;
-       unsigned long totchildstep;
 
        pthreads= psys_threads_create(ob, psys);
 
@@ -2272,13 +2310,7 @@ void psys_cache_child_paths(Object *ob, ParticleSystem *psys, float cfra, int ed
        else {
                /* clear out old and create new empty path cache */
                free_child_path_cache(psys);
-
-               cache = psys->childcache = MEM_callocN(totchild*sizeof(void *), "Child path cache array");
-               totchildstep= totchild*(ctx->steps + 1);
-               tcache = MEM_callocN(totchildstep*sizeof(ParticleCacheKey), "Child path cache");
-               for(i=0; i<totchild; i++)
-                       cache[i] = tcache + i * (ctx->steps + 1);
-
+               psys->childcache= psys_alloc_path_cache_buffers(&psys->childcachebufs, totchild, ctx->steps+1);
                psys->totchildcache = totchild;
        }
 
@@ -2365,12 +2397,8 @@ void psys_cache_paths(Object *ob, ParticleSystem *psys, float cfra, int editupda
        else {
                /* clear out old and create new empty path cache */
                psys_free_path_cache(psys);
-
-               /* allocate cache array for fast access and set pointers to contiguous mem block */
-               cache = psys->pathcache = MEM_callocN(MAX2(1, totpart) * sizeof(void *), "Path cache array");
-               cache[0] = MEM_callocN(totpart * (steps + 1) * sizeof(ParticleCacheKey), "Path cache");
-               for(i=1; i<totpart; i++)
-                       cache[i] = cache[0] + i * (steps + 1);
+               cache= psys_alloc_path_cache_buffers(&psys->pathcachebufs, totpart, steps+1);
+               psys->pathcache= cache;
        }
 
        if(edit==NULL && psys->soft && psys->softflag & OB_SB_ENABLE)
index 9dd21cdda4ea6b9d2f28e3766ad6faebb8d84f29..596c381b8964cdad9b3510ebcc18563af68ec74e 100644 (file)
@@ -4763,6 +4763,9 @@ static void system_step(Object *ob, ParticleSystem *psys, ParticleSystemModifier
                                psys_update_path_cache(ob,psmd,psys,framenr);
                        }
 
+                       cache->simframe= framenr;
+                       cache->flag |= PTCACHE_SIMULATION_VALID;
+
                        return;
                }
                else if(ob->id.lib || (cache->flag & PTCACHE_BAKED)) {
index 5337a932e792a2547bcb045b647bd5c15f8690a0..d2da0cce4e364e0a612446a5de7883d7dc95a5a9 100644 (file)
@@ -423,7 +423,6 @@ static float nearest_point_in_tri_surface(const float *point, const float *v0, c
  */
 static void bruteforce_shrinkwrap_calc_nearest_surface_point(DerivedMesh *target, float *co, float *unused)
 {
-       //TODO: this should use raycast code probably existent in blender
        float minDist = FLT_MAX;
        float orig_co[3];
 
index 24606bd822fe30ea1546d04b535f79d5a5677df3..8d315ba37e132973942a3263fc9a3ee5119536ac 100644 (file)
@@ -2615,6 +2615,8 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
                psys->edit = 0;
                psys->pathcache = 0;
                psys->childcache = 0;
+               psys->pathcachebufs.first = psys->pathcachebufs.last = 0;
+               psys->childcachebufs.first = psys->childcachebufs.last = 0;
                psys->reactevents.first = psys->reactevents.last = 0;
 
                psys->pointcache= newdataadr(fd, psys->pointcache);
index 4f2a1da5580c758e154f09999ebde9ecb11e21b1..632a471ecd01dc41e627212bb2e3d074e5e79ecb 100644 (file)
@@ -305,13 +305,11 @@ static int isffmpeg (char *filename) {
         /* Find the decoder for the video stream */
        pCodec=avcodec_find_decoder(pCodecCtx->codec_id);
        if(pCodec==NULL) {
-               avcodec_close(pCodecCtx);
                av_close_input_file(pFormatCtx);
                return 0;
        }
 
        if(avcodec_open(pCodecCtx, pCodec)<0) {
-               avcodec_close(pCodecCtx);
                av_close_input_file(pFormatCtx);
                return 0;
        }
index fb6b65c39729cc3946d125cf6c156f0025c9a4c6..58b344981cae02d8bda0d313781e7e83965cec97 100644 (file)
@@ -32,6 +32,7 @@
 
 struct MTFace;
 struct EditFace;
+struct EditEdge;
 struct Mesh;
 struct MCol;
 
@@ -53,6 +54,8 @@ void uv_autocalc_tface(void);
 void set_texturepaint(void);
 void get_same_uv(void);  
 void seam_mark_clear_tface(short mode);
-
+int edgetag_shortest_path(struct EditEdge *source, struct EditEdge *target);
+void edgetag_context_set(struct EditEdge *eed, int val);
+int edgetag_context_check(struct EditEdge *eed);
 #endif /* BDR_EDITFACE_H */
 
index a3a3b7531d6bdffa14e6556444df08b3997d679b..cbd547602e1af124a0b586e1d0d9a94e23aefad1 100644 (file)
@@ -34,6 +34,7 @@ struct ScrArea;
 struct ID;
 
 void free_imasel(struct SpaceImaSel *simasel);
+void reset_imaselspace(struct ScrArea *sa);
 
 void clever_numbuts_imasel(void);
 
index 24747b9f220c96373885d4ba7497a0e2d0f5ed8c..fbd4e4ecd91b642532bf5e8c32b1bc67ef45637b 100644 (file)
@@ -164,6 +164,7 @@ struct AutoComplete;
 #define BUT_TOGDUAL (33<<9)
 #define ICONTOGN (34<<9)
 #define FTPREVIEW (35<<9)
+#define NUMABS (36<<9)
 #define BUTTYPE        (63<<9)
 
 
index 09ce87015d949246739bf5b0cb93d94de0c9da8d..be1f5581be7bd00b10a91b2595d0ef51213057b7 100644 (file)
@@ -46,7 +46,7 @@ void do_viewbuts(unsigned short event);
 /* View3DAfter->type */
 #define V3D_XRAY       1
 #define V3D_TRANSP     2
-void add_view3d_after(struct View3D *v3d, struct Base *base, int type);
+void add_view3d_after(struct View3D *v3d, struct Base *base, int type, int flag);
 
 void backdrawview3d(int test);
 void check_backbuf(void);
index 13e38d50c4763943d765502c733eee37ff602770..b46b2328ea46daa8411c370dc17e749aa2752817 100644 (file)
@@ -54,6 +54,7 @@ void activate_databrowse(struct ID *id, int idcode, int fromcode, int retval, sh
 void activate_databrowse_args(struct ID *id, int idcode, int fromcode, short *menup, void (*func)(char *, void *, void *), void *arg1, void *arg2);
 
 void filesel_prevspace(void);
+void reset_filespace(struct ScrArea *sa);
 void free_filesel_spec(char *dir);
 void winqreadfilespace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
 void main_to_filelist(struct SpaceFile *sfile);   
index 8122cdd9cc7b898932249147c89ad7d2f07a9a8e..e5f781a3365da253dc21371f57c8e5f6ce3ad801 100644 (file)
@@ -171,24 +171,24 @@ typedef struct ParticleSettings {
 typedef struct ParticleSystem{
        struct ParticleSystem *next, *prev;
 
-       ParticleSettings *part;
+       ParticleSettings *part;                                 /* particle settings */
 
-       ParticleData *particles;
+       ParticleData *particles;                                /* (parent) particles */
+       ChildParticle *child;                                   /* child particles */
 
-       ChildParticle *child;
+       struct ParticleEdit *edit;                              /* particle editmode (runtime) */
 
-       struct ParticleEdit *edit;
+       struct ParticleCacheKey **pathcache;    /* path cache (runtime) */
+       struct ParticleCacheKey **childcache;   /* child cache (runtime) */
+       ListBase pathcachebufs, childcachebufs; /* buffers for the above */
 
-       struct ParticleCacheKey **pathcache;
-       struct ParticleCacheKey **childcache;
-
-       struct SoftBody *soft;
+       struct SoftBody *soft;                                  /* hair softbody */
 
        struct Object *target_ob;
        struct Object *keyed_ob;
        struct Object *lattice;
 
-       struct ListBase effectors, reactevents;
+       struct ListBase effectors, reactevents; /* runtime */
        
        float imat[4][4];       /* used for duplicators */
        float cfra;
@@ -196,10 +196,10 @@ typedef struct ParticleSystem{
        int flag, totpart, totchild, totcached, totchildcache, rt;
        short recalc, target_psys, keyed_psys, totkeyed, softflag, bakespace;
 
-       char bb_uvname[3][32];
+       char bb_uvname[3][32];                                  /* billboard uv name */
 
        /* if you change these remember to update array lengths to PSYS_TOT_VG! */
-       short vgroup[11], vg_neg, rt3[2];
+       short vgroup[11], vg_neg, rt3[2];               /* vertex groups */
 
        /* temporary storage during render */
        void *renderdata;
index e0e8c351d2ce2235033a401113fbcb747140f4c7..45833695ffe8d088078537ecd7bdabe2be710956 100644 (file)
@@ -437,7 +437,9 @@ typedef struct ToolSettings {
        char  skgen_postpro_passes;
        char  skgen_subdivisions[3];
        
-       char pad3[5];
+       /* Alt+RMB option */
+       char edge_mode;
+       char pad3[4];
 } ToolSettings;
 
 /* Used by all brushes to store their properties, which can be directly set
@@ -783,6 +785,13 @@ typedef struct Scene {
 #define UVCALC_FILLHOLES                       1
 #define UVCALC_NO_ASPECT_CORRECT       2       /* would call this UVCALC_ASPECT_CORRECT, except it should be default with old file */
 
+/* toolsettings->edge_mode */
+#define EDGE_MODE_SELECT                               0
+#define EDGE_MODE_TAG_SEAM                             1
+#define EDGE_MODE_TAG_SHARP                            2
+#define EDGE_MODE_TAG_CREASE                   3
+#define EDGE_MODE_TAG_BEVEL                            4
+
 /* toolsettings->particle flag */
 #define PE_KEEP_LENGTHS                        1
 #define PE_LOCK_FIRST                  2
index c45571cb5834673c78d2c16f47a24b1eef0f019e..acc1651e9fa8af2862a048ecf559d1834f251bd1 100644 (file)
@@ -224,7 +224,7 @@ extern UserDef U; /* from usiblender.c !!!! */
 #define USER_DUPLILINK                 (1 << 6)
 #define USER_FSCOLLUM                  (1 << 7)
 #define USER_MAT_ON_OB                 (1 << 8)
-#define USER_NO_CAPSLOCK               (1 << 9)
+/*#define USER_NO_CAPSLOCK             (1 << 9)*/ /* not used anywhere */
 #define USER_VIEWMOVE                  (1 << 10)
 #define USER_TOOLTIPS                  (1 << 11)
 #define USER_TWOBUTTONMOUSE            (1 << 12)
@@ -236,7 +236,8 @@ extern UserDef U; /* from usiblender.c !!!! */
 #define USER_ADD_EDITMODE              (1 << 18)
 #define USER_ADD_VIEWALIGNED   (1 << 19)
 #define USER_RELPATHS                  (1 << 20)
-#define USER_DRAGIMMEDIATE                     (1 << 21)
+#define USER_DRAGIMMEDIATE             (1 << 21)
+#define USER_DONT_DOSCRIPTLINKS        (1 << 22)
 
 /* viewzom */
 #define USER_ZOOM_CONT                 0
index eeddb4ce756527a9907d9ffa11a4cd5260b31c5f..92614d1cc6ab160acd2d34a47105f3badb1fe8e9 100644 (file)
@@ -52,9 +52,7 @@ static void do_hue_sat_fac(bNode *node, float *out, float *in, float *fac)
                hsv[0]+= (nhs->hue - 0.5f);
                if(hsv[0]>1.0) hsv[0]-=1.0; else if(hsv[0]<0.0) hsv[0]+= 1.0;
                hsv[1]*= nhs->sat;
-               if(hsv[1]>1.0) hsv[1]= 1.0; else if(hsv[1]<0.0) hsv[1]= 0.0;
                hsv[2]*= nhs->val;
-               if(hsv[2]>1.0) hsv[2]= 1.0; else if(hsv[2]<0.0) hsv[2]= 0.0;
                hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
                
                out[0]= mfac*in[0] + *fac*col[0];
index 8c07a2d1dc869667e28ba49514b48423d92efc17..67dfc6190802936c645fc5e85a5d817588bc3611 100644 (file)
@@ -54,9 +54,7 @@ static void do_hue_sat_fac(bNode *node, float *out, float *hue, float *sat, floa
                hsv[0]+= (*hue - 0.5f);
                if(hsv[0]>1.0) hsv[0]-=1.0; else if(hsv[0]<0.0) hsv[0]+= 1.0;
                hsv[1]*= *sat;
-               if(hsv[1]>1.0) hsv[1]= 1.0; else if(hsv[1]<0.0) hsv[1]= 0.0;
                hsv[2]*= *val;
-               if(hsv[2]>1.0) hsv[2]= 1.0; else if(hsv[2]<0.0) hsv[2]= 0.0;
                hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
                
                out[0]= mfac*in[0] + *fac*col[0];
index ffdb593767a84016df681129532c1e5c993e272f..1496495e5aaae03f18ab516681336191d45ba3bd 100644 (file)
@@ -435,19 +435,24 @@ void BPY_rebuild_syspath( void )
        if(U.pythondir[0] != '\0' ) {
                char modpath[FILE_MAX];
                int upyslen = strlen(U.pythondir);
-
+               BLI_strncpy(dirpath, U.pythondir, FILE_MAX);
+               
                /* check if user pydir ends with a slash and, if so, remove the slash
                 * (for eventual implementations of c library's stat function that might
                 * not like it) */
-               if (upyslen > 2) { /* avoids doing anything if dir == '//' */
-                       BLI_add_slash(U.pythondir);
+#ifdef WIN32
+               if (upyslen > 3) {
+#else if
+               if (upyslen > 1) {
+#endif
+                       if (dirpath[upyslen-1] == '\\' || dirpath[upyslen-1] == '/') {
+                               dirpath[upyslen-1] = '\0';
+                       }
                }
 
-               BLI_strncpy(dirpath, U.pythondir, FILE_MAX);
                BLI_convertstringcode(dirpath, G.sce);
                syspath_append(dirpath);        /* append to module search path */
-
-               BLI_make_file_string("/", modpath, dirpath, "bpymodules");
+               BLI_join_dirfile( modpath, dirpath, "bpymodules" );
                if (BLI_exists(modpath)) syspath_append(modpath);
        }
        
index daba0c36fdf4fe3ceaceb6241d091864854e7a25..4fc68d138e06b9e60972b4dd3a219a99a58e5464 100644 (file)
@@ -246,7 +246,8 @@ static PyObject *Blender_Set( PyObject * self, PyObject * args )
                        return EXPP_ReturnPyObjError( PyExc_ValueError,
                                        "expected an integer" );
 
-               G.scene->r.cfra = (short)PyInt_AsLong( arg ) ;
+               G.scene->r.cfra = (int)PyInt_AsLong( arg ) ;
+               CLAMP(G.scene->r.cfra, 1, MAXFRAME);
 
                /*      update all objects, so python scripts can export all objects
                 in a scene without worrying about the view layers */
@@ -545,8 +546,12 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
        else if(StringEqual( str, "compressfile" ))
                ret = PyInt_FromLong( (U.flag & USER_FILECOMPRESS) >> 15  );
        else if(StringEqual( str, "mipmap" ))
-               ret = PyInt_FromLong( (U.gameflags & USER_DISABLE_MIPMAP) == 0  );
-       else
+               ret = PyInt_FromLong( (U.gameflags & USER_DISABLE_MIPMAP)!=0  );
+       else if(StringEqual( str, "add_view_align" ))
+               ret = PyInt_FromLong( ((U.flag & USER_ADD_VIEWALIGNED)!=0)  );
+       else if(StringEqual( str, "add_editmode" ))
+               ret = PyInt_FromLong( ((U.flag & USER_ADD_EDITMODE)!=0)  );
+       else 
                return EXPP_ReturnPyObjError( PyExc_AttributeError, "unknown attribute" );
 
        if (ret) return ret;
index 79deb29bafa319ec76f7b76d3a3105b8045f0ccc..818c58109f3b2786881f061a0542f019ac4df516 100644 (file)
 #define EXPP_MAT_FRESNELMIRR_MAX                       5.0
 #define EXPP_MAT_FRESNELMIRRFAC_MIN                    1.0
 #define EXPP_MAT_FRESNELMIRRFAC_MAX                    5.0
+#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_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_FILTER_MIN                    0.0
 #define EXPP_MAT_FILTER_MAX                    1.0
 #define EXPP_MAT_TRANSLUCENCY_MIN                      0.0
@@ -516,6 +524,10 @@ static int Material_setIOR( BPy_Material * self, PyObject * value );
 static int Material_setTransDepth( BPy_Material * self, PyObject * value );
 static int Material_setFresnelTrans( BPy_Material * self, PyObject * value );
 static int Material_setFresnelTransFac( BPy_Material * self, PyObject * value );
+static int Material_setGlossMirr( BPy_Material * self, PyObject * value );
+static int Material_setGlossMirrSamples( BPy_Material * self, PyObject * value );
+static int Material_setGlossTrans( BPy_Material * self, PyObject * value );
+static int Material_setGlossTransSamples( BPy_Material * self, PyObject * value );
 static int Material_setRigidBodyFriction( BPy_Material * self, PyObject * value );
 static int Material_setRigidBodyRestitution( BPy_Material * self, PyObject * value );
 
@@ -600,6 +612,10 @@ static PyObject *Material_getIOR( BPy_Material * self );
 static PyObject *Material_getTransDepth( BPy_Material * self );
 static PyObject *Material_getFresnelTrans( BPy_Material * self );
 static PyObject *Material_getFresnelTransFac( BPy_Material * self );
+static PyObject *Material_getGlossMirr( BPy_Material * self );
+static PyObject *Material_getGlossMirrSamples( BPy_Material * self );
+static PyObject *Material_getGlossTrans( BPy_Material * self );
+static PyObject *Material_getGlossTransSamples( BPy_Material * self );
 static PyObject *Material_getRigidBodyFriction( BPy_Material * self );
 static PyObject *Material_getRigidBodyRestitution( BPy_Material * self );
 
@@ -720,6 +736,10 @@ static PyMethodDef BPy_Material_methods[] = {
         "() - Return fresnel power for refractions"},
        {"getFresnelMirrFac", ( PyCFunction ) Material_getFresnelMirrFac, METH_NOARGS,
         "() - Return fresnel power for refractions factor"},
+       {"getRayTransGloss", ( PyCFunction ) Material_getGlossTrans, METH_NOARGS,
+        "() - Return amount refraction glossiness"},
+       {"getRayMirrGlossSamples", ( PyCFunction ) Material_getGlossMirrSamples, METH_NOARGS,
+        "() - Return amount mirror glossiness"},
        {"getFilter", ( PyCFunction ) Material_getFilter, METH_NOARGS,
         "() - Return the amount of filtering when transparent raytrace is enabled"},
        {"getTranslucency", ( PyCFunction ) Material_getTranslucency, METH_NOARGS,
@@ -825,6 +845,10 @@ static PyMethodDef BPy_Material_methods[] = {
         "(f) - Set fresnel power for mirror - [0.0, 5.0]"},
        {"setFresnelMirrFac", ( PyCFunction ) Matr_oldsetFresnelMirrFac, METH_VARARGS,
         "(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]"},
+       {"setRayMirrGlossSamples", ( PyCFunction ) Material_setGlossMirrSamples, METH_VARARGS,
+        "(f) - Set amount mirror glossiness - [0.0, 1.0]"},
        {"setFilter", ( PyCFunction ) Matr_oldsetFilter, METH_VARARGS,
         "(f) - Set the amount of filtering when transparent raytrace is enabled"},
        {"setTranslucency", ( PyCFunction ) Matr_oldsetTranslucency, METH_VARARGS,
@@ -1030,6 +1054,22 @@ static PyGetSetDef BPy_Material_getseters[] = {
         (getter)Material_getRefracIndex, (setter)Material_setRefracIndex,
         "Material's Index of Refraction (applies to the \"Blinn\" Specular Shader only",
         NULL},
+       {"glossMir",
+        (getter)Material_getGlossMirr, (setter)Material_setGlossMirr,
+        "Reflection glossiness",
+        NULL},
+       {"sampGlossMir",
+        (getter)Material_getGlossMirrSamples, (setter)Material_setGlossMirrSamples,
+        "Reflection glossiness",
+        NULL},
+       {"glossTra",
+        (getter)Material_getGlossTrans, (setter)Material_setGlossTrans,
+        "Refraction glossiness",
+        NULL},
+       {"sampGlossTra",
+        (getter)Material_getGlossMirrSamples, (setter)Material_setGlossMirrSamples,
+        "Refraction glossiness",
+        NULL},
        {"rgbCol",
         (getter)Material_getRGBCol, (setter)Material_setRGBCol,
         "Diffuse RGB color triplet",
@@ -1578,6 +1618,26 @@ static PyObject *Material_getFresnelTransFac( BPy_Material * self )
        return PyFloat_FromDouble( ( double ) self->material->fresnel_tra_i );
 }
 
+static PyObject *Material_getGlossMirr( BPy_Material * self )
+{
+       return PyFloat_FromDouble( ( double ) self->material->gloss_mir );
+}
+
+static PyObject *Material_getGlossMirrSamples( BPy_Material * self )
+{
+       return PyInt_FromLong( ( long ) self->material->samp_gloss_mir );
+}
+
+static PyObject *Material_getGlossTrans( BPy_Material * self )
+{
+       return PyFloat_FromDouble( ( double ) self->material->gloss_tra );
+}
+
+static PyObject *Material_getGlossTransSamples( BPy_Material * self )
+{
+       return PyInt_FromLong( ( long ) self->material->samp_gloss_tra );
+}
+
 static PyObject* Material_getRigidBodyFriction( BPy_Material * self )
 {
        return PyFloat_FromDouble( ( double ) self->material->friction );
@@ -2058,6 +2118,34 @@ static int Material_setFresnelTransFac( BPy_Material * self, PyObject * value )
                                                                EXPP_MAT_FRESNELTRANSFAC_MAX );
 }
 
+static int Material_setGlossMirr( BPy_Material * self, PyObject * value )
+{
+       return EXPP_setFloatClamped ( value, &self->material->gloss_mir,
+                                                               EXPP_MAT_RAYMIRRGLOSS_MIN,
+                                                               EXPP_MAT_RAYMIRRGLOSS_MAX );
+}
+
+static int Material_setGlossMirrSamples( BPy_Material * self, PyObject * value )
+{
+       return EXPP_setIValueClamped ( value, &self->material->samp_gloss_mir,
+                                                               EXPP_MAT_RAYMIRRGLOSSSAMPLES_MIN,
+                                                               EXPP_MAT_RAYMIRRGLOSSSAMPLES_MAX, 'h' );
+}
+
+static int Material_setGlossTrans( BPy_Material * self, PyObject * value )
+{
+       return EXPP_setFloatClamped ( value, &self->material->gloss_tra,
+                                                               EXPP_MAT_RAYTRANSPGLOSS_MIN,
+                                                               EXPP_MAT_RAYTRANSPGLOSS_MAX );
+}
+
+static int Material_setGlossTransSamples( BPy_Material * self, PyObject * value )
+{
+       return EXPP_setIValueClamped ( value, &self->material->samp_gloss_tra,
+                                                               EXPP_MAT_RAYTRANSPGLOSSSAMPLES_MIN,
+                                                               EXPP_MAT_RAYTRANSPGLOSSSAMPLES_MAX, 'h' );
+}
+
 static int Material_setRigidBodyFriction( BPy_Material * self, PyObject * value )
 {
        return EXPP_setFloatClamped ( value, &self->material->friction,
index 9de4e344e8cc8daa0e964ed37bb35d881d99d2af..3863cc12227605c679a469925e214540400cf1aa 100644 (file)
@@ -58,6 +58,7 @@ static PyObject *M_sys_exists( PyObject * self, PyObject * value );
 static PyObject *M_sys_time( PyObject * self );
 static PyObject *M_sys_sleep( PyObject * self, PyObject * args );
 static PyObject *M_sys_expandpath( PyObject *self, PyObject *value);
+static PyObject *M_sys_cleanpath( PyObject *self, PyObject *value);
 
 /*****************************************************************************/
 /* The following string definitions are used for documentation strings.      */
@@ -120,10 +121,13 @@ static char M_sys_expandpath_doc[] =
 (path) - the string path to convert.\n\n\
 Note: internally Blender paths can contain two special character sequences:\n\
 - '//' (at start) for base path directory (the current .blend's dir path);\n\
-- '#' (at ending) for current frame number.\n\n\
+- '#' characters in the filename will be replaced by the frame number.\n\n\
 This function expands these to their actual content, returning a valid path.\n\
 If the special chars are not found in the given path, it is simply returned.";
 
+static char M_sys_cleanpath_doc[] =
+"(path) - Removes parts of a path that are not needed paths such as '../foo/../bar/' and '//./././'";
+
 /*****************************************************************************/
 /* Python method structure definition for Blender.sys module:                */
 /*****************************************************************************/
@@ -139,6 +143,7 @@ struct PyMethodDef M_sys_methods[] = {
        {"sleep", M_sys_sleep, METH_VARARGS, M_sys_sleep_doc},
        {"time", ( PyCFunction ) M_sys_time, METH_NOARGS, M_sys_time_doc},
        {"expandpath", M_sys_expandpath, METH_O, M_sys_expandpath_doc},
+       {"cleanpath", M_sys_cleanpath, METH_O, M_sys_cleanpath_doc},
        {NULL, NULL, 0, NULL}
 };
 
@@ -396,3 +401,24 @@ static PyObject *M_sys_expandpath( PyObject * self, PyObject * value )
 
        return PyString_FromString(expanded);
 }
+
+static PyObject *M_sys_cleanpath( PyObject * self, PyObject * value )
+{
+       char *path = PyString_AsString(value);
+       char cleaned[FILE_MAXDIR + FILE_MAXFILE];
+       int trailing_slash = 0;
+       if (!path)
+               return EXPP_ReturnPyObjError( PyExc_TypeError,
+                       "expected string argument" );
+       if (strstr(path, "/") || strstr(path, "\\")) {
+               trailing_slash = 1;
+       }
+       BLI_strncpy(cleaned, path, FILE_MAXDIR + FILE_MAXFILE);
+       BLI_cleanup_file(NULL, cleaned);
+       
+       if (trailing_slash) {
+               BLI_add_slash(cleaned);
+       }
+       
+       return PyString_FromString(cleaned);
+}
index edcdbbb959b6be555f2cbbf1872b6f9cd6224da1..a3496164cd19b9abe5fc6894a7b1e3dfdbe84c6f 100644 (file)
@@ -237,6 +237,18 @@ class Material:
        @ivar rayMirr:  Mirror reflection amount for raytrace.
        Value is clamped to the range [0.0,1.0].
        @type rayMirr:  float
+       @ivar glossMir: Amount of reflection glossy.
+       Value is clamped to the range [0.0,1.0].
+       @type glossMir: float
+       @ivar sampGloss_mir: Reflection glossy samples.
+       Value is clamped to the range [1,1024].
+       @type sampGloss_mir: int
+       @ivar glossTra: Amount of refraction glossy.
+       Value is clamped to the range [0.0,1.0].
+       @type glossTra: float
+       @ivar sampGlossTra: Refraction glossy samples.
+       Value is clamped to the range [1,1024].
+       @type sampGlossTra: int
        @ivar rayMirrDepth:  Amount of raytrace inter-reflections.
        Value is clamped to the range [0,10].
        @type rayMirrDepth:  int
index f1efeeb2344a1d2550e12be7f129808e378cf996..d7c62f2cb020cda4bac2d2a20007a3e536518da9 100644 (file)
@@ -153,7 +153,7 @@ def expandpath (path):
   Internally, Blender recognizes two special character sequences in paths:
     - '//' (used at the beginning): means base path -- the current .blend file's
       dir;
-    - '#' (used at the end): means current frame number.
+    - '#' characters in the filename will be replaced by the frame number.
   The expanded string can be passed to generic python functions that don't
   understand Blender's internal relative paths.
   @note: this function is also useful for obtaining the name of the image
@@ -165,3 +165,12 @@ def expandpath (path):
   @rtype: string
   @return: the expanded (if necessary) path.
   """
+
+def cleanpath (path):
+  """
+  Clean the given 'path' by removing unneeded components such as "/./" and "/test/../"
+  @type path: string
+  @param path: a path name.
+  @rtype: string
+  @return: the cleaned (if necessary) path.
+  """
diff --git a/source/blender/python/api2_2x/doc/epy_docgen-3.sh b/source/blender/python/api2_2x/doc/epy_docgen-3.sh
deleted file mode 100644 (file)
index ce2bdfe..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# epy_docgen.sh
-# generates blender python doc using epydoc
-# requires epydoc in your PATH.
-# run from the doc directory containing the .py files
-# usage:  sh epy_docgen.sh
-
-# set posix locale so regex works properly for [A-Z]*.py
-LC_ALL=POSIX
-
-epydoc -v -o BPY_API --url "http://www.blender.org" --top API_intro \
- --name "Blender" --no-private --no-frames \
-$( ls [A-Z]*.py )
index d709ee73190f6afa8500751bac6e131de40e76e0..8cbebf82f8dbb16097901a9e70ec6c3daeecaecd 100644 (file)
@@ -7,6 +7,5 @@
 # set posix locale so regex works properly for [A-Z]*.py
 LC_ALL=POSIX
 
-epydoc -o BPY_API --url "http://www.blender.org" -t API_intro.py \
- -n "Blender" --no-private --no-frames \
-$( ls [A-Z]*.py )
+epydoc -v  -o BPY_API --url "http://www.blender.org" --top API_intro \
+ --name "Blender" --no-private --no-frames [A-Z]*.py 
index 26151ff8b9158c75cb7aa417c80dadbd54637095..12d0efa59e85b8f2dac90cc95bce3ccaf96a77e5 100644 (file)
@@ -158,6 +158,7 @@ static Render *envmap_render_copy(Render *re, EnvMap *env)
        envre->totinstance= re->totinstance;
        envre->instancetable= re->instancetable;
        envre->objectinstance= re->objectinstance;
+       envre->qmcsamplers= re->qmcsamplers;
        
        return envre;
 }
@@ -178,6 +179,7 @@ static void envmap_free_render_copy(Render *envre)
        envre->raytree= NULL;
        envre->instancetable.first= envre->instancetable.last= NULL;
        envre->objectinstance= NULL;
+       envre->qmcsamplers= NULL;
        
        RE_FreeRender(envre);
 }
index a18a973979a6b2d2ce316e1d5ceedff1eb47d63d..9357a060f6200f6726a495d658c6e5cbaf9128c5 100644 (file)
@@ -849,7 +849,7 @@ static void convert_to_key_alpha(RenderPart *pa, float *rectf)
 }
 
 /* adds only alpha values */
-void edge_enhance_tile(RenderPart *pa, float *rectf)   
+void edge_enhance_tile(RenderPart *pa, float *rectf, int *rectz)
 {
        /* use zbuffer to define edges, add it to the image */
        int y, x, col, *rz, *rz1, *rz2, *rz3;
@@ -857,13 +857,13 @@ void edge_enhance_tile(RenderPart *pa, float *rectf)
        float *rf;
        
        /* shift values in zbuffer 4 to the right (anti overflows), for filter we need multiplying with 12 max */
-       rz= pa->rectz;
+       rz= rectz;
        if(rz==NULL) return;
        
        for(y=0; y<pa->recty; y++)
                for(x=0; x<pa->rectx; x++, rz++) (*rz)>>= 4;
        
-       rz1= pa->rectz;
+       rz1= rectz;
        rz2= rz1+pa->rectx;
        rz3= rz2+pa->rectx;
        
@@ -903,7 +903,7 @@ void edge_enhance_tile(RenderPart *pa, float *rectf)
        }
        
        /* shift back zbuf values, we might need it still */
-       rz= pa->rectz;
+       rz= rectz;
        for(y=0; y<pa->recty; y++)
                for(x=0; x<pa->rectx; x++, rz++) (*rz)<<= 4;
        
@@ -1012,7 +1012,7 @@ void make_pixelstructs(RenderPart *pa, ZSpan *zspan, int sample, void *data)
 
        if(sdata->rl->layflag & SCE_LAY_EDGE) 
                if(R.r.mode & R_EDGE) 
-                       edge_enhance_tile(pa, sdata->edgerect);
+                       edge_enhance_tile(pa, sdata->edgerect, zspan->rectz);
 }
 
 /* main call for shading Delta Accum, for OSA */
@@ -1189,7 +1189,7 @@ void zbufshade_tile(RenderPart *pa)
                        if(rl->layflag & SCE_LAY_EDGE) {
                                if(R.r.mode & R_EDGE) {
                                        edgerect= MEM_callocN(sizeof(float)*pa->rectx*pa->recty, "rectedge");
-                                       edge_enhance_tile(pa, edgerect);
+                                       edge_enhance_tile(pa, edgerect, pa->rectz);
                                }
                        }
                        
index 9f14db2f42519f619436c18940069227e04ea338..0928042729a5c65a26cf3fb467e3246e43fbb567 100644 (file)
@@ -477,8 +477,12 @@ static float area_lamp_energy_multisample(LampRen *lar, float *co, float *vn)
        float *jitlamp= lar->jitter, vec[3];
        float area[4][3], intens= 0.0f;
        int a= lar->ray_totsamp;
-       
-       
+
+       /* test if co is behind lamp */
+       VECSUB(vec, co, lar->co);
+       if(INPR(vec, lar->vec) < 0.0f)
+               return 0.0f;
+
        while(a--) {
                vec[0]= jitlamp[0];
                vec[1]= jitlamp[1];
index 68712da0b6116346af6490675e1a902ab2ce437a..41727cc387c17368606442c765c44571bfe3c3c9 100644 (file)
@@ -5092,6 +5092,10 @@ static void editing_panel_mesh_tools1(Object *ob, Mesh *me)
        
        uiBlockEndAlign(block);
        
+       uiDefButBitS(block, TOG, B_MESH_X_MIRROR, B_DIFF, "X-axis mirror",1125,0,150,19, &G.scene->toolsettings->editbutflag, 0, 0, 0, 0, "While using transforms, mirrors the transformation");
+       
+       uiDefButC(block, MENU, REDRAWBUTSEDIT, "Edge Alt-Select Mode%t|Loop Select%x0|Tag Edges (Seam)%x1|Tag Edges (Sharp)%x2|Tag Edges (Crease)%x3|Tag Edges (Bevel)%x4",1125,88,150,19, &G.scene->toolsettings->edge_mode, 0, 0, 0, 0, "Operation to use when Alt+RMB on edges, Use Alt+Shift+RMB to tag the shortest path from the active edge");
+       
        uiBlockBeginAlign(block);
        uiDefButBitI(block, TOG, G_ALLEDGES, 0, "All Edges",                    1125, 22,150,19, &G.f, 0, 0, 0, 0, "Displays all edges in object mode without optimization");
        uiDefButBitS(block, TOG, B_MESH_X_MIRROR, B_DIFF, "X-axis mirror",1125,0,150,19, &G.scene->toolsettings->editbutflag, 0, 0, 0, 0, "While using transforms, mirrors the transformation");
index 37becdc89122f4f005d9345fd3278d573773fa39..c71caa082e78e4b0a965913a1855a880aebbdedc 100644 (file)
@@ -3010,6 +3010,16 @@ void do_effects_panels(unsigned short event)
        case B_PART_INIT_CHILD:
        case B_PART_RECALC_CHILD:
                if(psys) {
+                       nr=0;
+                       for(psys=ob->particlesystem.first; psys; psys=psys->next){
+                               if(ELEM(psys->part->draw_as,PART_DRAW_OB,PART_DRAW_GR))
+                                       nr++;
+                       }
+                       if(nr)
+                               ob->transflag |= OB_DUPLIPARTS;
+                       else
+                               ob->transflag &= ~OB_DUPLIPARTS;
+
                        DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
                        allqueue(REDRAWVIEW3D, 0);
                        allqueue(REDRAWBUTSOBJECT, 0);
@@ -3412,9 +3422,9 @@ static void object_panel_fields(Object *ob)
                                uiBlockEndAlign(block);
                        }
                        else{
-                               uiDefButS(block, MENU, B_FIELD_DEP, "Fall-off%t|Cone%x2|Tube%x1|Sphere%x0",     160,180,140,20, &pd->falloff, 0.0, 0.0, 0, 0, tipstr);
+                               uiDefButS(block, MENU, B_FIELD_DEP, "Fall-off%t|Cone%x2|Tube%x1|Sphere%x0",     160,180,140,20, &pd->falloff, 0.0, 0.0, 0, 0, "Fall-off shape");
                                if(pd->falloff==PFIELD_FALL_TUBE)
-                                       uiDefBut(block, LABEL, 0, "Lognitudinal",               160,160,70,20, NULL, 0.0, 0, 0, 0, "");
+                                       uiDefBut(block, LABEL, 0, "Longitudinal",               160,160,140,20, NULL, 0.0, 0, 0, 0, "");
                                uiBlockBeginAlign(block);
                                uiDefButBitS(block, TOG, PFIELD_POSZ, B_FIELD_CHANGE, "Pos",    160,140,40,20, &pd->flag, 0.0, 0, 0, 0, "Effect only in direction of positive Z axis");
                                uiDefButF(block, NUM, B_FIELD_CHANGE, "Fall-off: ",     200,140,100,20, &pd->f_power, 0, 10, 10, 0, "Falloff power (real gravitational falloff = 2)");
@@ -4405,8 +4415,8 @@ static void object_panel_particle_visual(Object *ob)
                                uiDefButS(block, NUM, B_PART_RECALC, "Steps:",  butx,(buty+=buth),butw,buth, &part->draw_step, 0.0, 7.0, 0, 0, "How many steps paths are drawn with (power of 2)");
                                uiDefButS(block, NUM, B_PART_REDRAW, "Render:", butx,(buty-=buth),butw,buth, &part->ren_step, 0.0, 9.0, 0, 0, "How many steps paths are rendered with (power of 2)");
 
-                               uiDefButBitI(block, TOG, PART_ABS_LENGTH, B_PART_RECALC, "Abs Length",   butx,(buty-=buth),butw,buth, &part->flag, 0, 0, 0, 0, "Use maximum length in absolute blender units");
-                               uiDefButF(block, NUM, B_PART_RECALC, "Max Length:",             butx,(buty-=buth),butw,buth, &part->abslength, 0.0, 10000.0, 1, 3, "Absolute path length");
+                               uiDefButBitI(block, TOG, PART_ABS_LENGTH, B_PART_RECALC, "Abs Length",   butx,(buty-=buth),butw,buth, &part->flag, 0, 0, 0, 0, "Use maximum length for children");
+                               uiDefButF(block, NUM, B_PART_RECALC, "Max Length:",             butx,(buty-=buth),butw,buth, &part->abslength, 0.0, 10000.0, 1, 3, "Absolute maximum path length for children, in blender units");
                                uiDefButF(block, NUMSLI, B_PART_RECALC, "RLength:",             butx,(buty-=buth),butw,buth, &part->randlength, 0.0, 1.0, 1, 3, "Give path length a random variation");
                                uiBlockEndAlign(block);
 
index 891bf488d17e8db0f829eb7467274432bc41bcfa..e93f7391e321131902bfb03e45dda2e89ce5edcd 100644 (file)
@@ -308,11 +308,33 @@ static void draw_imasel_bookmarks(ScrArea *sa, SpaceImaSel *simasel)
                                        BIF_ThemeColor(TH_TEXT);
                                }
                                ui_rasterpos_safe(sx, sy, simasel->aspect);
+
+                               /* handling of international fonts.
+                                       TODO: proper support for utf8 in languages different from ja_JP abd zh_CH
+                                       needs update of iconv in lib/windows to support getting the system language string
+                               */
+#ifdef WITH_ICONV
+                               {
+                                       struct LANGMenuEntry *lme;
+                                       lme = find_language(U.language);
+
+                                       if ((lme !=NULL) && (!strcmp(lme->code, "ja_JP") || 
+                                               !strcmp(lme->code, "zh_CN")))
+                                       {
+                                               BIF_RasterPos(sx, sy);
 #ifdef WIN32
-                               BIF_DrawString(simasel->curfont, sname, ((U.transopts & USER_TR_MENUS) | CONVERT_TO_UTF8));
+                                               BIF_DrawString(simasel->curfont, sname, ((U.transopts & USER_TR_MENUS) | CONVERT_TO_UTF8));
 #else
-                               BIF_DrawString(simasel->curfont, sname, (U.transopts & USER_TR_MENUS));
+                                               BIF_DrawString(simasel->curfont, sname, (U.transopts & USER_TR_MENUS));
 #endif
+                                       } else {
+                                               BMF_DrawString(simasel->curfont, sname);
+                                       }
+                               }
+#else
+                               BMF_DrawString(simasel->curfont, sname);
+#endif /* WITH_ICONV */
+
                                sy -= linestep;
                        } else {
                                cpack(0xB0B0B0);
index fba55f7f30849237fcb71329e73e009bf1bd880f..083d10fd4840cb01a46e919487f700c246c19043 100644 (file)
@@ -490,39 +490,42 @@ void do_nlabuts(unsigned short event)
                allqueue (REDRAWNLA, 0);
                allqueue (REDRAWVIEW3D, 0);
                break;
-       case B_NLA_SCALE:
+       case B_NLA_SCALE: /* adjust end-frame when scale is changed */
                {
                        float actlen= strip->actend - strip->actstart;
                        float mapping= strip->scale * strip->repeat;
                        
-                       strip->end = (actlen * mapping) + strip->start; 
+                       if (mapping != 0.0f)
+                               strip->end = (actlen * mapping) + strip->start; 
+                       else
+                               printf("NLA Scale Error: Scale = %0.4f, Repeat = %0.4f \n", strip->scale, strip->repeat);
                        
-                       allqueue (REDRAWNLA, 0);
-                       allqueue (REDRAWIPO, 0);
-                       allqueue (REDRAWACTION, 0);
-                       allqueue (REDRAWVIEW3D, 0);
+                       allqueue(REDRAWNLA, 0);
+                       allqueue(REDRAWIPO, 0);
+                       allqueue(REDRAWACTION, 0);
+                       allqueue(REDRAWVIEW3D, 0);
                }
                break;
-       case B_NLA_SCALE2:
+       case B_NLA_SCALE2: /* adjust scale when end-frame is changed */
                {
                        float actlen= strip->actend - strip->actstart;
                        float len= strip->end - strip->start;
                        
                        strip->scale= len / (actlen * strip->repeat);
                        
-                       allqueue (REDRAWNLA, 0);
-                       allqueue (REDRAWIPO, 0);
-                       allqueue (REDRAWACTION, 0);
-                       allqueue (REDRAWVIEW3D, 0);
+                       allqueue(REDRAWNLA, 0);
+                       allqueue(REDRAWIPO, 0);
+                       allqueue(REDRAWACTION, 0);
+                       allqueue(REDRAWVIEW3D, 0);
                }
                break;
        case B_NLA_LOCK:
                synchronize_action_strips();
                
-               allqueue (REDRAWNLA, 0);
-               allqueue (REDRAWIPO, 0);
-               allqueue (REDRAWACTION, 0);
-               allqueue (REDRAWVIEW3D, 0);
+               allqueue(REDRAWNLA, 0);
+               allqueue(REDRAWIPO, 0);
+               allqueue(REDRAWACTION, 0);
+               allqueue(REDRAWVIEW3D, 0);
                break;
                
        case B_NLA_MOD_ADD:
@@ -635,14 +638,14 @@ static void nla_panel_properties(short cntrl)     // NLA_HANDLER_PROPERTIES
        
        uiBlockBeginAlign(block);
                // FIXME: repeat and scale are too cramped!
-       uiDefButF(block, NUM, B_NLA_SCALE, "Repeat:",   160,100,75,19, &strip->repeat, 0.001, 1000.0f, 100, 0, "Number of times the action should repeat");
+       uiDefButF(block, NUMABS, B_NLA_SCALE, "Repeat:",        160,100,75,19, &strip->repeat, 0.001, 1000.0f, 100, 0, "Number of times the action should repeat");
        if ((strip->actend - strip->actstart) < 1.0f) {
                uiBlockSetCol(block, TH_REDALERT);
-               uiDefButF(block, NUM, B_NLA_SCALE, "Scale:",    235,100,75,19, &strip->scale, 0.001, 1000.0f, 100, 0, "Please run Alt-S to fix up this error");
+               uiDefButF(block, NUMABS, B_NLA_SCALE, "Scale:",         235,100,75,19, &strip->scale, 0.001, 1000.0f, 100, 0, "Please run Alt-S to fix up this error");
                uiBlockSetCol(block, TH_AUTO);
        }
        else
-               uiDefButF(block, NUM, B_NLA_SCALE, "Scale:",    235,100,75,19, &strip->scale, 0.001, 1000.0f, 100, 0, "Amount the action should be scaled by");
+               uiDefButF(block, NUMABS, B_NLA_SCALE, "Scale:",         235,100,75,19, &strip->scale, 0.001, 1000.0f, 100, 0, "Amount the action should be scaled by");
        but= uiDefButC(block, TEX, B_NLA_PANEL, "OffsBone:", 160,80,150,19, strip->offs_bone, 0, 31.0f, 0, 0, "Name of Bone that defines offset for repeat");
        uiButSetCompleteFunc(but, autocomplete_bone, (void *)ob);
        uiDefButBitS(block, TOG, ACTSTRIP_HOLDLASTFRAME, B_NLA_PANEL, "Hold",   160,60,75,19, &strip->flag, 0, 0, 0, 0, "Toggles whether to continue displaying the last frame past the end of the strip");
index aec0e112b32e9dc3360a7cad4524e73b9a644ae7..561024fb74bc25e02dbfdf6e5b2ba5f54f399179 100644 (file)
@@ -2425,19 +2425,23 @@ static void draw_mesh_fancy(Base *base, int dt, int flag)
        if (draw_wire) {
                        /* If drawing wire and drawtype is not OB_WIRE then we are
                                * overlaying the wires.
+                               *
+                               * UPDATE bug #10290 - With this wire-only objects can draw
+                               * behind other objects depending on their order in the scene. 2x if 0's below. undo'ing zr's commit: r4059
                                */
-
+#if 0
                if (dt!=OB_WIRE) {
                        bglPolygonOffset(1.0);
                        glDepthMask(0); // disable write in zbuffer, selected edge wires show better
                }
-
+#endif
                dm->drawEdges(dm, (dt==OB_WIRE || totface==0));
-
+#if 0
                if (dt!=OB_WIRE) {
                        glDepthMask(1);
                        bglPolygonOffset(0.0);
                }
+#endif
        }
 
        dm->release(dm);
@@ -2485,7 +2489,7 @@ static int draw_mesh_object(Base *base, int dt, int flag)
        }
        
        /* init_gl_materials did the proper checking if this is needed */
-       if(has_alpha) add_view3d_after(G.vd, base, V3D_TRANSP);
+       if(has_alpha) add_view3d_after(G.vd, base, V3D_TRANSP, flag);
        
        return retval;
 }
@@ -4663,7 +4667,7 @@ void draw_object(Base *base, int flag)
                if(!(G.f & G_PARTICLEEDIT)) {
                        /* xray and transp are set when it is drawing the 2nd/3rd pass */
                        if(!G.vd->xray && !G.vd->transp && (ob->dtx & OB_DRAWXRAY)) {
-                               add_view3d_after(G.vd, base, V3D_XRAY);
+                               add_view3d_after(G.vd, base, V3D_XRAY, flag);
                                return;
                        }
                }
index b01b7bc151ceb6fba901749e0396ceea40336984..be0095360221f96ee7a2882c6ad1a73a98175dcf 100644 (file)
@@ -2663,21 +2663,22 @@ static void view3d_blockhandlers(ScrArea *sa)
 typedef struct View3DAfter {
        struct View3DAfter *next, *prev;
        struct Base *base;
-       int type;
+       int type, flag;
 } View3DAfter;
 
 /* temp storage of Objects that need to be drawn as last */
-void add_view3d_after(View3D *v3d, Base *base, int type)
+void add_view3d_after(View3D *v3d, Base *base, int type, int flag)
 {
        View3DAfter *v3da= MEM_callocN(sizeof(View3DAfter), "View 3d after");
 
        BLI_addtail(&v3d->afterdraw, v3da);
        v3da->base= base;
        v3da->type= type;
+       v3da->flag= flag;
 }
 
 /* clears zbuffer and draws it over */
-static void view3d_draw_xray(View3D *v3d, int flag)
+static void view3d_draw_xray(View3D *v3d)
 {
        View3DAfter *v3da, *next;
        int doit= 0;
@@ -2692,7 +2693,7 @@ static void view3d_draw_xray(View3D *v3d, int flag)
                for(v3da= v3d->afterdraw.first; v3da; v3da= next) {
                        next= v3da->next;
                        if(v3da->type==V3D_XRAY) {
-                               draw_object(v3da->base, flag);
+                               draw_object(v3da->base, v3da->flag);
                                BLI_remlink(&v3d->afterdraw, v3da);
                                MEM_freeN(v3da);
                        }
@@ -2702,7 +2703,7 @@ static void view3d_draw_xray(View3D *v3d, int flag)
 }
 
 /* disables write in zbuffer and draws it over */
-static void view3d_draw_transp(View3D *v3d, int flag)
+static void view3d_draw_transp(View3D *v3d)
 {
        View3DAfter *v3da, *next;
 
@@ -2712,7 +2713,7 @@ static void view3d_draw_transp(View3D *v3d, int flag)
        for(v3da= v3d->afterdraw.first; v3da; v3da= next) {
                next= v3da->next;
                if(v3da->type==V3D_TRANSP) {
-                       draw_object(v3da->base, flag);
+                       draw_object(v3da->base, v3da->flag);
                        BLI_remlink(&v3d->afterdraw, v3da);
                        MEM_freeN(v3da);
                }
@@ -3102,9 +3103,7 @@ void drawview3dspace(ScrArea *sa, void *spacedata)
                        }
                }
 
-               /* Transp and X-ray afterdraw stuff */
-               view3d_draw_xray(v3d, DRAW_CONSTCOLOR); // clears zbuffer if it is used!
-               view3d_draw_transp(v3d, DRAW_CONSTCOLOR);
+               /* Transp and X-ray afterdraw stuff for sets is done later */
        }
        
        /* then draw not selected and the duplis, but skip editmode object */
@@ -3150,8 +3149,8 @@ void drawview3dspace(ScrArea *sa, void *spacedata)
        if(G.scene->radio) RAD_drawall(v3d->drawtype>=OB_SOLID);
        
        /* Transp and X-ray afterdraw stuff */
-       view3d_draw_xray(v3d, 0);       // clears zbuffer if it is used!
-       view3d_draw_transp(v3d, 0);
+       view3d_draw_xray(v3d);  // clears zbuffer if it is used!
+       view3d_draw_transp(v3d);
 
        if(!retopo && sculptparticle && (obact && (OBACT->dtx & OB_DRAWXRAY))) {
                if(G.f & G_SCULPTMODE)
@@ -3327,9 +3326,7 @@ void drawview3d_render(struct View3D *v3d, int winx, int winy, float winmat[][4]
                        }
                }
                
-               /* Transp and X-ray afterdraw stuff */
-               view3d_draw_xray(v3d, DRAW_CONSTCOLOR); // clears zbuffer if it is used!
-               view3d_draw_transp(v3d, DRAW_CONSTCOLOR);
+               /* Transp and X-ray afterdraw stuff for sets is done later */
        }
 
        /* first not selected and duplis */
@@ -3367,8 +3364,8 @@ void drawview3d_render(struct View3D *v3d, int winx, int winy, float winmat[][4]
        if(G.scene->radio) RAD_drawall(v3d->drawtype>=OB_SOLID);
 
        /* Transp and X-ray afterdraw stuff */
-       view3d_draw_xray(v3d, 0);       // clears zbuffer if it is used!
-       view3d_draw_transp(v3d, 0);
+       view3d_draw_xray(v3d);  // clears zbuffer if it is used!
+       view3d_draw_transp(v3d);
        
        if(v3d->flag & V3D_CLIPPING)
                view3d_clr_clipping();
@@ -3424,7 +3421,7 @@ static void draw_viewport_fps(ScrArea *sa)
        char printable[16];
        int i, tot;
        
-       if (lredrawtime == redrawtime)
+       if (!lredrawtime || !redrawtime)
                return;
        
        printable[0] = '\0';
@@ -3572,7 +3569,7 @@ void inner_play_anim_loop(int init, int mode)
                last_cfra = -1;
                cached = cached_dynamics(PSFRA,PEFRA);
                
-               redrawtime = 1.0/FPS;
+               redrawtime = 0.0;
                
                redrawtime_index = REDRAW_FRAME_AVERAGE;
                while(redrawtime_index--) {
index c1665332be8f637219876d7c9dbe1555ac5ef8b7..e74401cb622e8a3dd31f2d2406e6d3246d47bcab 100644 (file)
@@ -870,14 +870,14 @@ int minmax_tface(float *min, float *max)
        return ok;
 }
 
-#define ME_SEAM_DONE ME_SEAM_LAST              /* reuse this flag */
+#define ME_SEAM_DONE 2         /* reuse this flag */
 
-static float seam_cut_cost(Mesh *me, int e1, int e2, int vert)
+static float edgetag_cut_cost(EditMesh *em, int e1, int e2, int vert)
 {
-       MVert *v = me->mvert + vert;
-       MEdge *med1 = me->medge + e1, *med2 = me->medge + e2;
-       MVert *v1 = me->mvert + ((med1->v1 == vert)? med1->v2: med1->v1);
-       MVert *v2 = me->mvert + ((med2->v1 == vert)? med2->v2: med2->v1);
+       EditVert *v = EM_get_vert_for_index(vert);
+       EditEdge *eed1 = EM_get_edge_for_index(e1), *eed2 = EM_get_edge_for_index(e2);
+       EditVert *v1 = EM_get_vert_for_index( (eed1->v1->tmp.l == vert)? eed1->v2->tmp.l: eed1->v1->tmp.l );
+       EditVert *v2 = EM_get_vert_for_index( (eed2->v1->tmp.l == vert)? eed2->v2->tmp.l: eed2->v1->tmp.l );
        float cost, d1[3], d2[3];
 
        cost = VecLenf(v1->co, v->co);
@@ -891,19 +891,19 @@ static float seam_cut_cost(Mesh *me, int e1, int e2, int vert)
        return cost;
 }
 
-static void seam_add_adjacent(Mesh *me, Heap *heap, int mednum, int vertnum, int *nedges, int *edges, int *prevedge, float *cost)
+static void edgetag_add_adjacent(EditMesh *em, Heap *heap, int mednum, int vertnum, int *nedges, int *edges, int *prevedge, float *cost)
 {
        int startadj, endadj = nedges[vertnum+1];
 
        for (startadj = nedges[vertnum]; startadj < endadj; startadj++) {
                int adjnum = edges[startadj];
-               MEdge *medadj = me->medge + adjnum;
+               EditEdge *eedadj = EM_get_edge_for_index(adjnum);
                float newcost;
 
-               if (medadj->flag & ME_SEAM_DONE)
+               if (eedadj->f2 & ME_SEAM_DONE)
                        continue;
 
-               newcost = cost[mednum] + seam_cut_cost(me, mednum, adjnum, vertnum);
+               newcost = cost[mednum] + edgetag_cut_cost(em, mednum, adjnum, vertnum);
 
                if (cost[adjnum] > newcost) {
                        cost[adjnum] = newcost;
@@ -913,59 +913,93 @@ static void seam_add_adjacent(Mesh *me, Heap *heap, int mednum, int vertnum, int
        }
 }
 
-static int seam_shortest_path(Mesh *me, int source, int target)
+void edgetag_context_set(EditEdge *eed, int val)
 {
+       switch (G.scene->toolsettings->edge_mode) {
+       case EDGE_MODE_TAG_SEAM:
+               if (val)                {eed->seam = 255;}
+               else                    {eed->seam = 0;}
+               break;
+       case EDGE_MODE_TAG_SHARP:
+               if (val)                {eed->sharp = 1;}
+               else                    {eed->sharp = 0;}
+               break;                          
+       case EDGE_MODE_TAG_CREASE:      
+               if (val)                {eed->crease = 1.0f;}
+               else                    {eed->crease = 0.0f;}
+               break;
+       case EDGE_MODE_TAG_BEVEL:
+               if (val)                {eed->bweight = 1.0f;}
+               else                    {eed->bweight = 0.0f;}
+               break;
+       }
+}
+
+int edgetag_context_check(EditEdge *eed)
+{
+       switch (G.scene->toolsettings->edge_mode) {
+       case EDGE_MODE_TAG_SEAM:
+               return eed->seam ? 1 : 0;
+       case EDGE_MODE_TAG_SHARP:
+               return eed->sharp ? 1 : 0;
+       case EDGE_MODE_TAG_CREASE:      
+               return eed->crease ? 1 : 0;
+       case EDGE_MODE_TAG_BEVEL:
+               return eed->bweight ? 1 : 0;
+       }
+       return 0;
+}
+
+
+int edgetag_shortest_path(EditEdge *source, EditEdge *target)
+{
+       EditMesh *em = G.editMesh;
+       EditEdge *eed;
+       EditVert *ev;
+       
        Heap *heap;
        EdgeHash *ehash;
        float *cost;
-       MEdge *med;
-       int a, *nedges, *edges, *prevedge, mednum = -1, nedgeswap = 0;
-       MFace *mf;
+       int a, totvert=0, totedge=0, *nedges, *edges, *prevedge, mednum = -1, nedgeswap = 0;
 
-       /* mark hidden edges as done, so we don't use them */
-       ehash = BLI_edgehash_new();
 
-       for (a=0, mf=me->mface; a<me->totface; a++, mf++) {
-               if (!(mf->flag & ME_HIDE)) {
-                       BLI_edgehash_insert(ehash, mf->v1, mf->v2, NULL);
-                       BLI_edgehash_insert(ehash, mf->v2, mf->v3, NULL);
-                       if (mf->v4) {
-                               BLI_edgehash_insert(ehash, mf->v3, mf->v4, NULL);
-                               BLI_edgehash_insert(ehash, mf->v4, mf->v1, NULL);
-                       }
-                       else
-                               BLI_edgehash_insert(ehash, mf->v3, mf->v1, NULL);
-               }
+       /* we need the vert */
+       for (ev= em->verts.first, totvert=0; ev; ev= ev->next) {
+               ev->tmp.l = totvert;
+               totvert++;
        }
 
-       for (a=0, med=me->medge; a<me->totedge; a++, med++)
-               if (!BLI_edgehash_haskey(ehash, med->v1, med->v2))
-                       med->flag |= ME_SEAM_DONE;
-
-       BLI_edgehash_free(ehash, NULL);
+       for (eed= em->edges.first; eed; eed = eed->next) {
+               eed->f2 = 0;
+               if (eed->h) {
+                       eed->f2 |= ME_SEAM_DONE;
+               }
+               eed->tmp.l = totedge;
+               totedge++;
+       }
 
        /* alloc */
-       nedges = MEM_callocN(sizeof(*nedges)*me->totvert+1, "SeamPathNEdges");
-       edges = MEM_mallocN(sizeof(*edges)*me->totedge*2, "SeamPathEdges");
-       prevedge = MEM_mallocN(sizeof(*prevedge)*me->totedge, "SeamPathPrevious");
-       cost = MEM_mallocN(sizeof(*cost)*me->totedge, "SeamPathCost");
+       nedges = MEM_callocN(sizeof(*nedges)*totvert+1, "SeamPathNEdges");
+       edges = MEM_mallocN(sizeof(*edges)*totedge*2, "SeamPathEdges");
+       prevedge = MEM_mallocN(sizeof(*prevedge)*totedge, "SeamPathPrevious");
+       cost = MEM_mallocN(sizeof(*cost)*totedge, "SeamPathCost");
 
        /* count edges, compute adjacent edges offsets and fill adjacent edges */
-       for (a=0, med=me->medge; a<me->totedge; a++, med++) {
-               nedges[med->v1+1]++;
-               nedges[med->v2+1]++;
+       for (eed= em->edges.first; eed; eed = eed->next) {
+               nedges[eed->v1->tmp.l+1]++;
+               nedges[eed->v2->tmp.l+1]++;
        }
 
-       for (a=1; a<me->totvert; a++) {
+       for (a=1; a<totvert; a++) {
                int newswap = nedges[a+1];
                nedges[a+1] = nedgeswap + nedges[a];
                nedgeswap = newswap;
        }
        nedges[0] = nedges[1] = 0;
 
-       for (a=0, med=me->medge; a<me->totedge; a++, med++) {
-               edges[nedges[med->v1+1]++] = a;
-               edges[nedges[med->v2+1]++] = a;
+       for (a=0, eed= em->edges.first; eed; a++, eed = eed->next) {
+               edges[nedges[eed->v1->tmp.l+1]++] = a;
+               edges[nedges[eed->v2->tmp.l+1]++] = a;
 
                cost[a] = 1e20f;
                prevedge[a] = -1;
@@ -973,100 +1007,74 @@ static int seam_shortest_path(Mesh *me, int source, int target)
 
        /* regular dijkstra shortest path, but over edges instead of vertices */
        heap = BLI_heap_new();
-       BLI_heap_insert(heap, 0.0f, SET_INT_IN_POINTER(source));
-       cost[source] = 0.0f;
+       BLI_heap_insert(heap, 0.0f, SET_INT_IN_POINTER(source->tmp.l));
+       cost[source->tmp.l] = 0.0f;
+
+       EM_init_index_arrays(1, 1, 0);
+
 
        while (!BLI_heap_empty(heap)) {
                mednum = GET_INT_FROM_POINTER(BLI_heap_popmin(heap));
-               med = me->medge + mednum;
+               eed = EM_get_edge_for_index( mednum );
 
-               if (mednum == target)
+               if (mednum == target->tmp.l)
                        break;
 
-               if (med->flag & ME_SEAM_DONE)
+               if (eed->f2 & ME_SEAM_DONE)
                        continue;
 
-               med->flag |= ME_SEAM_DONE;
+               eed->f2 |= ME_SEAM_DONE;
 
-               seam_add_adjacent(me, heap, mednum, med->v1, nedges, edges, prevedge, cost);
-               seam_add_adjacent(me, heap, mednum, med->v2, nedges, edges, prevedge, cost);
+               edgetag_add_adjacent(em, heap, mednum, eed->v1->tmp.l, nedges, edges, prevedge, cost);
+               edgetag_add_adjacent(em, heap, mednum, eed->v2->tmp.l, nedges, edges, prevedge, cost);
        }
        
+       
        MEM_freeN(nedges);
        MEM_freeN(edges);
        MEM_freeN(cost);
        BLI_heap_free(heap, NULL);
 
-       for (a=0, med=me->medge; a<me->totedge; a++, med++)
-               med->flag &= ~ME_SEAM_DONE;
+       for (eed= em->edges.first; eed; eed = eed->next) {
+               eed->f2 &= ~ME_SEAM_DONE;
+       }
 
-       if (mednum != target) {
+       if (mednum != target->tmp.l) {
                MEM_freeN(prevedge);
+               EM_free_index_arrays();
                return 0;
        }
 
        /* follow path back to source and mark as seam */
-       if (mednum == target) {
+       if (mednum == target->tmp.l) {
                short allseams = 1;
 
-               mednum = target;
+               mednum = target->tmp.l;
                do {
-                       med = me->medge + mednum;
-                       if (!(med->flag & ME_SEAM)) {
+                       eed = EM_get_edge_for_index( mednum );
+                       if (!edgetag_context_check(eed)) {
                                allseams = 0;
                                break;
                        }
                        mednum = prevedge[mednum];
-               } while (mednum != source);
+               } while (mednum != source->tmp.l);
 
-               mednum = target;
+               mednum = target->tmp.l;
                do {
-                       med = me->medge + mednum;
+                       eed = EM_get_edge_for_index( mednum );
                        if (allseams)
-                               med->flag &= ~ME_SEAM;
+                               edgetag_context_set(eed, 0);
                        else
-                               med->flag |= ME_SEAM;
+                               edgetag_context_set(eed, 1);
                        mednum = prevedge[mednum];
                } while (mednum != -1);
        }
 
        MEM_freeN(prevedge);
+       EM_free_index_arrays();
        return 1;
 }
 
-static void seam_select(Mesh *me, short *mval, short path)
-{
-       unsigned int index = 0;
-       MEdge *medge, *med;
-       int a, lastindex = -1;
-
-       if (!facesel_edge_pick(me, mval, &index))
-               return;
-
-       for (a=0, med=me->medge; a<me->totedge; a++, med++) {
-               if (med->flag & ME_SEAM_LAST) {
-                       lastindex = a;
-                       med->flag &= ~ME_SEAM_LAST;
-                       break;
-               }
-       }
-
-       medge = me->medge + index;
-       if (!path || (lastindex == -1) || (index == lastindex) ||
-           !seam_shortest_path(me, lastindex, index))
-               medge->flag ^= ME_SEAM;
-       medge->flag |= ME_SEAM_LAST;
-
-       G.f |= G_DRAWSEAMS;
-
-       if (G.rt == 8)
-               unwrap_lscm(1);
-
-       BIF_undo_push("Mark Seam");
-
-       object_tface_flags_changed(OBACT, 1);
-}
-
 void seam_edgehash_insert_face(EdgeHash *ehash, MFace *mf)
 {
        BLI_edgehash_insert(ehash, mf->v1, mf->v2, NULL);
@@ -1154,11 +1162,6 @@ void face_select()
        me = get_mesh(ob);
        getmouseco_areawin(mval);
 
-       if (G.qual & LR_ALTKEY) {
-               seam_select(me, mval, (G.qual & LR_SHIFTKEY) != 0);
-               return;
-       }
-
        if (!facesel_face_pick(me, mval, &index, 1)) return;
        
        msel= (((MFace*)me->mface)+index);
index d1873d1fe5636c0cc2e4ee254c9d8711a98a5780..84971e8ce0bc957362910db6c8aa37dac9907589 100644 (file)
@@ -92,6 +92,7 @@ editmesh_mods.c, UI level access, no geometry changes
 
 #include "BDR_drawobject.h"
 #include "BDR_editobject.h"
+#include "BDR_editface.h"
 
 #include "BSE_drawview.h"
 #include "BSE_edit.h"
@@ -2062,6 +2063,7 @@ void loop_multiselect(int looptype)
 /* ***************** MAIN MOUSE SELECTION ************** */
 
 /* just to have the functions nice together */
+
 static void mouse_mesh_loop(void)
 {
        EditEdge *eed;
@@ -2070,36 +2072,100 @@ static void mouse_mesh_loop(void)
        
        eed= findnearestedge(&dist);
        if(eed) {
+               if (G.scene->toolsettings->edge_mode == EDGE_MODE_SELECT) {
+                       if((G.qual & LR_SHIFTKEY)==0) EM_clear_flag_all(SELECT);
                
-               if((G.qual & LR_SHIFTKEY)==0) EM_clear_flag_all(SELECT);
-               
-               if((eed->f & SELECT)==0) select=1;
-               else if(G.qual & LR_SHIFTKEY) select=0;
+                       if((eed->f & SELECT)==0) select=1;
+                       else if(G.qual & LR_SHIFTKEY) select=0;
 
-               if(G.scene->selectmode & SCE_SELECT_FACE) {
-                       faceloop_select(eed, select);
-               }
-               else if(G.scene->selectmode & SCE_SELECT_EDGE) {
-            if(G.qual == (LR_CTRLKEY | LR_ALTKEY) || G.qual == (LR_CTRLKEY | LR_ALTKEY |LR_SHIFTKEY))
-                       edgering_select(eed, select);
-            else if(G.qual & LR_ALTKEY)
-                       edgeloop_select(eed, select);
-               }
-        else if(G.scene->selectmode & SCE_SELECT_VERTEX) {
-            if(G.qual == (LR_CTRLKEY | LR_ALTKEY) || G.qual == (LR_CTRLKEY | LR_ALTKEY |LR_SHIFTKEY))
-                       edgering_select(eed, select);
-            else if(G.qual & LR_ALTKEY)
-                       edgeloop_select(eed, select);
-               }
+                       if(G.scene->selectmode & SCE_SELECT_FACE) {
+                               faceloop_select(eed, select);
+                       }
+                       else if(G.scene->selectmode & SCE_SELECT_EDGE) {
+                       if(G.qual == (LR_CTRLKEY | LR_ALTKEY) || G.qual == (LR_CTRLKEY | LR_ALTKEY |LR_SHIFTKEY))
+                                       edgering_select(eed, select);
+                       else if(G.qual & LR_ALTKEY)
+                                       edgeloop_select(eed, select);
+                       }
+                   else if(G.scene->selectmode & SCE_SELECT_VERTEX) {
+                       if(G.qual == (LR_CTRLKEY | LR_ALTKEY) || G.qual == (LR_CTRLKEY | LR_ALTKEY |LR_SHIFTKEY))
+                                       edgering_select(eed, select);
+                       else if(G.qual & LR_ALTKEY)
+                                       edgeloop_select(eed, select);
+                       }
 
-               /* frontbuffer draw of last selected only */
-               unified_select_draw(NULL, eed, NULL);
+                       /* frontbuffer draw of last selected only */
+                       unified_select_draw(NULL, eed, NULL);
                
-               EM_selectmode_flush();
-               countall();
-               allqueue(REDRAWVIEW3D, 0);
-               if (EM_texFaceCheck())
-                       allqueue(REDRAWIMAGE, 0);
+                       EM_selectmode_flush();
+                       countall();
+                       allqueue(REDRAWVIEW3D, 0);
+                       if (EM_texFaceCheck())
+                               allqueue(REDRAWIMAGE, 0);
+               } else { /*(G.scene->toolsettings->edge_mode == EDGE_MODE_TAG_*)*/
+                       int act = (edgetag_context_check(eed)==0);
+                       int path = 0;
+                       
+                       if (G.qual == (LR_SHIFTKEY | LR_ALTKEY) && G.editMesh->selected.last) {
+                               EditSelection *ese = G.editMesh->selected.last;
+       
+                               if(ese && ese->type == EDITEDGE) {
+                                       EditEdge *eed_act;
+                                       eed_act = (EditEdge*)ese->data;
+                                       if (eed_act != eed) {
+                                               /* If shift is pressed we need to use the last active edge, (if it exists) */
+                                               if (edgetag_shortest_path(eed_act, eed)) {
+                                                       EM_remove_selection(eed_act, EDITEDGE);
+                                                       EM_select_edge(eed_act, 0);
+                                                       path = 1;
+                                               }
+                                       }
+                               }
+                       }
+                       if (path==0) {
+                               edgetag_context_set(eed, act); /* switch the edge option */
+                       }
+                       
+                       if (act) {
+                               if ((eed->f & SELECT)==0) {
+                                       EM_select_edge(eed, 1);
+                                       EM_selectmode_flush();
+                                       countall();
+                               }
+                               /* even if this is selected it may not be in the selection list */
+                               EM_store_selection(eed, EDITEDGE);
+                       } else {
+                               if (eed->f & SELECT) {
+                                       EM_select_edge(eed, 0);
+                                       /* logic is differnt from above here since if this was selected we dont know if its in the selection list or not */
+                                       EM_remove_selection(eed, EDITEDGE);
+                                       
+                                       EM_selectmode_flush();
+                                       countall();
+                               }
+                       }
+                       
+                       switch (G.scene->toolsettings->edge_mode) {
+                       case EDGE_MODE_TAG_SEAM:
+                               G.f |= G_DRAWSEAMS;
+                               break;
+                       case EDGE_MODE_TAG_SHARP:
+                               G.f |= G_DRAWSHARP;
+                               break;
+                       case EDGE_MODE_TAG_CREASE:      
+                               G.f |= G_DRAWCREASES;
+                               break;
+                       case EDGE_MODE_TAG_BEVEL:
+                               G.f |= G_DRAWBWEIGHTS;
+                               break;
+                       }
+                       
+                       unified_select_draw(NULL, eed, NULL);
+                       
+                       DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
+                       allqueue(REDRAWVIEW3D, 0);
+               }
+                               
        }
 }
 
index 6d9adda85d05a66bc443c6ae9537376eb19b83e4..d758f34949a3249ffbde169faf3ce5c8472c3846 100644 (file)
@@ -188,11 +188,16 @@ void shift_nlastrips_down(void) {
 void synchronize_action_strips(void)
 {
        Base *base;
+       Object *ob;
        bActionStrip *strip;
        
        for (base=G.scene->base.first; base; base=base->next) {
+               /* get object first */
+               ob= base->object;
+               
                /* step 1: adjust strip-lengths */
-               for (strip = base->object->nlastrips.last; strip; strip=strip->prev) {
+               //      FIXME: this seems very buggy
+               for (strip = ob->nlastrips.last; strip; strip=strip->prev) {
                        if (strip->flag & ACTSTRIP_LOCK_ACTION) {
                                float actstart, actend;
                                
@@ -212,7 +217,7 @@ void synchronize_action_strips(void)
                }
                
                /* step 2: adjust blendin/out values for each strip if option is turned on */
-               for (strip= base->object->nlastrips.first; strip; strip=strip->next) {
+               for (strip= ob->nlastrips.first; strip; strip=strip->next) {
                        if (strip->flag & ACTSTRIP_AUTO_BLENDS) {
                                bActionStrip *prev= strip->prev;
                                bActionStrip *next= strip->next;
index cdc38ab1d2c689e036179df2ad2383b425de4193..4029e031b633d68fb560105323f1a86b8e6a07f5 100644 (file)
@@ -1887,6 +1887,7 @@ void docenter(int centermode)
                        
                        recalc_editnormals();
                        tot_change++;
+                       DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
                }
        }
        
@@ -3133,9 +3134,15 @@ void flip_subdivison(int level)
                mode= eModifierMode_Render|eModifierMode_Realtime;
        
        if(level == -1) {
-               for(base= G.scene->base.first; base; base= base->next)
-                       if(((level==-1) && (TESTBASE(base))) || (TESTBASELIB(base)))
-                               object_has_subdivision_particles(base->object, &havesubdiv, &havepart, 0);
+               if (G.obedit) {
+                       object_has_subdivision_particles(G.obedit, &havesubdiv, &havepart, 0);                  
+               } else {
+                       for(base= G.scene->base.first; base; base= base->next) {
+                               if(((level==-1) && (TESTBASE(base))) || (TESTBASELIB(base))) {
+                                       object_has_subdivision_particles(base->object, &havesubdiv, &havepart, 0);
+                               }
+                       }
+               }
        }
        else
                havesubdiv= 1;
@@ -3149,10 +3156,16 @@ void flip_subdivison(int level)
        }
        else if(havepart)
                particles= 1;
-       
-       for(base= G.scene->base.first; base; base= base->next)
-               if(((level==-1) && (TESTBASE(base))) || (TESTBASELIB(base)))
-                       object_flip_subdivison_particles(base->object, &set, level, mode, particles, 0);
+
+       if (G.obedit) { 
+               object_flip_subdivison_particles(G.obedit, &set, level, mode, particles, 0);
+       } else {
+               for(base= G.scene->base.first; base; base= base->next) {
+                       if(((level==-1) && (TESTBASE(base))) || (TESTBASELIB(base))) {
+                               object_flip_subdivison_particles(base->object, &set, level, mode, particles, 0);
+                       }
+               }
+       }
        
        countall();
        allqueue(REDRAWVIEW3D, 0);
index bd1c265f2a151d83d5c09f74fa0070d49f743289..50bd4d7c7f3ef6ce77fa7e82b21a3f86a1e9f00f 100644 (file)
@@ -792,14 +792,13 @@ void mouse_select_seq(void)
                /* select timeline marker */
                if (G.qual & LR_SHIFTKEY) {
                        oldflag= marker->flag;
-                       deselect_markers(0, 0);
-                       
                        if (oldflag & SELECT)
                                marker->flag &= ~SELECT;
                        else
                                marker->flag |= SELECT;
                }
                else {
+                       deselect_markers(0, 0);
                        marker->flag |= SELECT;                         
                }
                allqueue(REDRAWMARKER, 0);
@@ -3809,9 +3808,15 @@ void seq_mute_sel(int mute) {
        if(!ed) return;
        
        for(seq= ed->seqbasep->first; seq; seq= seq->next) {
-               if ((seq->flag & SELECT) && (seq->flag & SEQ_LOCK)==0) {
-                       if (mute) seq->flag |= SEQ_MUTE;
-                       else seq->flag &= ~SEQ_MUTE;
+               if ((seq->flag & SEQ_LOCK)==0) {
+                       if (mute==-1) { /* hide unselected */
+                               if ((seq->flag & SELECT)==0) {
+                                       seq->flag |= SEQ_MUTE;
+                               }
+                       } else if (seq->flag & SELECT) {
+                               if (mute) seq->flag |= SEQ_MUTE;
+                               else seq->flag &= ~SEQ_MUTE;
+                       }
                }
        }
        BIF_undo_push(mute?"Mute Strips, Sequencer":"UnMute Strips, Sequencer");
index 19372dcbee621fa25217b3d00ab939811b041d2d..bfff2f10ab6d5456075a7eaaf3a2ee1a42a1728e 100644 (file)
@@ -1299,6 +1299,27 @@ void activate_databrowse_args(struct ID *id, int idcode, int fromcode, short *me
        sfile->ipotype= fromcode;
 }
 
+/* resets a previous file space type */
+/* is used when opening a filebrowser directly from windowtype_pupmenu,
+   since in that case we don't want any load/save/append/link action
+*/
+void reset_filespace(ScrArea *sa)
+{
+       if (sa->spacetype == SPACE_FILE) {
+               SpaceFile *sfile= sa->spacedata.first;
+                       
+               if(sfile->type==FILE_MAIN) {
+                       freefilelist(sfile);
+               } else {
+                       sfile->type= FILE_UNIX;
+               }
+               
+               sfile->returnfunc= NULL;
+               sfile->title[0]= 0;
+               if(sfile->filelist) test_flags_file(sfile);
+       }
+}
+
 void filesel_prevspace()
 {
        SpaceFile *sfile= curarea->spacedata.first;
index 6648520cfffe10a42958c3c3d9550657f93d1a12..b3d9ff8d5636e19216d859b41a3d13b54eb75e78 100644 (file)
@@ -194,6 +194,10 @@ static void do_seq_selectmenu(void *arg, int event)
        case 7:
                select_linked_seq(2);
                break;
+       case 8:
+               deselect_markers(1, 0);
+               allqueue(REDRAWMARKER, 0);
+               break;
        }
 }
 
@@ -215,7 +219,9 @@ static uiBlock *seq_selectmenu(void *arg_unused)
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
        uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Linked|Ctrl L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All Strips|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All Markers|Ctrl A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
+       
 
        if(curarea->headertype==HEADERTOP) {
                uiBlockSetDirection(block, UI_DOWN);
@@ -444,6 +450,9 @@ static void do_seq_editmenu(void *arg, int event)
                seq_mute_sel(0);
                break;
        case 22:
+               seq_mute_sel(-1);
+               break;
+       case 23:
                seq_cut(CFRA, 0);
                break;
        }
@@ -468,7 +477,7 @@ static uiBlock *seq_editmenu(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, "Cut (hard) at Current Frame|K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cut (soft) at Current Frame|Shift-K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 22, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cut (soft) at Current Frame|Shift-K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 23, "");
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Separate Images to Strips|Y", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
        
        uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
@@ -519,6 +528,7 @@ static uiBlock *seq_editmenu(void *arg_unused)
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Unlock Strips...|Alt-Shift L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 19, "");
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Mute Strips...|H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 20, "");
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Unmute Strips...|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 21, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Mute Deselected Strips...|Shift H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 22, "");
        
 
        if(curarea->headertype==HEADERTOP) {
index b91a8f74f806e36fc26a12f681cf3833a35e48f0..81ad135f5146670b18fea4f297909dad5429309d 100644 (file)
@@ -1434,6 +1434,8 @@ void do_global_buttons(unsigned short event)
                break;
        case B_NEWSPACE:
                newspace(curarea, curarea->butspacetype);
+               reset_filespace(curarea);
+               reset_imaselspace(curarea);
                break;
        case B_LOADTEMP:        /* is button from space.c */
                BIF_read_autosavefile();
index be9f489ea49c6a6794efef69aa2675c8e97adc2f..f502445d3296d4ee86c23ab7df3265fb56d626c3 100644 (file)
@@ -80,3 +80,26 @@ void free_imasel(SpaceImaSel *simasel)
        }
 }
 
+/* resets a previous imagebrowser space type */
+/* is used when opening an imagebrowser directly from windowtype_pupmenu,
+   since in that case we don't want any load/save/append/link action
+*/
+void reset_imaselspace(ScrArea *sa) 
+{
+       if(sa->spacetype==SPACE_IMASEL) {
+               SpaceImaSel *simasel= sa->spacedata.first;
+               if(simasel->type==FILE_MAIN) {
+                       if (simasel->files) {
+                               BIF_filelist_free(simasel->files);
+                               BIF_filelist_settype(simasel->files, FILE_MAIN);
+                       }
+               } else {
+                       if (simasel->files) {
+                               simasel->type= FILE_UNIX;
+                               BIF_filelist_settype(simasel->files, simasel->type);
+                       }
+               }
+               simasel->returnfunc= NULL;
+               simasel->title[0]= 0;
+       }
+}
index fb5b5e2f18795d60d923a939bbe741b7e2741f91..7af6b67bfa3a2d90fbad3b3b3d44ac7bbb4e8a55 100644 (file)
@@ -472,7 +472,7 @@ static int ui_but_copy_paste(uiBut *but, char mode)
        if(mode=='v' && but->lock) return 0;
        poin= but->poin;
                
-       if ELEM3(but->type, NUM, NUMSLI, HSVSLI) {
+       if ELEM4(but->type, NUM, NUMABS, NUMSLI, HSVSLI) {
                
                if(poin==NULL);
                else if(mode=='c') {
@@ -2100,7 +2100,8 @@ static int ui_act_as_text_but(uiBut *but)
        }
        
        if(but->pointype!=FLO) value= (int)value;
-
+       
+       if(but->type==NUMABS) value= fabs(value);
        if(value<min) value= min;
        if(value>max) value= max;
 
@@ -2328,6 +2329,7 @@ static int ui_do_but_ICONROW(uiBut *but)
        ListBase listb= {NULL, NULL};
        uiBlock *block;
        int a;
+       short event;
        
        but->flag |= UI_SELECT;
        ui_draw_but(but);
@@ -2348,13 +2350,17 @@ static int ui_do_but_ICONROW(uiBut *but)
           this is needs better implementation */
        block->win= G.curscreen->mainwin;
        
-       uiDoBlocks(&listb, 0, 1);
+       event= uiDoBlocks(&listb, 0, 1);
 
        but->flag &= ~UI_SELECT;
        ui_check_but(but);
        ui_draw_but(but);       
-       
-       return but->retval;
+
+       if (event & UI_RETURN_OK) {
+               return but->retval;
+       } else {
+               return 0;
+       }
 }
 
 static int ui_do_but_ICONTEXTROW(uiBut *but)
@@ -2363,7 +2369,7 @@ static int ui_do_but_ICONTEXTROW(uiBut *but)
        ListBase listb={NULL, NULL};
        int width, a, xmax, ypos;
        MenuData *md;
-
+       short event;
        but->flag |= UI_SELECT;
        ui_draw_but(but);
        ui_block_flush_back(but->block);        // flush because this button creates own blocks loop
@@ -2421,7 +2427,7 @@ static int ui_do_but_ICONTEXTROW(uiBut *but)
 
        uiBoundsBlock(block, 3);
 
-       uiDoBlocks(&listb, 0, 1);
+       event = uiDoBlocks(&listb, 0, 1);
        
        menudata_free(md);
 
@@ -2429,10 +2435,12 @@ static int ui_do_but_ICONTEXTROW(uiBut *but)
        ui_check_but(but);
        ui_draw_but(but);
 
-       uibut_do_func(but);
-
-       return but->retval;
-
+       if (event & UI_RETURN_OK) {
+               uibut_do_func(but);
+               return but->retval;
+       } else {
+               return 0;
+       }
 }
 
 static int ui_do_but_IDPOIN(uiBut *but)
@@ -3927,6 +3935,7 @@ static int ui_do_button(uiBlock *block, uiBut *but, uiEvent *uevent)
                break;
 
        case NUM:
+       case NUMABS:
                if(uevent->val) retval= ui_do_but_NUM(but);
                break;
                
@@ -4246,13 +4255,13 @@ static void ui_but_next_edittext(uiBlock *block)
                        but->flag &= ~(UI_ACTIVE|UI_SELECT);
                
                for(but= actbut->next; but; but= but->next) {
-                       if(ELEM4(but->type, TEX, NUM, NUMSLI, HSVSLI)) {
+                       if(ELEM5(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI)) {
                                but->flag |= UI_ACTIVE;
                                return;
                        }
                }
                for(but= block->buttons.first; but!=actbut; but= but->next) {
-                       if(ELEM4(but->type, TEX, NUM, NUMSLI, HSVSLI)) {
+                       if(ELEM5(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI)) {
                                but->flag |= UI_ACTIVE;
                                return;
                        }
@@ -4275,13 +4284,13 @@ static void ui_but_prev_edittext(uiBlock *block)
                        but->flag &= ~(UI_ACTIVE|UI_SELECT);
                
                for(but= actbut->prev; but; but= but->prev) {
-                       if(ELEM4(but->type, TEX, NUM, NUMSLI, HSVSLI)) {
+                       if(ELEM5(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI)) {
                                but->flag |= UI_ACTIVE;
                                return;
                        }
                }
                for(but= block->buttons.last; but!=actbut; but= but->prev) {
-                       if(ELEM4(but->type, TEX, NUM, NUMSLI, HSVSLI)) {
+                       if(ELEM5(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI)) {
                                but->flag |= UI_ACTIVE;
                                return;
                        }
@@ -4636,7 +4645,7 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent, int movemouse_quit)
                                //Really nasty... to update the num button from the same butblock
                                for(bt= block->buttons.first; bt; bt= bt->next)
                                {
-                                       if(bt->type == NUM) {
+                                       if(ELEM(bt->type, NUM, NUMABS)) {
                                                ui_check_but(bt);
                                                ui_draw_but(bt);
                                        }
@@ -4662,7 +4671,7 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent, int movemouse_quit)
 
                                for(bt= block->buttons.first; bt; bt= bt->next)
                                {
-                                       if(bt->type == NUM) {
+                                       if(ELEM(bt->type, NUM, NUMABS)) {
                                                ui_check_but(bt);
                                                ui_draw_but(bt);
                                        }
@@ -5435,8 +5444,15 @@ void ui_check_but(uiBut *but)
                case HSVSLI:
                        value= ui_get_but_val(but);
                        if(value < but->min) value= but->min;
-                               if(value > but->max) value= but->max;
-                                       ui_set_but_val(but, value);
+                       if(value > but->max) value= but->max;
+                       ui_set_but_val(but, value);
+                       break;
+                       
+               case NUMABS:
+                       value= fabs( ui_get_but_val(but) );
+                       if(value < but->min) value= but->min;
+                       if(value > but->max) value= but->max;
+                       ui_set_but_val(but, value);
                        break;
                        
                case ICONTOG: 
@@ -5478,6 +5494,7 @@ void ui_check_but(uiBut *but)
        case NUM:
        case NUMSLI:
        case HSVSLI:
+       case NUMABS:
 
                value= ui_get_but_val(but);
 
@@ -5567,7 +5584,7 @@ void ui_check_but(uiBut *but)
                but->ofs= 0;
                while(but->strwidth > (int)okwidth ) {
        
-                       if ELEM(but->type, NUM, TEX) {  // only these cut off left
+                       if ELEM3(but->type, NUM, NUMABS, TEX) { // only these cut off left
                                but->ofs++;
                                but->strwidth= but->aspect*BIF_GetStringWidth(but->font, but->drawstr+but->ofs, transopts);
                                
@@ -5611,6 +5628,7 @@ static int ui_auto_themecol(uiBut *but)
        case SLI:
        case NUM:
        case NUMSLI:
+       case NUMABS:
        case HSVSLI:
                return TH_BUT_NUM;
        case TEX:
@@ -5887,7 +5905,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, char *str, short
        
        but->pos= -1;   /* cursor invisible */
 
-       if(but->type==NUM) {    /* add a space to name */
+       if(ELEM(but->type, NUM, NUMABS)) {      /* add a space to name */
                slen= strlen(but->str);
                if(slen>0 && slen<UI_MAX_NAME_STR-2) {
                        if(but->str[slen-1]!=' ') {
index 83a3c12bae79688014ebc09a47685d1cfad2db73..83f1221b1fb72b23b8d393bcff66a6b64084e7da 100644 (file)
@@ -846,6 +846,7 @@ static void ui_default_flat(int type, int colorid, float asp, float x1, float y1
        /* *** EXTRA DRAWING FOR SPECIFIC CONTROL TYPES *** */
        switch(type) {
        case NUM:
+       case NUMABS:
                /* SIDE ARROWS */
                /* left */
                if(flag & UI_SELECT) {
@@ -872,11 +873,12 @@ static void ui_default_slider(int colorid, float fac, float aspect, float x1, fl
        
        if(flag & UI_SELECT) 
                        BIF_ThemeColorShade(TH_BUT_NUM, -5);
-       else
+       else {
                if(flag & UI_ACTIVE) 
                        BIF_ThemeColorShade(TH_BUT_NUM, +35); 
                else
                        BIF_ThemeColorShade(TH_BUT_NUM, +25); 
+       }
 
        glRectf(x1, ymid-yc, x2, ymid+yc);
        
@@ -943,6 +945,7 @@ static void ui_draw_default(int type, int colorid, float aspect, float x1, float
        case TEX:
        case IDPOIN:
        case NUM:
+       case NUMABS:
                ui_default_flat(type, colorid, aspect, x1, y1, x2, y2, flag);
                break;
        case ICONROW: 
@@ -1026,6 +1029,7 @@ static void ui_draw_oldskool(int type, int colorid, float asp, float x1, float y
        /* special type decorations */
        switch(type) {
        case NUM:
+       case NUMABS:
                if(flag & UI_SELECT) BIF_ThemeColorShade(colorid, -60);
                else BIF_ThemeColorShade(colorid, -30);
                ui_default_num_arrows(x1, y1, x2, y2);
@@ -1176,6 +1180,7 @@ static void ui_draw_round(int type, int colorid, float asp, float x1, float y1,
        /* special type decorations */
        switch(type) {
        case NUM:
+       case NUMABS:
                BIF_ThemeColorShade(colorid, curshade-60);
                ui_default_num_arrows(x1, y1, x2, y2);
                break;
@@ -1285,6 +1290,7 @@ static void ui_draw_minimal(int type, int colorid, float asp, float x1, float y1
        /* special type decorations */
        switch(type) {
        case NUM:
+       case NUMABS:
                if(flag & UI_SELECT) BIF_ThemeColorShade(colorid, -60);
                else BIF_ThemeColorShade(colorid, -30);
                ui_default_num_arrows(x1, y1, x2, y2);
index a643f37ec2a32a8dcc298aa11007ac6a857d7296..096629b01ec4fb7ea195b795d9525efff63cf999 100644 (file)
@@ -389,7 +389,7 @@ static void p_chart_topological_sanity_check(PChart *chart)
 
 /* Loading / Flushing */
 
-static void p_vert_load_pin_select_uvs(PVert *v)
+static void p_vert_load_pin_select_uvs(PHandle *handle, PVert *v)
 {
        PEdge *e;
        int nedges = 0, npins = 0;
@@ -404,13 +404,13 @@ static void p_vert_load_pin_select_uvs(PVert *v)
                                v->flag |= PVERT_SELECT;
 
                        if (e->flag & PEDGE_PIN) {
-                               pinuv[0] += e->orig_uv[0];
-                               pinuv[1] += e->orig_uv[1];
+                               pinuv[0] += e->orig_uv[0]*handle->aspx;
+                               pinuv[1] += e->orig_uv[1]*handle->aspy;
                                npins++;
                        }
                        else {
-                               v->uv[0] += e->orig_uv[0];
-                               v->uv[1] += e->orig_uv[1];
+                               v->uv[0] += e->orig_uv[0]*handle->aspx;
+                               v->uv[1] += e->orig_uv[1]*handle->aspy;
                        }
 
                        nedges++;
@@ -430,27 +430,27 @@ static void p_vert_load_pin_select_uvs(PVert *v)
        }
 }
 
-static void p_flush_uvs(PChart *chart)
+static void p_flush_uvs(PHandle *handle, PChart *chart)
 {
        PEdge *e;
 
        for (e=chart->edges; e; e=e->nextlink) {
                if (e->orig_uv) {
-                       e->orig_uv[0] = e->vert->uv[0];
-                       e->orig_uv[1] = e->vert->uv[1];
+                       e->orig_uv[0] = e->vert->uv[0]/handle->aspx;
+                       e->orig_uv[1] = e->vert->uv[1]/handle->aspy;
                }
        }
 }
 
-static void p_flush_uvs_blend(PChart *chart, float blend)
+static void p_flush_uvs_blend(PHandle *handle, PChart *chart, float blend)
 {
        PEdge *e;
        float invblend = 1.0f - blend;
 
        for (e=chart->edges; e; e=e->nextlink) {
                if (e->orig_uv) {
-                       e->orig_uv[0] = blend*e->old_uv[0] + invblend*e->vert->uv[0];
-                       e->orig_uv[1] = blend*e->old_uv[1] + invblend*e->vert->uv[1];
+                       e->orig_uv[0] = blend*e->old_uv[0] + invblend*e->vert->uv[0]/handle->aspx;
+                       e->orig_uv[1] = blend*e->old_uv[1] + invblend*e->vert->uv[1]/handle->aspy;
                }
        }
 }
@@ -2813,7 +2813,7 @@ static void p_chart_lscm_begin(PChart *chart, PBool live, PBool abf)
        }
 }
 
-static PBool p_chart_lscm_solve(PChart *chart)
+static PBool p_chart_lscm_solve(PHandle *handle, PChart *chart)
 {
        PVert *v, *pin1 = chart->u.lscm.pin1, *pin2 = chart->u.lscm.pin2;
        PFace *f;
@@ -2830,7 +2830,7 @@ static PBool p_chart_lscm_solve(PChart *chart)
 
        for (v=chart->verts; v; v=v->nextlink)
                if (v->flag & PVERT_PIN)
-                       p_vert_load_pin_select_uvs(v); /* reload for live */
+                       p_vert_load_pin_select_uvs(handle, v); /* reload for live */
 
        if (chart->u.lscm.pin1) {
                nlLockVariable(2*pin1->u.id);
@@ -3860,6 +3860,8 @@ ParamHandle *param_construct_begin()
        handle->construction_chart = p_chart_new(handle);
        handle->state = PHANDLE_STATE_ALLOCATED;
        handle->arena = BLI_memarena_new((1<<16));
+       handle->aspx = 1.0f;
+       handle->aspy = 1.0f;
 
        handle->hash_verts = phash_new((PHashLink**)&handle->construction_chart->verts, 1);
        handle->hash_edges = phash_new((PHashLink**)&handle->construction_chart->edges, 1);
@@ -3868,6 +3870,14 @@ ParamHandle *param_construct_begin()
        return (ParamHandle*)handle;
 }
 
+void param_aspect_ratio(ParamHandle *handle, float aspx, float aspy)
+{
+       PHandle *phandle = (PHandle*)handle;
+
+       phandle->aspx = aspx;
+       phandle->aspy = aspy;
+}
+
 void param_delete(ParamHandle *handle)
 {
        PHandle *phandle = (PHandle*)handle;
@@ -3968,7 +3978,7 @@ void param_construct_end(ParamHandle *handle, ParamBool fill, ParamBool impl)
                        p_chart_fill_boundaries(chart, outer);
 
                for (v=chart->verts; v; v=v->nextlink)
-                       p_vert_load_pin_select_uvs(v);
+                       p_vert_load_pin_select_uvs(handle, v);
        }
 
        phandle->ncharts = j;
@@ -4005,7 +4015,7 @@ void param_lscm_solve(ParamHandle *handle)
                chart = phandle->charts[i];
 
                if (chart->u.lscm.context) {
-                       result = p_chart_lscm_solve(chart);
+                       result = p_chart_lscm_solve(phandle, chart);
 
                        if (result && !(chart->flag & PCHART_NOPACK))
                                p_chart_rotate_minimum_area(chart);
@@ -4128,6 +4138,9 @@ void param_pack(ParamHandle *handle)
        if (phandle->ncharts == 0)
                return;
        
+       if(phandle->aspx != phandle->aspy)
+               param_scale(handle, 1.0f/phandle->aspx, 1.0f/phandle->aspy);
+       
        /* we may not use all these boxes */
        boxarray = MEM_mallocN( phandle->ncharts*sizeof(boxPack), "boxPack box");
        
@@ -4170,8 +4183,10 @@ void param_pack(ParamHandle *handle)
                p_chart_uv_scale(chart, scale);
        }
        MEM_freeN(boxarray);
-}
 
+       if(phandle->aspx != phandle->aspy)
+               param_scale(handle, phandle->aspx, phandle->aspy);
+}
 
 void param_average(ParamHandle *handle)
 {
@@ -4255,9 +4270,9 @@ void param_flush(ParamHandle *handle)
                        continue;
 
                if (phandle->blend == 0.0f)
-                       p_flush_uvs(chart);
+                       p_flush_uvs(phandle, chart);
                else
-                       p_flush_uvs_blend(chart, phandle->blend);
+                       p_flush_uvs_blend(phandle, chart, phandle->blend);
        }
 }
 
index 766d461416dee06c3e9f541c6b38a498a6f5eb33..80fab110d5fd1747270949deffc5a9cc02e8f789 100644 (file)
@@ -26,6 +26,8 @@ typedef enum ParamBool {
 
 ParamHandle *param_construct_begin();
 
+void param_aspect_ratio(ParamHandle *handle, float aspx, float aspy);
+
 void param_face_add(ParamHandle *handle,
                     ParamKey key,
                     int nverts,        
index 6114ecc8696b360fe4bdbe71ab15c769fd2619fc..f7a32816b332125fec84471aad34399441eab20f 100644 (file)
@@ -184,6 +184,8 @@ typedef struct PHandle {
        PChart **charts;
        int ncharts;
 
+       float aspx, aspy;
+
        RNG *rng;
        float blend;
 } PHandle;
index b4d3a6c3ce24ddb0a052799ac2368c8e2705cb6a..efb52e696ab1ae953593be6ef82c865b56a354ff 100644 (file)
@@ -426,11 +426,9 @@ void reload_sequence_new_file(Sequence * seq)
 
        if (seq->type != SEQ_SCENE && seq->type != SEQ_META &&
            seq->type != SEQ_IMAGE) {
-               strncpy(str, seq->strip->dir, FILE_MAXDIR-1);
-               strncat(str, seq->strip->stripdata->name, FILE_MAXFILE-1);
-
+               BLI_join_dirfile(str, seq->strip->dir, seq->strip->stripdata->name);
                BLI_convertstringcode(str, G.sce);
-               BLI_convertstringframe(str, G.scene->r.cfra); /* TODO - is this needed? */
+               BLI_convertstringframe(str, G.scene->r.cfra);
                
        }
 
@@ -1707,9 +1705,7 @@ static void do_build_seq_ibuf(Sequence * seq, TStripElem *se, int cfra,
        } else if(seq->type == SEQ_IMAGE) {
                if(se->ok == STRIPELEM_OK && se->ibuf == 0) {
                        StripElem * s_elem = give_stripelem(seq, cfra);
-                       
-                       strncpy(name, seq->strip->dir, FILE_MAXDIR-1);
-                       strncat(name, s_elem->name, FILE_MAXFILE-1);
+                       BLI_join_dirfile(name, seq->strip->dir, s_elem->name);
                        BLI_convertstringcode(name, G.sce);
                        BLI_convertstringframe(name, G.scene->r.cfra);
                        if (!build_proxy_run) {
@@ -1738,8 +1734,7 @@ static void do_build_seq_ibuf(Sequence * seq, TStripElem *se, int cfra,
 
                        if (se->ibuf == 0) {
                                if(seq->anim==0) {
-                                       strncpy(name, seq->strip->dir, FILE_MAXDIR-1);
-                                       strncat(name, seq->strip->stripdata->name, FILE_MAXFILE-1);
+                                       BLI_join_dirfile(name, seq->strip->dir, seq->strip->stripdata->name);
                                        BLI_convertstringcode(name, G.sce);
                                        BLI_convertstringframe(name, G.scene->r.cfra);
                                
index 41e539c3d1ad85cb16cc060d03eb06763e0acef2..751cad1029dac8451ec636d3ebe3743f06f8e34c 100644 (file)
@@ -1745,25 +1745,42 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        if ( (G.obedit) && (G.obedit->type==OB_MESH) )
                                                select_faces_by_numverts(5);
                                }
+                               
+                               else if(G.qual==LR_CTRLKEY) {}
                                else do_layer_buttons(4);
                                break;
 
                        case SIXKEY:
-                               do_layer_buttons(5); break;
+                               if(G.qual==LR_CTRLKEY) {}
+                               else do_layer_buttons(5);
+                               break;
                        case SEVENKEY:
-                               do_layer_buttons(6); break;
+                               if(G.qual==LR_CTRLKEY) {}
+                               else do_layer_buttons(6);
+                               break;
                        case EIGHTKEY:
-                               do_layer_buttons(7); break;
+                               if(G.qual==LR_CTRLKEY) {}
+                               else do_layer_buttons(7);
+                               break;
                        case NINEKEY:
-                               do_layer_buttons(8); break;
+                               if(G.qual==LR_CTRLKEY) {}
+                               else do_layer_buttons(8);
+                               break;
                        case ZEROKEY:
-                               do_layer_buttons(9); break;
+                               if(G.qual==LR_CTRLKEY) {}
+                               else do_layer_buttons(9);
+                               break;
                        case MINUSKEY:
-                               do_layer_buttons(10); break;
+                               if(G.qual==LR_CTRLKEY) {}
+                               else do_layer_buttons(10);
+                               break;
                        case EQUALKEY:
-                               do_layer_buttons(11); break;
+                               if(G.qual==LR_CTRLKEY) {}
+                               else do_layer_buttons(11);
+                               break;
                        case ACCENTGRAVEKEY:
-                               do_layer_buttons(-1); break;
+                               do_layer_buttons(-1);
+                               break;
                        
                        case SPACEKEY:
                                if(G.qual == LR_CTRLKEY) {
@@ -4158,21 +4175,22 @@ void drawinfospace(ScrArea *sa, void *spacedata)
                        (xpos+edgsp+(1*midsp)+(1*mpref)),y6label,mpref,buth,
                        0, 0, 0, 0, 0, "");
 
-               uiDefButBitI(block, TOG, G_DOSCRIPTLINKS, REDRAWBUTSSCRIPT, "Enabled by Default",
+               uiDefButBitI(block, TOGN, USER_DONT_DOSCRIPTLINKS, REDRAWBUTSSCRIPT, "Enabled by Default",
                        (xpos+edgsp+(1*mpref)+(1*midsp)),y5,mpref,buth,
-                       &(G.f), 0, 0, 0, 0, "Allow any .blend file to run scripts automatically (unsafe with blend files from an untrusted source)");
+                       &(U.flag), 0, 0, 0, 0, "Allow any .blend file to run scripts automatically (unsafe with blend files from an untrusted source)");
                
                uiDefBut(block, LABEL,0,"Keyboard:",
-                       (xpos+edgsp+(3*midsp)+(3*mpref)),y3label,mpref,buth,
+                       (xpos+edgsp+(3*midsp)+(3*mpref)),y2label,mpref,buth,
                        0, 0, 0, 0, 0, "");
-
+               /* Not actually used anywhere! */
+               /*
                uiDefButBitI(block, TOG, USER_NO_CAPSLOCK, B_U_CAPSLOCK, "Disable Caps Lock",
                        (xpos+edgsp+(3*midsp)+(3*mpref)),y1,mpref,buth,
                        &(U.flag), 0, 0, 0, 0,
                        "Disables the Caps Lock key when entering text");
-
+               */
                uiDefButBitI(block, TOG, USER_NONUMPAD, 0, "Emulate Numpad",
-                       (xpos+edgsp+(3*midsp)+(3*mpref)),y2,mpref,buth,
+                       (xpos+edgsp+(3*midsp)+(3*mpref)),y1,mpref,buth,
                        &(U.flag), 0, 0, 0, 0,
                        "Causes the 1 to 0 keys to act as the numpad (useful for laptops)");
 
@@ -5041,8 +5059,10 @@ static void winqreadseqspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                case HKEY: /* hide==mute? - not that nice but MKey us used for meta :/ */
                        if((G.qual==0)) {
                                seq_mute_sel(1);
-                       } else if((G.qual==LR_ALTKEY)) {
+                       } else if(G.qual==LR_ALTKEY) {
                                seq_mute_sel(0);
+                       } else if(G.qual==LR_SHIFTKEY) {
+                               seq_mute_sel(-1);
                        }
                        break;
                case XKEY:
@@ -5611,6 +5631,7 @@ static void init_imaselspace(ScrArea *sa)
        simasel->files = BIF_filelist_new();
 }
 
+
 /* ******************** SPACE: OOPS ********************** */
 
 extern void drawoopsspace(ScrArea *sa, void *spacedata);
@@ -6155,39 +6176,7 @@ void newspace(ScrArea *sa, int type)
                }
        }
 
-               
-       /* exception: filespace */
-       if(sa->spacetype==SPACE_FILE) {
-               SpaceFile *sfile= sa->spacedata.first;
-               
-               if(sfile->type==FILE_MAIN) {
-                       freefilelist(sfile);
-               } else {
-                       sfile->type= FILE_UNIX;
-               }
-               
-               sfile->returnfunc= NULL;
-               sfile->title[0]= 0;
-               if(sfile->filelist) test_flags_file(sfile);
-       }
-       /* exception: imasel space */
-       else if(sa->spacetype==SPACE_IMASEL) {
-               SpaceImaSel *simasel= sa->spacedata.first;
-               if(simasel->type==FILE_MAIN) {
-                       if (simasel->files) {
-                               BIF_filelist_free(simasel->files);
-                               BIF_filelist_settype(simasel->files, FILE_MAIN);
-                       }
-               } else {
-                       if (simasel->files) {
-                               simasel->type= FILE_UNIX;
-                               BIF_filelist_settype(simasel->files, simasel->type);
-                       }
-               }
-               simasel->returnfunc= NULL;
-               simasel->title[0]= 0;
-       }
-       else if(sa->spacetype==SPACE_OOPS) {
+       if(sa->spacetype==SPACE_OOPS) {
                SpaceOops *so= sa->spacedata.first;
                if(xtra && so->type!=SO_OUTLINER) {
                        so->type= SO_OUTLINER;
index f3fec3cfec7f3d98be9cf20c17a4b42075cfc273..8859194ff9c65552066196ad39d6a5edbb25c70b 100644 (file)
@@ -3072,6 +3072,10 @@ static void set_trans_object_base_flags(TransInfo *t)
         */
        Base *base;
        
+       /* don't do it if we're not actually going to recalculate anything */
+       if(t->mode == TFM_DUMMY)
+               return;
+
        /* makes sure base flags and object flags are identical */
        copy_baseflags();
        
index fafae7458f17d9d8b004f042c1ca83c9678a1ce2..ee5ce0c914e49c20f327be12538b951fc15377d9 100644 (file)
@@ -200,6 +200,19 @@ ParamHandle *construct_param_handle(EditMesh *em, short implicit, short fill, sh
        ParamHandle *handle;
        
        handle = param_construct_begin();
+
+       if ((G.scene->toolsettings->uvcalc_flag & UVCALC_NO_ASPECT_CORRECT)==0) {
+               EditMesh *em = G.editMesh;
+               EditFace *efa = EM_get_actFace(1);
+               if (efa) {
+                       float aspx, aspy;
+                       MTFace *tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+                       image_final_aspect(tface->tpage, &aspx, &aspy);
+               
+                       if (aspx!=aspy)
+                               param_aspect_ratio(handle, aspx, aspy);
+               }
+       }
        
        /* we need the vert indicies */
        for (ev= em->verts.first, a=0; ev; ev= ev->next, a++)
@@ -314,21 +327,6 @@ void unwrap_lscm(short seamcut)
        param_lscm_begin(handle, PARAM_FALSE, abf);
        param_lscm_solve(handle);
        param_lscm_end(handle);
-
-       
-       /* scale before packing */
-       if ((G.scene->toolsettings->uvcalc_flag & UVCALC_NO_ASPECT_CORRECT)==0) {
-               EditFace *efa = EM_get_actFace(1);
-               if (efa) {
-                       float aspx, aspy;
-                       MTFace *tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-                       image_final_aspect(tface->tpage, &aspx, &aspy);
-               
-                       if (aspx!=aspy) {
-                               param_scale(handle, 1.0, aspx/aspy);
-                       }
-               }
-       }
        
        param_pack(handle);
 
index 2fd3a482a2758e68262a0d4114a9bcf692ca5dda..a4588bb459721fe8ba5555675277fd2d79c9e182 100644 (file)
@@ -451,6 +451,7 @@ int main(int argc, char **argv)
                                        sizx= atoi(argv[a]);
                                        a++;
                                        sizy= atoi(argv[a]);
+                                       G.windowstate = G_WINDOWSTATE_BORDER;
 
                                        break;
                                case 'd':
index 2339b840679c2cf1a193d46e723d89cd03d42601..64a17f44a845d56790ace94b811519a7009beb4d 100644 (file)
@@ -65,6 +65,7 @@ CPPFLAGS += -I../Network
 CPPFLAGS += -I../Network/LoopBackNetwork
 CPPFLAGS += -I../Physics/common
 CPPFLAGS += -I../Physics/Sumo
+CPPFLAGS += -I.
 
 ifeq ($(OS),windows)
     CPPFLAGS += -I../../blender
index 08e9e36c0483f5411a16da8d046ed11ffb103de7..089af9a68e7a6999b433991662404b7690b95db4 100644 (file)
@@ -2176,70 +2176,71 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
        {
                KX_GameObject* gameobj = (KX_GameObject*) sumolist->GetValue(i);
                struct Object* blenderobject = converter->FindBlenderObject(gameobj);
-               int nummeshes = gameobj->GetMeshCount();
-               RAS_MeshObject* meshobj = 0;
-        ListBase *conlist;
-        bConstraint *curcon;
-        conlist = get_active_constraints2(blenderobject);
-        if (conlist) {
-            for (curcon = (bConstraint *)conlist->first; curcon; curcon=(bConstraint *)curcon->next) {
-                if (curcon->type==CONSTRAINT_TYPE_RIGIDBODYJOINT){
-                    bRigidBodyJointConstraint *dat=(bRigidBodyJointConstraint *)curcon->data;
-                    //if (dat->tar)
-                        if (!dat->child){
-                                                       PHY_IPhysicsController* physctr2 = 0;
-                                                       if (dat->tar)
-                                                       {
-                                                               KX_GameObject *gotar=getGameOb(dat->tar->id.name,sumolist);
-                                                               if (gotar && gotar->GetPhysicsController())
-                                                                       physctr2 = (PHY_IPhysicsController*) gotar->GetPhysicsController()->GetUserData();
-                                                       }
+               ListBase *conlist;
+               bConstraint *curcon;
+               conlist = get_active_constraints2(blenderobject);
 
-                                                       if (gameobj->GetPhysicsController())
-                                                       {
-                                                               float radsPerDeg = 6.283185307179586232f / 360.f;
+               if (conlist) {
+                       for (curcon = (bConstraint *)conlist->first; curcon; curcon=(bConstraint *)curcon->next) {
+                               if (curcon->type==CONSTRAINT_TYPE_RIGIDBODYJOINT){
+
+                                       bRigidBodyJointConstraint *dat=(bRigidBodyJointConstraint *)curcon->data;
+
+                                       if (!dat->child){
+
+                                               PHY_IPhysicsController* physctr2 = 0;
+
+                                               if (dat->tar)
+                                               {
+                                                       KX_GameObject *gotar=getGameOb(dat->tar->id.name,sumolist);
+                                                       if (gotar && gotar->GetPhysicsController())
+                                                               physctr2 = (PHY_IPhysicsController*) gotar->GetPhysicsController()->GetUserData();
+                                               }
 
-                                                               PHY_IPhysicsController* physctrl = (PHY_IPhysicsController*) gameobj->GetPhysicsController()->GetUserData();
-                                                               //we need to pass a full constraint frame, not just axis
+                                               if (gameobj->GetPhysicsController())
+                                               {
+                                                       float radsPerDeg = 6.283185307179586232f / 360.f;
+
+                                                       PHY_IPhysicsController* physctrl = (PHY_IPhysicsController*) gameobj->GetPhysicsController()->GetUserData();
+                                                       //we need to pass a full constraint frame, not just axis
                                    
-                                                               //localConstraintFrameBasis
-                                                               MT_Matrix3x3 localCFrame(MT_Vector3(radsPerDeg*dat->axX,radsPerDeg*dat->axY,radsPerDeg*dat->axZ));
-                                                               MT_Vector3 axis0 = localCFrame.getColumn(0);
-                                                               MT_Vector3 axis1 = localCFrame.getColumn(1);
-                                                               MT_Vector3 axis2 = localCFrame.getColumn(2);
+                                                       //localConstraintFrameBasis
+                                                       MT_Matrix3x3 localCFrame(MT_Vector3(radsPerDeg*dat->axX,radsPerDeg*dat->axY,radsPerDeg*dat->axZ));
+                                                       MT_Vector3 axis0 = localCFrame.getColumn(0);
+                                                       MT_Vector3 axis1 = localCFrame.getColumn(1);
+                                                       MT_Vector3 axis2 = localCFrame.getColumn(2);
                                                                
-                                                               int constraintId = kxscene->GetPhysicsEnvironment()->createConstraint(physctrl,physctr2,(PHY_ConstraintType)dat->type,(float)dat->pivX,(float)dat->pivY,(float)dat->pivZ,
+                                                       int constraintId = kxscene->GetPhysicsEnvironment()->createConstraint(physctrl,physctr2,(PHY_ConstraintType)dat->type,(float)dat->pivX,
+                                                               (float)dat->pivY,(float)dat->pivZ,
                                                                (float)axis0.x(),(float)axis0.y(),(float)axis0.z(),
                                                                (float)axis1.x(),(float)axis1.y(),(float)axis1.z(),
-                                                               (float)axis2.x(),(float)axis2.y(),(float)axis2.z()
-                                                                                       );
-                                                               if (constraintId)
+                                                               (float)axis2.x(),(float)axis2.y(),(float)axis2.z());
+                                                       if (constraintId)
+                                                       {
+                                                               //if it is a generic 6DOF constraint, set all the limits accordingly
+                                                               if (dat->type == PHY_GENERIC_6DOF_CONSTRAINT)
                                                                {
-                                                                       //if it is a generic 6DOF constraint, set all the limits accordingly
-                                                                       if (dat->type == PHY_GENERIC_6DOF_CONSTRAINT)
+                                                                       int dof;
+                                                                       int dofbit=1;
+                                                                       for (dof=0;dof<6;dof++)
                                                                        {
-                                                                               int dof;
-                                                                               int dofbit=1;
-                                                                               for (dof=0;dof<6;dof++)
+                                                                               if (dat->flag & dofbit)
                                                                                {
-                                                                                       if (dat->flag & dofbit)
-                                                                                       {
-                                                                                               kxscene->GetPhysicsEnvironment()->setConstraintParam(constraintId,dof,dat->minLimit[dof],dat->maxLimit[dof]);
-                                                                                       } else
-                                                                                       {
-                                                                                               //minLimit > maxLimit means free(disabled limit) for this degree of freedom
-                                                                                               kxscene->GetPhysicsEnvironment()->setConstraintParam(constraintId,dof,1,-1);
-                                                                                       }
-                                                                                       dofbit<<=1;
+                                                                                       kxscene->GetPhysicsEnvironment()->setConstraintParam(constraintId,dof,dat->minLimit[dof],dat->maxLimit[dof]);
+                                                                               } else
+                                                                               {
+                                                                                       //minLimit > maxLimit means free(disabled limit) for this degree of freedom
+                                                                                       kxscene->GetPhysicsEnvironment()->setConstraintParam(constraintId,dof,1,-1);
                                                                                }
+                                                                               dofbit<<=1;
                                                                        }
                                                                }
                                                        }
-                        }
-                }
-            }
-        }
-
+                                               }
+                                       }
+                               }
+                       }
+               }
        }
 
        templist->Release();
index 747a82fc3336504bcdb74b412d539186e0da5892..c4f78f2311791acf8af93e652f2c9177ea1b4b26 100644 (file)
@@ -34,7 +34,7 @@ SOURCEDIR = source/gameengine/GamePlayer
 DIR = $(OCGDIR)/gameengine/GamePlayer
 DIRS = common ghost
 
-ifneq ($(NAN_NO_PLUGIN),true)
+ifeq ($(WITH_BF_WEBPLUGIN),true)
 ifeq ($(OS),$(findstring $(OS), "freebsd irix windows"))
        ifneq ($(FREE_WINDOWS),true)
            DIRS += netscape
index 254896e60e5520f27eeb0a57a5f143723c58a0dd..508dee187552fcf2d74ef89f80751cf5ac4f5791 100644 (file)
@@ -60,6 +60,7 @@ CPPFLAGS += -I../../../gameengine/Converter
 CPPFLAGS += -I../../../gameengine/Expressions
 CPPFLAGS += -I../../../gameengine/GameLogic
 CPPFLAGS += -I../../../gameengine/Converter
+CPPFLAGS += -I../../../gameengine/BlenderRoutines
 CPPFLAGS += -I../../../gameengine/Ketsji
 CPPFLAGS += -I../../../gameengine/Ketsji/KXNetwork
 CPPFLAGS += -I../../../gameengine/Network
index 8a3d194cbd7e553bed4a9aa3df4e2ecbc12f86b1..d5aae18139676b71198e5a9aa33a94b8e6a3194b 100644 (file)
@@ -69,6 +69,8 @@ CPPFLAGS += -I../../../blender/imbuf
 CPPFLAGS += -I../../../blender/makesdna
 CPPFLAGS += -I../../../blender/readblenfile
 
+CPPFLAGS += -I../../../gameengine/BlenderRoutines
+
 # kernel? GEN? stuff
 CPPFLAGS += -I../../../kernel/gen_system
 CPPFLAGS += -I../../../kernel/gen_messaging
index cb3180cb05e4af650bab399ceba30bfc54c4f624..27f4870de108ab7d2d79a5c2500cf000e33dab45 100644 (file)
@@ -155,14 +155,25 @@ static void Kx_VecUpMat3(float *vec, float mat[][3], short axis)
        mat[coz][0]= vec[0];
        mat[coz][1]= vec[1];
        mat[coz][2]= vec[2];
-       Kx_Normalize((float *)mat[coz]);
+       if (Kx_Normalize((float *)mat[coz]) == 0.f) {
+               /* this is a very abnormal situation: the camera has reach the object center exactly
+                  We will choose a completely arbitrary direction */
+               mat[coz][0] = 1.0f;
+               mat[coz][1] = 0.0f;
+               mat[coz][2] = 0.0f;
+       }
        
        inp= mat[coz][2];
        mat[coy][0]= - inp*mat[coz][0];
        mat[coy][1]= - inp*mat[coz][1];
        mat[coy][2]= 1.0 - inp*mat[coz][2];
 
-       Kx_Normalize((float *)mat[coy]);
+       if (Kx_Normalize((float *)mat[coy]) == 0.f) {
+               /* the camera is vertical, chose the y axis arbitrary */
+               mat[coy][0] = 0.f;
+               mat[coy][1] = 1.f;
+               mat[coy][2] = 0.f;
+       }
        
        Kx_Crossf(mat[cox], mat[coy], mat[coz]);
        
index 4c6ba448ebf8661bb9b469b4cc8d3892d71aaa1d..fb636b230824b9f42bc38382300bd8ac1d192ce6 100644 (file)
@@ -581,16 +581,27 @@ void KX_GameObject::SetObjectColor(const MT_Vector4& rgbavec)
 
 
 
-MT_Vector3 KX_GameObject::GetLinearVelocity()
+MT_Vector3 KX_GameObject::GetLinearVelocity(bool local)
 {
        MT_Vector3 velocity(0.0,0.0,0.0);
-       
+       MT_Matrix3x3 ori, locvel;
+       int i, j; 
        if (m_pPhysicsController1)
        {
                velocity = m_pPhysicsController1->GetLinearVelocity();
+               
+               if (local)
+               {
+                       ori = GetSGNode()->GetWorldOrientation();
+                       
+                       for(i=0; i < 3; i++)
+                               for(j=0; j < 3; j++)
+                                       locvel[i][j]= velocity[i]*ori[i][j];
+                       for(i=0; i < 3; i++)
+                               velocity[i] = locvel[0][i] + locvel[1][i] + locvel[2][i];
+               }
        }
-       return velocity;
-       
+       return velocity;        
 }
 
 
@@ -948,7 +959,15 @@ PyObject* KX_GameObject::PyGetLinearVelocity(PyObject* self,
                                                                                         PyObject* kwds)
 {
        // only can get the velocity if we have a physics object connected to us...
-       return PyObjectFrom(GetLinearVelocity());
+       int local = 0;
+       if (PyArg_ParseTuple(args,"|i",&local))
+       {
+               return PyObjectFrom(GetLinearVelocity((local!=0)));
+       }
+       else
+       {
+               return NULL;
+       }
 }
 
 
index da0cd69e129d05c41353cba54457b627b159c5d5..b83d63e26bfa7d70b47f19f68997a6b630bb0293 100644 (file)
@@ -252,8 +252,9 @@ public:
        /** 
         * Return the linear velocity of the game object.
         */
-               MT_Vector3                      
+               MT_Vector3 
        GetLinearVelocity(
+               bool local=false
        );
 
        /** 
index 31c9993e194f13bc34ea352dddc4fe950716583f..8ef82b4943b3d76e5c00776d51b258c7cdbe84cf 100644 (file)
@@ -58,15 +58,16 @@ class KX_GameObject:
                @rtype: 3x3 rotation matrix
                @return: The game object's rotation matrix
                """
-       def getLinearVelocity():
+       def getLinearVelocity(local):
                """
                Gets the game object's linear velocity.
                
                This method returns the game object's velocity through it's centre of mass,
                ie no angular velocity component.
                
-               cf getVelocity()
-               
+               @type local: boolean
+               @param local: - False: you get the "global" velocity ie: relative to world orientation.
+                             - True: you get the "local" velocity ie: relative to object orientation.
                @rtype: list [vx, vy, vz]
                @return: the object's linear velocity.
                """
@@ -138,6 +139,9 @@ class KX_GameObject:
        def setParent(parent):
                """
                Sets this object's parent.
+               
+               @type parent: L{KX_GameObject}
+               @param parent: new parent object.
                """
        def removeParent():
                """
index 9cde606916728a074477a483f7a675d719ca7096..d544056e8ae5dbf7c1c23b7e6124f19f0d2bec2f 100644 (file)
@@ -39,6 +39,8 @@ CPPFLAGS += -I$(OPENGL_HEADERS)
 CPPFLAGS += -I$(NAN_STRING)/include    
 CPPFLAGS += -I$(NAN_MOTO)/include
 CPPFLAGS += -I../../kernel/gen_system
+CPPFLAGS += -I../BlenderRoutines
+
 ifeq ($(OS),darwin)
        CPPFLAGS += -fpascal-strings
 endif
index b0d79dcc897ac1ee198cfd101b6222ab5538c199..1a88c51dc2596dd43431e9223be7eecfdb90d273 100644 (file)
@@ -40,6 +40,7 @@ CPPFLAGS += -I$(OPENGL_HEADERS)
 CPPFLAGS += -I$(NAN_STRING)/include    
 CPPFLAGS += -I$(NAN_MOTO)/include
 CPPFLAGS += -I../../../kernel/gen_system
+CPPFLAGS += -I../../BlenderRoutines
 CPPFLAGS += -I..
 ifeq ($(OS),darwin)
        CPPFLAGS += -fpascal-strings
index 43345817f2e627539eed5a3987fc973bb46ce20f..e19d10dba641dc0d1651adc1f828d0a4342c8e03 100644 (file)
@@ -64,7 +64,11 @@ all debug::
     export WITH_BF_STATICOPENGL ?= false
     export WITH_BF_BLENDERGAMEENGINE ?= true
     export WITH_BF_BLENDERPLAYER ?= true
-    export WITH_BF_WEBPLUGIN ?= false
+    ifeq ($(NAN_NO_PLUGIN), true)
+        export WITH_BF_WEBPLUGIN = false
+    else
+        export WITH_BF_WEBPLUGIN ?= false
+    endif
 
     export NAN_MOTO ?= $(LCGDIR)/moto
 ifeq ($(FREE_WINDOWS), true)