This commit is contained in:
Campbell Barton 2011-09-13 07:19:36 +00:00
commit 9c4165fde0
172 changed files with 3439 additions and 2953 deletions

@ -14,7 +14,7 @@ USE_SDK=True
################### Cocoa & architecture settings ################## ################### Cocoa & architecture settings ##################
############################################################################# #############################################################################
WITH_GHOST_COCOA=True WITH_GHOST_COCOA=True
MACOSX_ARCHITECTURE = 'i386' # valid archs: ppc, i386, ppc64, x86_64 MACOSX_ARCHITECTURE = 'x86_64' # valid archs: ppc, i386, ppc64, x86_64
cmd = 'uname -p' cmd = 'uname -p'
@ -104,14 +104,26 @@ BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
BF_FFMPEG_LIB = 'avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg bz2' BF_FFMPEG_LIB = 'avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg bz2'
#bz2 is a standard osx dynlib #bz2 is a standard osx dynlib
# python 3.1 uses precompiled libraries in bf svn /lib by default
BF_PYTHON_VERSION = '3.2' BF_PYTHON_VERSION = '3.2'
BF_PYTHON = LIBDIR + '/python' WITH_OSX_STATICPYTHON = True
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
# BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}' if WITH_OSX_STATICPYTHON:
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}' # python 3.2 uses precompiled libraries in bf svn /lib by default
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
# BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System'] BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
# BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
# BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
else:
# python 3.2 uses Python-framework additionally installed in /Library/Frameworks
BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}m'
BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
#BF_PYTHON_LIB = ''
BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config-3.2m'
WITH_BF_OPENAL = True WITH_BF_OPENAL = True
#different lib must be used following version of gcc #different lib must be used following version of gcc
@ -315,6 +327,10 @@ if WITH_BF_QUICKTIME:
else: else:
PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QuickTime'] PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QuickTime']
if not WITH_OSX_STATICPYTHON:
PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','Python']
#note to build succesfully on 10.3.9 SDK you need to patch 10.3.9 by adding the SystemStubs.a lib from 10.4 #note to build succesfully on 10.3.9 SDK you need to patch 10.3.9 by adding the SystemStubs.a lib from 10.4
#for 10.7.sdk, SystemStubs needs to be excluded (lib doesn't exist anymore) #for 10.7.sdk, SystemStubs needs to be excluded (lib doesn't exist anymore)
if MACOSX_DEPLOYMENT_TARGET == '10.7': if MACOSX_DEPLOYMENT_TARGET == '10.7':

@ -40,7 +40,7 @@ BF_JACK_INC = '${BF_JACK}/include ${BF_FFMPEG}/include/msvc'
BF_JACK_LIB = 'libjack' BF_JACK_LIB = 'libjack'
BF_JACK_LIBPATH = '${BF_JACK}/lib' BF_JACK_LIBPATH = '${BF_JACK}/lib'
WITH_BF_SNDFILE = False WITH_BF_SNDFILE = True
BF_SNDFILE = LIBDIR + '/sndfile' BF_SNDFILE = LIBDIR + '/sndfile'
BF_SNDFILE_INC = '${BF_SNDFILE}/include' BF_SNDFILE_INC = '${BF_SNDFILE}/include'
BF_SNDFILE_LIB = 'libsndfile-1' BF_SNDFILE_LIB = 'libsndfile-1'

@ -536,7 +536,10 @@ def AppIt(target=None, source=None, env=None):
print("Installing to %s"%(installdir)) print("Installing to %s"%(installdir))
# TODO, use tar. # TODO, use tar.
python_zip = 'python_' + osxarch + '.zip' # set specific python_arch.zip python_zip = 'python_' + osxarch + '.zip' # set specific python_arch.zip
if env['WITH_OSX_STATICPYTHON']:
print("unzipping to app-bundle: %s"%(python_zip)) print("unzipping to app-bundle: %s"%(python_zip))
else:
print("dynamic build - make sure to have python3.x-framework installed")
bldroot = env.Dir('.').abspath bldroot = env.Dir('.').abspath
binary = env['BINARYKIND'] binary = env['BINARYKIND']
@ -569,6 +572,7 @@ def AppIt(target=None, source=None, env=None):
commands.getoutput(cmd) commands.getoutput(cmd)
cmd = 'cp %s/release/bin/%s/.Blanguages %s/%s.app/Contents/Resources/'%(bldroot,VERSION,installdir,binary) cmd = 'cp %s/release/bin/%s/.Blanguages %s/%s.app/Contents/Resources/'%(bldroot,VERSION,installdir,binary)
commands.getoutput(cmd) commands.getoutput(cmd)
if env['WITH_OSX_STATICPYTHON']:
cmd = 'mkdir %s/%s.app/Contents/MacOS/%s/python/'%(installdir,binary, VERSION) cmd = 'mkdir %s/%s.app/Contents/MacOS/%s/python/'%(installdir,binary, VERSION)
commands.getoutput(cmd) commands.getoutput(cmd)
cmd = 'unzip -q %s/release/%s -d %s/%s.app/Contents/MacOS/%s/python/'%(libdir,python_zip,installdir,binary,VERSION) cmd = 'unzip -q %s/release/%s -d %s/%s.app/Contents/MacOS/%s/python/'%(libdir,python_zip,installdir,binary,VERSION)

@ -78,7 +78,7 @@ def print_arguments(args, bc):
def validate_arguments(args, bc): def validate_arguments(args, bc):
opts_list = [ opts_list = [
'WITH_BF_PYTHON', 'WITH_BF_PYTHON_SAFETY', 'BF_PYTHON', 'BF_PYTHON_VERSION', 'BF_PYTHON_INC', 'BF_PYTHON_BINARY', 'BF_PYTHON_LIB', 'BF_PYTHON_LIBPATH', 'WITH_BF_STATICPYTHON', 'BF_PYTHON_LIB_STATIC', 'BF_PYTHON_DLL', 'BF_PYTHON_ABI_FLAGS', 'WITH_BF_PYTHON', 'WITH_BF_PYTHON_SAFETY', 'BF_PYTHON', 'BF_PYTHON_VERSION', 'BF_PYTHON_INC', 'BF_PYTHON_BINARY', 'BF_PYTHON_LIB', 'BF_PYTHON_LIBPATH', 'WITH_BF_STATICPYTHON', 'WITH_OSX_STATICPYTHON', 'BF_PYTHON_LIB_STATIC', 'BF_PYTHON_DLL', 'BF_PYTHON_ABI_FLAGS',
'WITH_BF_OPENAL', 'BF_OPENAL', 'BF_OPENAL_INC', 'BF_OPENAL_LIB', 'BF_OPENAL_LIBPATH', 'WITH_BF_STATICOPENAL', 'BF_OPENAL_LIB_STATIC', 'WITH_BF_OPENAL', 'BF_OPENAL', 'BF_OPENAL_INC', 'BF_OPENAL_LIB', 'BF_OPENAL_LIBPATH', 'WITH_BF_STATICOPENAL', 'BF_OPENAL_LIB_STATIC',
'WITH_BF_SDL', 'BF_SDL', 'BF_SDL_INC', 'BF_SDL_LIB', 'BF_SDL_LIBPATH', 'WITH_BF_SDL', 'BF_SDL', 'BF_SDL_INC', 'BF_SDL_LIB', 'BF_SDL_LIBPATH',
'BF_LIBSAMPLERATE', 'BF_LIBSAMPLERATE_INC', 'BF_LIBSAMPLERATE_LIB', 'BF_LIBSAMPLERATE_LIBPATH', 'WITH_BF_STATICLIBSAMPLERATE', 'BF_LIBSAMPLERATE_LIB_STATIC', 'BF_LIBSAMPLERATE', 'BF_LIBSAMPLERATE_INC', 'BF_LIBSAMPLERATE_LIB', 'BF_LIBSAMPLERATE_LIBPATH', 'WITH_BF_STATICLIBSAMPLERATE', 'BF_LIBSAMPLERATE_LIB_STATIC',
@ -230,6 +230,7 @@ def read_opts(env, cfg, args):
('BF_PYTHON_LIBPATH', 'Library path', ''), ('BF_PYTHON_LIBPATH', 'Library path', ''),
('BF_PYTHON_LINKFLAGS', 'Python link flags', ''), ('BF_PYTHON_LINKFLAGS', 'Python link flags', ''),
(BoolVariable('WITH_BF_STATICPYTHON', 'Staticly link to python', False)), (BoolVariable('WITH_BF_STATICPYTHON', 'Staticly link to python', False)),
(BoolVariable('WITH_OSX_STATICPYTHON', 'Staticly link to python', True)),
('BF_PYTHON_ABI_FLAGS', 'Python ABI flags (suffix in library version: m, mu, etc)', ''), ('BF_PYTHON_ABI_FLAGS', 'Python ABI flags (suffix in library version: m, mu, etc)', ''),
(BoolVariable('BF_NO_ELBEEM', 'Disable Fluid Sim', False)), (BoolVariable('BF_NO_ELBEEM', 'Disable Fluid Sim', False)),

@ -215,6 +215,18 @@ Functions
:type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures) :type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures)
:rtype: boolean :rtype: boolean
.. function:: setAnisotropicFiltering(level)
Set the anisotropic filtering level for textures.
:arg level: The new anisotropic filtering level to use
:type level: integer (must be one of 1, 2, 4, 8, 16)
.. function:: getAnisotropicFiltering()
Get the anisotropic filtering level used for textures.
:rtype: integer (one of 1, 2, 4, 8, 16)
.. function:: drawLine(fromVec,toVec,color) .. function:: drawLine(fromVec,toVec,color)

@ -1539,7 +1539,7 @@ Game Types (bge.types)
Return the value matching key, or the default value if its not found. Return the value matching key, or the default value if its not found.
:return: The key value or a default. :return: The key value or a default.
.. method:: playAction(name, start_frame, end_frame, layer=0, priority=0 blendin=0, play_mode=ACT_MODE_PLAY, layer_weight=0.0, ipo_flags=0, speed=1.0) .. method:: playAction(name, start_frame, end_frame, layer=0, priority=0, blendin=0, play_mode=ACT_MODE_PLAY, layer_weight=0.0, ipo_flags=0, speed=1.0)
Plays an action. Plays an action.
@ -1556,7 +1556,7 @@ Game Types (bge.types)
:arg blendin: the amount of blending between this animation and the previous one on this layer :arg blendin: the amount of blending between this animation and the previous one on this layer
:type blendin: float :type blendin: float
:arg play_mode: the play mode :arg play_mode: the play mode
:type play_mode: KX_ACTION_PLAY, KX_ACTION_LOOP, or KX_ACTION_PING_PONG :type play_mode: KX_ACTION_MODE_PLAY, KX_ACTION_MODE_LOOP, or KX_ACTION_MODE_PING_PONG
:arg layer_weight: how much of the previous layer to use for blending (0 = add) :arg layer_weight: how much of the previous layer to use for blending (0 = add)
:type layer_weight: float :type layer_weight: float
:arg ipo_flags: flags for the old IPO behaviors (force, etc) :arg ipo_flags: flags for the old IPO behaviors (force, etc)
@ -1579,6 +1579,7 @@ Game Types (bge.types)
:type layer: integer :type layer: integer
:return: The current frame of the action :return: The current frame of the action
:rtype: float
.. method:: setActionFrame(frame, layer=0) .. method:: setActionFrame(frame, layer=0)
@ -1596,6 +1597,9 @@ Game Types (bge.types)
:arg layer: The layer to check for a playing action. :arg layer: The layer to check for a playing action.
:type layer: integer :type layer: integer
:return: Whether or not the action is playing
:rtype: boolean
.. class:: KX_IpoActuator(SCA_IActuator) .. class:: KX_IpoActuator(SCA_IActuator)
IPO actuator activates an animation. IPO actuator activates an animation.

@ -0,0 +1,57 @@
###############
Tips and Tricks
###############
Some of these are just python features that scripters may not have thaught to use with blender.
****************
Use The Terminal
****************
For Linux and OSX users this means starting the terminal first, then running blender from within it. on Windows the terminal can be enabled from the help menu.
********************
Run External Scripts
********************
******************
Don't Use Blender!
******************
******************
Use External Tools
******************
**************
Bundled Python
**************
Blender from blender.org includes a compleate python installation on all platforms, this has the disadvantage that any extensions you have installed in you're systems python wont be found by blender.
There are 2 ways around this:
* remove blender python subdirectory, blender will then look for the systems python and use that instead **python version must match the one that blender comes with**.
* copy the extensions into blender's python subdirectry so blender can access them, you could also copy the entire python installation into blenders subdirectory, replacing the one blender comes with. This works as long as the python versions match and the paths are created in the same location relative locations. Doing this has the advantage that you can redistribute this bundle to others with blender and/or the game player, including any extensions you rely on.
********
Advanced
********
===================
Blender as a module
===================
============================
Python Safety (Build Option)
============================
=================
CTypes in Blender
=================

@ -1,3 +1,33 @@
/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* Copyright 2009-2011 Jörg Hermann Müller
*
* This file is part of AudaSpace.
*
* Audaspace is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* AudaSpace is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Audaspace; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file audaspace/intern/AUD_JOSResampleReaderCoeff.cpp
* \ingroup audaspaceintern
*/
#include "AUD_JOSResampleReader.h" #include "AUD_JOSResampleReader.h"
// sinc filter coefficients, Nz = 136, L = 2304, freq = 0.963904, Kaiser Window B = 16 // sinc filter coefficients, Nz = 136, L = 2304, freq = 0.963904, Kaiser Window B = 16

@ -516,7 +516,7 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::setVolumeMaximum(float volume)
float AUD_SoftwareDevice::AUD_SoftwareHandle::getVolumeMinimum() float AUD_SoftwareDevice::AUD_SoftwareHandle::getVolumeMinimum()
{ {
if(!m_status) if(!m_status)
return std::numeric_limits<float>::quiet_NaN();; return std::numeric_limits<float>::quiet_NaN();
return m_volume_min; return m_volume_min;
} }
@ -634,7 +634,7 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::setConeAngleInner(float angle)
float AUD_SoftwareDevice::AUD_SoftwareHandle::getConeVolumeOuter() float AUD_SoftwareDevice::AUD_SoftwareHandle::getConeVolumeOuter()
{ {
if(!m_status) if(!m_status)
return std::numeric_limits<float>::quiet_NaN();; return std::numeric_limits<float>::quiet_NaN();
return m_cone_volume_outer; return m_cone_volume_outer;
} }

@ -70,7 +70,7 @@ GHOST_TSuccess GHOST_ISystemPaths::create()
# ifdef GHOST_COCOA # ifdef GHOST_COCOA
m_systemPaths = new GHOST_SystemPathsCocoa (); m_systemPaths = new GHOST_SystemPathsCocoa ();
# else # else
m_systemPaths = new GHOST_SystemPathsarbon (); m_systemPaths = new GHOST_SystemPathsCarbon ();
# endif # endif
# else # else
m_systemPaths = new GHOST_SystemPathsX11 (); m_systemPaths = new GHOST_SystemPathsX11 ();

@ -39,7 +39,7 @@
GHOST_TSuccess GHOST_CreateSystemPaths(void) GHOST_TSuccess GHOST_CreateSystemPaths(void)
{ {
return GHOST_ISystemPaths::create();; return GHOST_ISystemPaths::create();
} }
GHOST_TSuccess GHOST_DisposeSystemPaths(void) GHOST_TSuccess GHOST_DisposeSystemPaths(void)

@ -48,7 +48,9 @@
#include "GHOST_EventButton.h" #include "GHOST_EventButton.h"
#include "GHOST_EventCursor.h" #include "GHOST_EventCursor.h"
#include "GHOST_EventWheel.h" #include "GHOST_EventWheel.h"
#ifdef WITH_INPUT_NDOF
#include "GHOST_EventNDOF.h" #include "GHOST_EventNDOF.h"
#endif
#include "GHOST_TimerManager.h" #include "GHOST_TimerManager.h"
#include "GHOST_TimerTask.h" #include "GHOST_TimerTask.h"
@ -1101,7 +1103,9 @@ OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, Even
GHOST_SystemCarbon* sys = (GHOST_SystemCarbon*) userData; GHOST_SystemCarbon* sys = (GHOST_SystemCarbon*) userData;
OSStatus err = eventNotHandledErr; OSStatus err = eventNotHandledErr;
GHOST_IWindow* window; GHOST_IWindow* window;
#ifdef WITH_INPUT_NDOF
GHOST_TEventNDOFData data; GHOST_TEventNDOFData data;
#endif
UInt32 kind; UInt32 kind;
switch (::GetEventClass(event)) switch (::GetEventClass(event))
@ -1122,6 +1126,7 @@ OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, Even
err = sys->handleKeyEvent(event); err = sys->handleKeyEvent(event);
break; break;
case kEventClassBlender : case kEventClassBlender :
#ifdef WITH_INPUT_NDOF
window = sys->m_windowManager->getActiveWindow(); window = sys->m_windowManager->getActiveWindow();
sys->m_ndofManager->GHOST_NDOFGetDatas(data); sys->m_ndofManager->GHOST_NDOFGetDatas(data);
kind = ::GetEventKind(event); kind = ::GetEventKind(event);
@ -1137,6 +1142,7 @@ OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, Even
// printf("button\n"); // printf("button\n");
break; break;
} }
#endif
err = noErr; err = noErr;
break; break;
default : default :

@ -866,6 +866,8 @@ GHOST_TSuccess GHOST_WindowWin32::installDrawingContext(GHOST_TDrawingContextTyp
{ {
// Make sure we don't screw up the context // Make sure we don't screw up the context
if (m_hGlRc == s_firsthGLRc)
s_firsthGLRc = NULL;
m_drawingContextType = GHOST_kDrawingContextTypeOpenGL; m_drawingContextType = GHOST_kDrawingContextTypeOpenGL;
removeDrawingContext(); removeDrawingContext();

@ -88,7 +88,7 @@ typedef unsigned long uintptr_t;
#define _UINTPTR_T_DEFINED #define _UINTPTR_T_DEFINED
#endif #endif
#elif defined(__linux__) || defined(__NetBSD__) #elif defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__)
/* Linux-i386, Linux-Alpha, Linux-ppc */ /* Linux-i386, Linux-Alpha, Linux-ppc */
#include <stdint.h> #include <stdint.h>

@ -319,7 +319,7 @@ void IK_QSegment::RemoveChild(IK_QSegment *child)
else { else {
IK_QSegment *seg = m_child; IK_QSegment *seg = m_child;
while (seg->m_sibling != child); while (seg->m_sibling != child)
seg = seg->m_sibling; seg = seg->m_sibling;
if (child == seg->m_sibling) if (child == seg->m_sibling)

@ -89,7 +89,7 @@ typedef unsigned long uintptr_t;
#define _UINTPTR_T_DEFINED #define _UINTPTR_T_DEFINED
#endif #endif
#elif defined(__linux__) || defined(__NetBSD__) #elif defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__)
/* Linux-i386, Linux-Alpha, Linux-ppc */ /* Linux-i386, Linux-Alpha, Linux-ppc */
#include <stdint.h> #include <stdint.h>

@ -185,9 +185,13 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, Panel):
layout.template_ID(ob, "pose_library", new="poselib.new", unlink="poselib.unlink") layout.template_ID(ob, "pose_library", new="poselib.new", unlink="poselib.unlink")
if poselib: if poselib:
# list of poses in pose library
row = layout.row() row = layout.row()
row.template_list(poselib, "pose_markers", poselib.pose_markers, "active_index", rows=5) row.template_list(poselib, "pose_markers", poselib.pose_markers, "active_index", rows=5)
# column of operators for active pose
# - goes beside list
col = row.column(align=True) col = row.column(align=True)
col.active = (poselib.library is None) col.active = (poselib.library is None)
@ -203,7 +207,11 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, Panel):
col.operator("poselib.pose_remove", icon='ZOOMOUT', text="").pose = pose_marker_active.name col.operator("poselib.pose_remove", icon='ZOOMOUT', text="").pose = pose_marker_active.name
col.operator("poselib.apply_pose", icon='ZOOM_SELECTED', text="").pose_index = poselib.pose_markers.active_index col.operator("poselib.apply_pose", icon='ZOOM_SELECTED', text="").pose_index = poselib.pose_markers.active_index
layout.operator("poselib.action_sanitise") col.operator("poselib.action_sanitise", icon='HELP', text="") # XXX: put in menu?
# properties for active marker
if pose_marker_active is not None:
layout.prop(pose_marker_active, "name")
# TODO: this panel will soon be depreceated too # TODO: this panel will soon be depreceated too

@ -340,10 +340,12 @@ class RENDER_PT_game_performance(RenderButtonsPanel, Panel):
layout = self.layout layout = self.layout
gs = context.scene.game_settings gs = context.scene.game_settings
row = layout.row() col = layout.column()
row = col.row()
row.prop(gs, "use_frame_rate") row.prop(gs, "use_frame_rate")
row.prop(gs, "use_display_lists") row.prop(gs, "use_display_lists")
row.prop(gs, "restrict_animation_updates")
col.prop(gs, "restrict_animation_updates")
class RENDER_PT_game_display(RenderButtonsPanel, Panel): class RENDER_PT_game_display(RenderButtonsPanel, Panel):

@ -213,7 +213,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
{ {
unsigned char *cbuf; unsigned char *cbuf;
unsigned int c; unsigned int c;
unsigned char b_col_char[3]; unsigned char b_col_char[4];
GlyphBLF *g, *g_prev; GlyphBLF *g, *g_prev;
FT_Vector delta; FT_Vector delta;
FT_UInt glyph_index; FT_UInt glyph_index;
@ -232,6 +232,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
b_col_char[0]= font->b_col[0] * 255; b_col_char[0]= font->b_col[0] * 255;
b_col_char[1]= font->b_col[1] * 255; b_col_char[1]= font->b_col[1] * 255;
b_col_char[2]= font->b_col[2] * 255; b_col_char[2]= font->b_col[2] * 255;
b_col_char[3]= font->b_col[3] * 255;
while (str[i]) { while (str[i]) {
int pen_y; int pen_y;
@ -296,16 +297,19 @@ void blf_font_buffer(FontBLF *font, const char *str)
a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f; a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f;
if(a > 0.0f) { if(a > 0.0f) {
float alphatest;
fbuf= font->b_fbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw)); fbuf= font->b_fbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw));
if (a >= 1.0f) { if (a >= 1.0f) {
fbuf[0]= font->b_col[0]; fbuf[0]= font->b_col[0];
fbuf[1]= font->b_col[1]; fbuf[1]= font->b_col[1];
fbuf[2]= font->b_col[2]; fbuf[2]= font->b_col[2];
fbuf[3]= (alphatest= (fbuf[3] + (font->b_col[3]))) < 1.0f ? alphatest : 1.0f;
} }
else { else {
fbuf[0]= (font->b_col[0]*a) + (fbuf[0] * (1-a)); fbuf[0]= (font->b_col[0]*a) + (fbuf[0] * (1-a));
fbuf[1]= (font->b_col[1]*a) + (fbuf[1] * (1-a)); fbuf[1]= (font->b_col[1]*a) + (fbuf[1] * (1-a));
fbuf[2]= (font->b_col[2]*a) + (fbuf[2] * (1-a)); fbuf[2]= (font->b_col[2]*a) + (fbuf[2] * (1-a));
fbuf[3]= (alphatest= (fbuf[3] + (font->b_col[3]*a))) < 1.0f ? alphatest : 1.0f;
} }
} }
} }
@ -324,16 +328,19 @@ void blf_font_buffer(FontBLF *font, const char *str)
a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f; a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f;
if(a > 0.0f) { if(a > 0.0f) {
int alphatest;
cbuf= font->b_cbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw)); cbuf= font->b_cbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw));
if (a >= 1.0f) { if (a >= 1.0f) {
cbuf[0]= b_col_char[0]; cbuf[0]= b_col_char[0];
cbuf[1]= b_col_char[1]; cbuf[1]= b_col_char[1];
cbuf[2]= b_col_char[2]; cbuf[2]= b_col_char[2];
cbuf[3]= (alphatest= ((int)cbuf[3] + (int)b_col_char[3])) < 255 ? alphatest : 255;
} }
else { else {
cbuf[0]= (b_col_char[0]*a) + (cbuf[0] * (1-a)); cbuf[0]= (b_col_char[0]*a) + (cbuf[0] * (1-a));
cbuf[1]= (b_col_char[1]*a) + (cbuf[1] * (1-a)); cbuf[1]= (b_col_char[1]*a) + (cbuf[1] * (1-a));
cbuf[2]= (b_col_char[2]*a) + (cbuf[2] * (1-a)); cbuf[2]= (b_col_char[2]*a) + (cbuf[2] * (1-a));
cbuf[3]= (alphatest= ((int)cbuf[3] + (int)((font->b_col[3]*a)*255.0f))) < 255 ? alphatest : 255;
} }
} }
} }

@ -1091,7 +1091,7 @@ static int cloth_collision_response_moving ( ClothModifierData *clmd, CollisionM
VECADDMUL(cloth1->verts[collpair->ap1].impulse, pimpulse, w1*2.0); VECADDMUL(cloth1->verts[collpair->ap1].impulse, pimpulse, w1*2.0);
VECADDMUL(cloth1->verts[collpair->ap2].impulse, pimpulse, w2*2.0); VECADDMUL(cloth1->verts[collpair->ap2].impulse, pimpulse, w2*2.0);
VECADDMUL(cloth1->verts[collpair->ap3].impulse, pimpulse, w3*2.0);; VECADDMUL(cloth1->verts[collpair->ap3].impulse, pimpulse, w3*2.0);
cloth1->verts[collpair->ap1].impulse_count++; cloth1->verts[collpair->ap1].impulse_count++;
cloth1->verts[collpair->ap2].impulse_count++; cloth1->verts[collpair->ap2].impulse_count++;
cloth1->verts[collpair->ap3].impulse_count++; cloth1->verts[collpair->ap3].impulse_count++;
@ -1487,8 +1487,8 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2,
sdis = clmd->coll_parms->distance_repel + epsilon2 + FLT_EPSILON; sdis = clmd->coll_parms->distance_repel + epsilon2 + FLT_EPSILON;
/*apply a repulsion force, to help the solver along. /* apply a repulsion force, to help the solver along.
this is kindof crude, it only tests one vert of the triangle*/ * this is kindof crude, it only tests one vert of the triangle */
if (isect_ray_plane_v3(cloth->verts[collpair->ap1].tx, n2, collmd->current_xnew[collpair->bp1].co, if (isect_ray_plane_v3(cloth->verts[collpair->ap1].tx, n2, collmd->current_xnew[collpair->bp1].co,
collmd->current_xnew[collpair->bp2].co, collmd->current_xnew[collpair->bp2].co,
collmd->current_xnew[collpair->bp3].co, &l, 0)) collmd->current_xnew[collpair->bp3].co, &l, 0))

@ -808,41 +808,65 @@ static void layerDefault_mcol(void *data, int count)
static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
/* 0: CD_MVERT */
{sizeof(MVert), "MVert", 1, NULL, NULL, NULL, NULL, NULL, NULL}, {sizeof(MVert), "MVert", 1, NULL, NULL, NULL, NULL, NULL, NULL},
/* 1: CD_MSTICKY */
{sizeof(MSticky), "MSticky", 1, NULL, NULL, NULL, layerInterp_msticky, NULL, {sizeof(MSticky), "MSticky", 1, NULL, NULL, NULL, layerInterp_msticky, NULL,
NULL}, NULL},
/* 2: CD_MDEFORMVERT */
{sizeof(MDeformVert), "MDeformVert", 1, NULL, layerCopy_mdeformvert, {sizeof(MDeformVert), "MDeformVert", 1, NULL, layerCopy_mdeformvert,
layerFree_mdeformvert, layerInterp_mdeformvert, NULL, NULL}, layerFree_mdeformvert, layerInterp_mdeformvert, NULL, NULL},
/* 3: CD_MEDGE */
{sizeof(MEdge), "MEdge", 1, NULL, NULL, NULL, NULL, NULL, NULL}, {sizeof(MEdge), "MEdge", 1, NULL, NULL, NULL, NULL, NULL, NULL},
/* 4: CD_MFACE */
{sizeof(MFace), "MFace", 1, NULL, NULL, NULL, NULL, NULL, NULL}, {sizeof(MFace), "MFace", 1, NULL, NULL, NULL, NULL, NULL, NULL},
/* 5: CD_MTFACE */
{sizeof(MTFace), "MTFace", 1, "UVTex", layerCopy_tface, NULL, {sizeof(MTFace), "MTFace", 1, "UVTex", layerCopy_tface, NULL,
layerInterp_tface, layerSwap_tface, layerDefault_tface}, layerInterp_tface, layerSwap_tface, layerDefault_tface},
/* 6: CD_MCOL */
/* 4 MCol structs per face */ /* 4 MCol structs per face */
{sizeof(MCol)*4, "MCol", 4, "Col", NULL, NULL, layerInterp_mcol, {sizeof(MCol)*4, "MCol", 4, "Col", NULL, NULL, layerInterp_mcol,
layerSwap_mcol, layerDefault_mcol}, layerSwap_mcol, layerDefault_mcol},
/* 7: CD_ORIGINDEX */
{sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, NULL}, {sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
/* 8: CD_NORMAL */
/* 3 floats per normal vector */ /* 3 floats per normal vector */
{sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL}, {sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
/* 9: CD_FLAGS */
{sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, NULL}, {sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
/* 10: CD_PROP_FLT */
{sizeof(MFloatProperty), "MFloatProperty",1,"Float",NULL,NULL,NULL,NULL}, {sizeof(MFloatProperty), "MFloatProperty",1,"Float",NULL,NULL,NULL,NULL},
/* 11: CD_PROP_INT */
{sizeof(MIntProperty), "MIntProperty",1,"Int",NULL,NULL,NULL,NULL}, {sizeof(MIntProperty), "MIntProperty",1,"Int",NULL,NULL,NULL,NULL},
/* 12: CD_PROP_STR */
{sizeof(MStringProperty), "MStringProperty",1,"String",NULL,NULL,NULL,NULL}, {sizeof(MStringProperty), "MStringProperty",1,"String",NULL,NULL,NULL,NULL},
/* 13: CD_ORIGSPACE */
{sizeof(OrigSpaceFace), "OrigSpaceFace", 1, "UVTex", layerCopy_origspace_face, NULL, {sizeof(OrigSpaceFace), "OrigSpaceFace", 1, "UVTex", layerCopy_origspace_face, NULL,
layerInterp_origspace_face, layerSwap_origspace_face, layerDefault_origspace_face}, layerInterp_origspace_face, layerSwap_origspace_face, layerDefault_origspace_face},
/* 14: CD_ORCO */
{sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL}, {sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
/* 15: CD_MTEXPOLY */
{sizeof(MTexPoly), "MTexPoly", 1, "Face Texture", NULL, NULL, NULL, NULL, NULL}, {sizeof(MTexPoly), "MTexPoly", 1, "Face Texture", NULL, NULL, NULL, NULL, NULL},
/* 16: CD_MLOOPUV */
{sizeof(MLoopUV), "MLoopUV", 1, "UV coord", NULL, NULL, layerInterp_mloopuv, NULL, NULL}, {sizeof(MLoopUV), "MLoopUV", 1, "UV coord", NULL, NULL, layerInterp_mloopuv, NULL, NULL},
/* 17: CD_MLOOPCOL */
{sizeof(MLoopCol), "MLoopCol", 1, "Col", NULL, NULL, layerInterp_mloopcol, NULL, layerDefault_mloopcol}, {sizeof(MLoopCol), "MLoopCol", 1, "Col", NULL, NULL, layerInterp_mloopcol, NULL, layerDefault_mloopcol},
/* 18: CD_TANGENT */
{sizeof(float)*4*4, "", 0, NULL, NULL, NULL, NULL, NULL, NULL}, {sizeof(float)*4*4, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
/* 19: CD_MDISPS */
{sizeof(MDisps), "MDisps", 1, NULL, layerCopy_mdisps, {sizeof(MDisps), "MDisps", 1, NULL, layerCopy_mdisps,
layerFree_mdisps, layerInterp_mdisps, layerSwap_mdisps, NULL, layerRead_mdisps, layerWrite_mdisps, layerFree_mdisps, layerInterp_mdisps, layerSwap_mdisps, NULL, layerRead_mdisps, layerWrite_mdisps,
layerFilesize_mdisps, layerValidate_mdisps}, layerFilesize_mdisps, layerValidate_mdisps},
/* 20: CD_WEIGHT_MCOL */
{sizeof(MCol)*4, "MCol", 4, "WeightCol", NULL, NULL, layerInterp_mcol, {sizeof(MCol)*4, "MCol", 4, "WeightCol", NULL, NULL, layerInterp_mcol,
layerSwap_mcol, layerDefault_mcol}, layerSwap_mcol, layerDefault_mcol},
/* 21: CD_ID_MCOL */
{sizeof(MCol)*4, "MCol", 4, "IDCol", NULL, NULL, layerInterp_mcol, {sizeof(MCol)*4, "MCol", 4, "IDCol", NULL, NULL, layerInterp_mcol,
layerSwap_mcol, layerDefault_mcol}, layerSwap_mcol, layerDefault_mcol},
/* 22: CD_TEXTURE_MCOL */
{sizeof(MCol)*4, "MCol", 4, "TexturedCol", NULL, NULL, layerInterp_mcol, {sizeof(MCol)*4, "MCol", 4, "TexturedCol", NULL, NULL, layerInterp_mcol,
layerSwap_mcol, layerDefault_mcol}, layerSwap_mcol, layerDefault_mcol},
/* 23: CD_CLOTH_ORCO */
{sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL} {sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL}
}; };

@ -166,7 +166,7 @@ int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), unsigned int totve
} }
if(BLI_edgehash_haskey(edge_hash, med->v1, med->v2)) { if(BLI_edgehash_haskey(edge_hash, med->v1, med->v2)) {
PRINT(" edge %u: is a duplicate of, %u\n", i, GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, med->v1, med->v2))); PRINT(" edge %u: is a duplicate of, %d\n", i, GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, med->v1, med->v2)));
remove= do_fixes; remove= do_fixes;
} }

@ -359,6 +359,9 @@ NlaStrip *add_nla_soundstrip (Scene *scene, Speaker *speaker)
#endif #endif
{ {
strip->end = 10.0f; strip->end = 10.0f;
/* quiet compiler warnings */
(void)scene;
(void)speaker;
} }
/* general settings */ /* general settings */

@ -39,8 +39,10 @@
#include "BKE_sequencer.h" #include "BKE_sequencer.h"
#include "BKE_scene.h" #include "BKE_scene.h"
#ifdef WITH_AUDASPACE
// evil global ;-) // evil global ;-)
static int sound_cfra; static int sound_cfra;
#endif
struct bSound* sound_new_file(struct Main *bmain, const char *filename) struct bSound* sound_new_file(struct Main *bmain, const char *filename)
{ {
@ -760,5 +762,17 @@ void sound_seek_scene(struct bContext *UNUSED(C)) {}
float sound_sync_scene(struct Scene *UNUSED(scene)) { return 0.0f; } float sound_sync_scene(struct Scene *UNUSED(scene)) { return 0.0f; }
int sound_scene_playing(struct Scene *UNUSED(scene)) { return -1; } int sound_scene_playing(struct Scene *UNUSED(scene)) { return -1; }
int sound_read_sound_buffer(struct bSound* UNUSED(sound), float* UNUSED(buffer), int UNUSED(length), float UNUSED(start), float UNUSED(end)) { return 0; } int sound_read_sound_buffer(struct bSound* UNUSED(sound), float* UNUSED(buffer), int UNUSED(length), float UNUSED(start), float UNUSED(end)) { return 0; }
void sound_read_waveform(struct bSound* sound) { (void)sound; }
void sound_init_main(struct Main *bmain) { (void)bmain; }
void sound_set_cfra(int cfra) { (void)cfra; }
void sound_update_sequencer(struct Main* main, struct bSound* sound) { (void)main; (void)sound; }
void sound_update_scene(struct Scene* scene) { (void)scene; }
void sound_update_scene_sound(void* handle, struct bSound* sound) { (void)handle; (void)sound; }
void sound_update_scene_listener(struct Scene *scene) { (void)scene; }
void sound_update_fps(struct Scene *scene) { (void)scene; }
void sound_set_scene_sound_volume(void* handle, float volume, char animated) { (void)handle; (void)volume; (void)animated; }
void sound_set_scene_sound_pan(void* handle, float pan, char animated) { (void)handle; (void)pan; (void)animated; }
void sound_set_scene_volume(struct Scene *scene, float volume) { (void)scene; (void)volume; }
void sound_set_scene_sound_pitch(void* handle, float pitch, char animated) { (void)handle; (void)pitch; (void)animated; }
#endif // WITH_AUDASPACE #endif // WITH_AUDASPACE

@ -42,6 +42,7 @@ struct ID;
typedef enum { typedef enum {
BLI_CB_EVT_RENDER_PRE, BLI_CB_EVT_RENDER_PRE,
BLI_CB_EVT_RENDER_POST, BLI_CB_EVT_RENDER_POST,
BLI_CB_EVT_RENDER_STATS,
BLI_CB_EVT_LOAD_PRE, BLI_CB_EVT_LOAD_PRE,
BLI_CB_EVT_LOAD_POST, BLI_CB_EVT_LOAD_POST,
BLI_CB_EVT_SAVE_PRE, BLI_CB_EVT_SAVE_PRE,

@ -820,7 +820,7 @@ void normalize_m4_m4(float rmat[][4], float mat[][4])
len= normalize_v3_v3(rmat[1], mat[1]); len= normalize_v3_v3(rmat[1], mat[1]);
if(len!=0.0f) rmat[1][3]= mat[1][3] / len; if(len!=0.0f) rmat[1][3]= mat[1][3] / len;
len= normalize_v3_v3(rmat[2], mat[2]); len= normalize_v3_v3(rmat[2], mat[2]);
if(len!=0.0f) rmat[2][3]= mat[2][3] / len;; if(len!=0.0f) rmat[2][3]= mat[2][3] / len;
} }
void adjoint_m3_m3(float m1[][3], float m[][3]) void adjoint_m3_m3(float m1[][3], float m[][3])

@ -83,7 +83,7 @@ typedef unsigned long uintptr_t;
#define _UINTPTR_T_DEFINED #define _UINTPTR_T_DEFINED
#endif #endif
#elif defined(__linux__) || defined(__NetBSD__) #elif defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__)
/* Linux-i386, Linux-Alpha, Linux-ppc */ /* Linux-i386, Linux-Alpha, Linux-ppc */
#include <stdint.h> #include <stdint.h>

@ -115,7 +115,7 @@ LIBIMPORT void IMB_rectcpy(struct ImBuf *dbuf, struct ImBuf *sbuf,
LIBIMPORT void IMB_rectfill(struct ImBuf *drect, const float col[4]); LIBIMPORT void IMB_rectfill(struct ImBuf *drect, const float col[4]);
LIBIMPORT void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, int y2); LIBIMPORT void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, int y2);
LIBIMPORT void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, float *col, int x1, int y1, int x2, int y2); LIBIMPORT void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, const float col[4], int x1, int y1, int x2, int y2);
LIBIMPORT void IMB_rectfill_alpha(struct ImBuf *drect, const float value); LIBIMPORT void IMB_rectfill_alpha(struct ImBuf *drect, const float value);
#endif /* IFF_H */ #endif /* IFF_H */

@ -1,26 +1,26 @@
/* /*
* $Id$ * $Id$
* *
* ***** BEGIN GPL LICENSE BLOCK ***** * ***** BEGIN GPL LICENSE BLOCK *****
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation, * along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed. * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed.
* *
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*/ */
#include "GeometryExporter.h" #include "GeometryExporter.h"
#include "AnimationExporter.h" #include "AnimationExporter.h"
@ -141,9 +141,9 @@ void AnimationExporter::operator() (Object *ob)
} }
} }
//euler sources from quternion sources //euler sources from quternion sources
float * AnimationExporter::get_eul_source_for_quat(Object *ob ) float * AnimationExporter::get_eul_source_for_quat(Object *ob )
{ {
FCurve *fcu = (FCurve*)ob->adt->action->curves.first; FCurve *fcu = (FCurve*)ob->adt->action->curves.first;
const int keys = fcu->totvert; const int keys = fcu->totvert;
float *quat = (float*)MEM_callocN(sizeof(float) * fcu->totvert * 4, "quat output source values"); float *quat = (float*)MEM_callocN(sizeof(float) * fcu->totvert * 4, "quat output source values");
@ -175,11 +175,11 @@ void AnimationExporter::operator() (Object *ob)
MEM_freeN(quat); MEM_freeN(quat);
return eul; return eul;
} }
//Get proper name for bones //Get proper name for bones
std::string AnimationExporter::getObjectBoneName( Object* ob,const FCurve* fcu ) std::string AnimationExporter::getObjectBoneName( Object* ob,const FCurve* fcu )
{ {
//hard-way to derive the bone name from rna_path. Must find more compact method //hard-way to derive the bone name from rna_path. Must find more compact method
std::string rna_path = std::string(fcu->rna_path); std::string rna_path = std::string(fcu->rna_path);
@ -190,11 +190,11 @@ void AnimationExporter::operator() (Object *ob)
return /*id_name(ob) + "_" +*/ std::string(boneName); return /*id_name(ob) + "_" +*/ std::string(boneName);
else else
return id_name(ob); return id_name(ob);
} }
//convert f-curves to animation curves and write //convert f-curves to animation curves and write
void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformName , bool is_param, Material * ma ) void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformName , bool is_param, Material * ma )
{ {
const char *axis_name = NULL; const char *axis_name = NULL;
char anim_id[200]; char anim_id[200];
@ -326,13 +326,13 @@ void AnimationExporter::operator() (Object *ob)
addChannel(COLLADABU::URI(empty, sampler_id), target); addChannel(COLLADABU::URI(empty, sampler_id), target);
closeAnimation(); closeAnimation();
} }
//write bone animations in transform matrix sources //write bone animations in transform matrix sources
void AnimationExporter::write_bone_animation_matrix(Object *ob_arm, Bone *bone) void AnimationExporter::write_bone_animation_matrix(Object *ob_arm, Bone *bone)
{ {
if (!ob_arm->adt) if (!ob_arm->adt)
return; return;
@ -344,10 +344,10 @@ void AnimationExporter::operator() (Object *ob)
for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next)
write_bone_animation_matrix(ob_arm, child); write_bone_animation_matrix(ob_arm, child);
} }
bool AnimationExporter::is_bone_deform_group(Bone * bone) bool AnimationExporter::is_bone_deform_group(Bone * bone)
{ {
bool is_def; bool is_def;
//Check if current bone is deform //Check if current bone is deform
if((bone->flag & BONE_NO_DEFORM) == 0 ) return true; if((bone->flag & BONE_NO_DEFORM) == 0 ) return true;
@ -362,10 +362,10 @@ void AnimationExporter::operator() (Object *ob)
} }
//no deform bone found in children also //no deform bone found in children also
return false; return false;
} }
void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, Bone *bone) void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, Bone *bone)
{ {
bArmature *arm = (bArmature*)ob_arm->data; bArmature *arm = (bArmature*)ob_arm->data;
int flag = arm->flag; int flag = arm->flag;
std::vector<float> fra; std::vector<float> fra;
@ -399,10 +399,10 @@ void AnimationExporter::operator() (Object *ob)
if (flag & ARM_RESTPOS) if (flag & ARM_RESTPOS)
arm->flag = flag; arm->flag = flag;
where_is_pose(scene, ob_arm); where_is_pose(scene, ob_arm);
} }
void AnimationExporter::dae_baked_animation(std::vector<float> &fra, Object *ob_arm , Bone *bone) void AnimationExporter::dae_baked_animation(std::vector<float> &fra, Object *ob_arm , Bone *bone)
{ {
std::string ob_name = id_name(ob_arm); std::string ob_name = id_name(ob_arm);
std::string bone_name = bone->name; std::string bone_name = bone->name;
char anim_id[200]; char anim_id[200];
@ -442,12 +442,12 @@ void AnimationExporter::operator() (Object *ob)
addChannel(COLLADABU::URI(empty, sampler_id), target); addChannel(COLLADABU::URI(empty, sampler_id), target);
closeAnimation(); closeAnimation();
} }
// dae_bone_animation -> add_bone_animation // dae_bone_animation -> add_bone_animation
// (blend this into dae_bone_animation) // (blend this into dae_bone_animation)
void AnimationExporter::dae_bone_animation(std::vector<float> &fra, float *values, int tm_type, int axis, std::string ob_name, std::string bone_name) void AnimationExporter::dae_bone_animation(std::vector<float> &fra, float *values, int tm_type, int axis, std::string ob_name, std::string bone_name)
{ {
const char *axis_names[] = {"X", "Y", "Z"}; const char *axis_names[] = {"X", "Y", "Z"};
const char *axis_name = NULL; const char *axis_name = NULL;
char anim_id[200]; char anim_id[200];
@ -500,20 +500,20 @@ void AnimationExporter::operator() (Object *ob)
addChannel(COLLADABU::URI(empty, sampler_id), target); addChannel(COLLADABU::URI(empty, sampler_id), target);
closeAnimation(); closeAnimation();
} }
float AnimationExporter::convert_time(float frame) float AnimationExporter::convert_time(float frame)
{ {
return FRA2TIME(frame); return FRA2TIME(frame);
} }
float AnimationExporter::convert_angle(float angle) float AnimationExporter::convert_angle(float angle)
{ {
return COLLADABU::Math::Utils::radToDegF(angle); return COLLADABU::Math::Utils::radToDegF(angle);
} }
std::string AnimationExporter::get_semantic_suffix(COLLADASW::InputSemantic::Semantics semantic) std::string AnimationExporter::get_semantic_suffix(COLLADASW::InputSemantic::Semantics semantic)
{ {
switch(semantic) { switch(semantic) {
case COLLADASW::InputSemantic::INPUT: case COLLADASW::InputSemantic::INPUT:
return INPUT_SOURCE_ID_SUFFIX; return INPUT_SOURCE_ID_SUFFIX;
@ -529,11 +529,11 @@ void AnimationExporter::operator() (Object *ob)
break; break;
} }
return ""; return "";
} }
void AnimationExporter::add_source_parameters(COLLADASW::SourceBase::ParameterNameList& param, void AnimationExporter::add_source_parameters(COLLADASW::SourceBase::ParameterNameList& param,
COLLADASW::InputSemantic::Semantics semantic, bool is_rot, const char *axis, bool transform) COLLADASW::InputSemantic::Semantics semantic, bool is_rot, const char *axis, bool transform)
{ {
switch(semantic) { switch(semantic) {
case COLLADASW::InputSemantic::INPUT: case COLLADASW::InputSemantic::INPUT:
param.push_back("TIME"); param.push_back("TIME");
@ -565,10 +565,10 @@ void AnimationExporter::operator() (Object *ob)
default: default:
break; break;
} }
} }
void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSemantic::Semantics semantic, bool rotation, float *values, int *length) void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSemantic::Semantics semantic, bool rotation, float *values, int *length)
{ {
switch (semantic) { switch (semantic) {
case COLLADASW::InputSemantic::INPUT: case COLLADASW::InputSemantic::INPUT:
*length = 1; *length = 1;
@ -618,10 +618,10 @@ void AnimationExporter::operator() (Object *ob)
*length = 0; *length = 0;
break; break;
} }
} }
std::string AnimationExporter::create_source_from_fcurve(COLLADASW::InputSemantic::Semantics semantic, FCurve *fcu, const std::string& anim_id, const char *axis_name) std::string AnimationExporter::create_source_from_fcurve(COLLADASW::InputSemantic::Semantics semantic, FCurve *fcu, const std::string& anim_id, const char *axis_name)
{ {
std::string source_id = anim_id + get_semantic_suffix(semantic); std::string source_id = anim_id + get_semantic_suffix(semantic);
//bool is_rotation = !strcmp(fcu->rna_path, "rotation"); //bool is_rotation = !strcmp(fcu->rna_path, "rotation");
@ -662,11 +662,11 @@ void AnimationExporter::operator() (Object *ob)
source.finish(); source.finish();
return source_id; return source_id;
} }
//Currently called only to get OUTPUT source values ( if rotation and hence the axis is also specified ) //Currently called only to get OUTPUT source values ( if rotation and hence the axis is also specified )
std::string AnimationExporter::create_source_from_array(COLLADASW::InputSemantic::Semantics semantic, float *v, int tot, bool is_rot, const std::string& anim_id, const char *axis_name) std::string AnimationExporter::create_source_from_array(COLLADASW::InputSemantic::Semantics semantic, float *v, int tot, bool is_rot, const std::string& anim_id, const char *axis_name)
{ {
std::string source_id = anim_id + get_semantic_suffix(semantic); std::string source_id = anim_id + get_semantic_suffix(semantic);
COLLADASW::FloatSourceF source(mSW); COLLADASW::FloatSourceF source(mSW);
@ -693,10 +693,10 @@ void AnimationExporter::operator() (Object *ob)
source.finish(); source.finish();
return source_id; return source_id;
} }
// only used for sources with INPUT semantic // only used for sources with INPUT semantic
std::string AnimationExporter::create_source_from_vector(COLLADASW::InputSemantic::Semantics semantic, std::vector<float> &fra, bool is_rot, const std::string& anim_id, const char *axis_name) std::string AnimationExporter::create_source_from_vector(COLLADASW::InputSemantic::Semantics semantic, std::vector<float> &fra, bool is_rot, const std::string& anim_id, const char *axis_name)
{ {
std::string source_id = anim_id + get_semantic_suffix(semantic); std::string source_id = anim_id + get_semantic_suffix(semantic);
COLLADASW::FloatSourceF source(mSW); COLLADASW::FloatSourceF source(mSW);
@ -723,10 +723,10 @@ void AnimationExporter::operator() (Object *ob)
source.finish(); source.finish();
return source_id; return source_id;
} }
std::string AnimationExporter::create_4x4_source(std::vector<float> &frames , Object * ob_arm, Bone *bone , const std::string& anim_id) std::string AnimationExporter::create_4x4_source(std::vector<float> &frames , Object * ob_arm, Bone *bone , const std::string& anim_id)
{ {
COLLADASW::InputSemantic::Semantics semantic = COLLADASW::InputSemantic::OUTPUT; COLLADASW::InputSemantic::Semantics semantic = COLLADASW::InputSemantic::OUTPUT;
std::string source_id = anim_id + get_semantic_suffix(semantic); std::string source_id = anim_id + get_semantic_suffix(semantic);
@ -788,10 +788,10 @@ void AnimationExporter::operator() (Object *ob)
source.finish(); source.finish();
return source_id; return source_id;
} }
// only used for sources with OUTPUT semantic ( locations and scale) // only used for sources with OUTPUT semantic ( locations and scale)
std::string AnimationExporter::create_xyz_source(float *v, int tot, const std::string& anim_id) std::string AnimationExporter::create_xyz_source(float *v, int tot, const std::string& anim_id)
{ {
COLLADASW::InputSemantic::Semantics semantic = COLLADASW::InputSemantic::OUTPUT; COLLADASW::InputSemantic::Semantics semantic = COLLADASW::InputSemantic::OUTPUT;
std::string source_id = anim_id + get_semantic_suffix(semantic); std::string source_id = anim_id + get_semantic_suffix(semantic);
@ -814,10 +814,10 @@ void AnimationExporter::operator() (Object *ob)
source.finish(); source.finish();
return source_id; return source_id;
} }
std::string AnimationExporter::create_interpolation_source(FCurve *fcu, const std::string& anim_id, const char *axis_name, bool *has_tangents) std::string AnimationExporter::create_interpolation_source(FCurve *fcu, const std::string& anim_id, const char *axis_name, bool *has_tangents)
{ {
std::string source_id = anim_id + get_semantic_suffix(COLLADASW::InputSemantic::INTERPOLATION); std::string source_id = anim_id + get_semantic_suffix(COLLADASW::InputSemantic::INTERPOLATION);
COLLADASW::NameSource source(mSW); COLLADASW::NameSource source(mSW);
@ -848,10 +848,10 @@ void AnimationExporter::operator() (Object *ob)
source.finish(); source.finish();
return source_id; return source_id;
} }
std::string AnimationExporter::fake_interpolation_source(int tot, const std::string& anim_id, const char *axis_name) std::string AnimationExporter::fake_interpolation_source(int tot, const std::string& anim_id, const char *axis_name)
{ {
std::string source_id = anim_id + get_semantic_suffix(COLLADASW::InputSemantic::INTERPOLATION); std::string source_id = anim_id + get_semantic_suffix(COLLADASW::InputSemantic::INTERPOLATION);
COLLADASW::NameSource source(mSW); COLLADASW::NameSource source(mSW);
@ -872,10 +872,10 @@ void AnimationExporter::operator() (Object *ob)
source.finish(); source.finish();
return source_id; return source_id;
} }
std::string AnimationExporter::get_light_param_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis) std::string AnimationExporter::get_light_param_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis)
{ {
std::string tm_name; std::string tm_name;
// when given rna_path, determine tm_type from it // when given rna_path, determine tm_type from it
if (rna_path) { if (rna_path) {
@ -920,10 +920,10 @@ void AnimationExporter::operator() (Object *ob)
} }
return std::string(""); return std::string("");
} }
std::string AnimationExporter::get_camera_param_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis) std::string AnimationExporter::get_camera_param_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis)
{ {
std::string tm_name; std::string tm_name;
// when given rna_path, determine tm_type from it // when given rna_path, determine tm_type from it
if (rna_path) { if (rna_path) {
@ -969,12 +969,12 @@ void AnimationExporter::operator() (Object *ob)
} }
return std::string(""); return std::string("");
} }
// Assign sid of the animated parameter or transform // Assign sid of the animated parameter or transform
// for rotation, axis name is always appended and the value of append_axis is ignored // for rotation, axis name is always appended and the value of append_axis is ignored
std::string AnimationExporter::get_transform_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis) std::string AnimationExporter::get_transform_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis)
{ {
std::string tm_name; std::string tm_name;
bool is_rotation =false; bool is_rotation =false;
// when given rna_path, determine tm_type from it // when given rna_path, determine tm_type from it
@ -1048,23 +1048,23 @@ void AnimationExporter::operator() (Object *ob)
} }
return std::string(""); return std::string("");
} }
char* AnimationExporter::extract_transform_name(char *rna_path) char* AnimationExporter::extract_transform_name(char *rna_path)
{ {
char *dot = strrchr(rna_path, '.'); char *dot = strrchr(rna_path, '.');
return dot ? (dot + 1) : rna_path; return dot ? (dot + 1) : rna_path;
} }
//find keyframes of all the objects animations //find keyframes of all the objects animations
void AnimationExporter::find_frames(Object *ob, std::vector<float> &fra) void AnimationExporter::find_frames(Object *ob, std::vector<float> &fra)
{ {
FCurve *fcu= (FCurve*)ob->adt->action->curves.first; FCurve *fcu= (FCurve*)ob->adt->action->curves.first;
for (; fcu; fcu = fcu->next) { for (; fcu; fcu = fcu->next) {
for (unsigned int i = 0; i < fcu->totvert; i++) { for (unsigned int i = 0; i < fcu->totvert; i++) {
float f = fcu->bezt[i].vec[1][0]; // float f = fcu->bezt[i].vec[1][0];
if (std::find(fra.begin(), fra.end(), f) == fra.end()) if (std::find(fra.begin(), fra.end(), f) == fra.end())
fra.push_back(f); fra.push_back(f);
} }
@ -1072,14 +1072,14 @@ void AnimationExporter::operator() (Object *ob)
// keep the keys in ascending order // keep the keys in ascending order
std::sort(fra.begin(), fra.end()); std::sort(fra.begin(), fra.end());
} }
// enable fcurves driving a specific bone, disable all the rest // enable fcurves driving a specific bone, disable all the rest
// if bone_name = NULL enable all fcurves // if bone_name = NULL enable all fcurves
void AnimationExporter::enable_fcurves(bAction *act, char *bone_name) void AnimationExporter::enable_fcurves(bAction *act, char *bone_name)
{ {
FCurve *fcu; FCurve *fcu;
char prefix[200]; char prefix[200];
@ -1097,10 +1097,10 @@ void AnimationExporter::operator() (Object *ob)
fcu->flag &= ~FCURVE_DISABLED; fcu->flag &= ~FCURVE_DISABLED;
} }
} }
} }
bool AnimationExporter::hasAnimations(Scene *sce) bool AnimationExporter::hasAnimations(Scene *sce)
{ {
Base *base= (Base*) sce->base.first; Base *base= (Base*) sce->base.first;
while(base) { while(base) {
@ -1133,21 +1133,21 @@ void AnimationExporter::operator() (Object *ob)
base= base->next; base= base->next;
} }
return false; return false;
} }
//------------------------------- Not used in the new system.-------------------------------------------------------- //------------------------------- Not used in the new system.--------------------------------------------------------
void AnimationExporter::find_rotation_frames(Object *ob, std::vector<float> &fra, const char *prefix, int rotmode) void AnimationExporter::find_rotation_frames(Object *ob, std::vector<float> &fra, const char *prefix, int rotmode)
{ {
if (rotmode > 0) if (rotmode > 0)
find_frames(ob, fra, prefix, "rotation_euler"); find_frames(ob, fra, prefix, "rotation_euler");
else if (rotmode == ROT_MODE_QUAT) else if (rotmode == ROT_MODE_QUAT)
find_frames(ob, fra, prefix, "rotation_quaternion"); find_frames(ob, fra, prefix, "rotation_quaternion");
/*else if (rotmode == ROT_MODE_AXISANGLE) /*else if (rotmode == ROT_MODE_AXISANGLE)
;*/ ;*/
} }
void AnimationExporter::find_frames(Object *ob, std::vector<float> &fra, const char *prefix, const char *tm_name) void AnimationExporter::find_frames(Object *ob, std::vector<float> &fra, const char *prefix, const char *tm_name)
{ {
FCurve *fcu= (FCurve*)ob->adt->action->curves.first; FCurve *fcu= (FCurve*)ob->adt->action->curves.first;
for (; fcu; fcu = fcu->next) { for (; fcu; fcu = fcu->next) {
@ -1157,7 +1157,7 @@ void AnimationExporter::operator() (Object *ob)
char *name = extract_transform_name(fcu->rna_path); char *name = extract_transform_name(fcu->rna_path);
if (!strcmp(name, tm_name)) { if (!strcmp(name, tm_name)) {
for (unsigned int i = 0; i < fcu->totvert; i++) { for (unsigned int i = 0; i < fcu->totvert; i++) {
float f = fcu->bezt[i].vec[1][0]; // float f = fcu->bezt[i].vec[1][0];
if (std::find(fra.begin(), fra.end(), f) == fra.end()) if (std::find(fra.begin(), fra.end(), f) == fra.end())
fra.push_back(f); fra.push_back(f);
} }
@ -1166,10 +1166,10 @@ void AnimationExporter::operator() (Object *ob)
// keep the keys in ascending order // keep the keys in ascending order
std::sort(fra.begin(), fra.end()); std::sort(fra.begin(), fra.end());
} }
void AnimationExporter::write_bone_animation(Object *ob_arm, Bone *bone) void AnimationExporter::write_bone_animation(Object *ob_arm, Bone *bone)
{ {
if (!ob_arm->adt) if (!ob_arm->adt)
return; return;
@ -1182,10 +1182,10 @@ void AnimationExporter::operator() (Object *ob)
for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next)
write_bone_animation(ob_arm, child); write_bone_animation(ob_arm, child);
} }
void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bone, int transform_type) void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bone, int transform_type)
{ {
bArmature *arm = (bArmature*)ob_arm->data; bArmature *arm = (bArmature*)ob_arm->data;
int flag = arm->flag; int flag = arm->flag;
std::vector<float> fra; std::vector<float> fra;
@ -1245,10 +1245,10 @@ void AnimationExporter::operator() (Object *ob)
if (flag & ARM_RESTPOS) if (flag & ARM_RESTPOS)
arm->flag = flag; arm->flag = flag;
where_is_pose(scene, ob_arm); where_is_pose(scene, ob_arm);
} }
void AnimationExporter::sample_animation(float *v, std::vector<float> &frames, int type, Bone *bone, Object *ob_arm, bPoseChannel *pchan) void AnimationExporter::sample_animation(float *v, std::vector<float> &frames, int type, Bone *bone, Object *ob_arm, bPoseChannel *pchan)
{ {
bPoseChannel *parchan = NULL; bPoseChannel *parchan = NULL;
bPose *pose = ob_arm->pose; bPose *pose = ob_arm->pose;
@ -1295,6 +1295,4 @@ void AnimationExporter::operator() (Object *ob)
} }
enable_fcurves(ob_arm->adt->action, NULL); enable_fcurves(ob_arm->adt->action, NULL);
} }

@ -705,7 +705,7 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector<FCurve*>&
if (frames.size() == 0) if (frames.size() == 0)
return; return;
std::sort(frames.begin(), frames.end()); std::sort(frames.begin(), frames.end());
std::vector<float>::iterator it; std::vector<float>::iterator it;

@ -207,4 +207,4 @@ public:
void extra_data_importer(std::string elementName); void extra_data_importer(std::string elementName);
}; };
#endif #endif

@ -310,9 +310,10 @@ void ArmatureImporter::fix_leaf_bones( )
LeafBone& leaf = *it; LeafBone& leaf = *it;
// pointing up // pointing up
float vec[3] = {0.0f, 0.0f, 1.0f}; float vec[3] = {0.0f, 0.0f, 0.1f};
//mul_v3_fl(vec, leaf_bone_length); // if parent: take parent length and direction
if(leaf.bone->parent) sub_v3_v3v3(vec, leaf.bone->parent->tail, leaf.bone->parent->head);
copy_v3_v3(leaf.bone->tail, leaf.bone->head); copy_v3_v3(leaf.bone->tail, leaf.bone->head);
add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec); add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec);

@ -328,9 +328,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename, bool
//scale = RNA_struct_find_property(&unit_settings, "scale_length"); //scale = RNA_struct_find_property(&unit_settings, "scale_length");
std::string unitname = "meter"; std::string unitname = "meter";
float linearmeasure = 1.0f; float linearmeasure = RNA_float_get(&unit_settings, "scale_length");
linearmeasure = RNA_float_get(&unit_settings, "scale_length");
switch(RNA_property_enum_get(&unit_settings, system)) { switch(RNA_property_enum_get(&unit_settings, system)) {
case USER_UNIT_NONE: case USER_UNIT_NONE:
@ -368,8 +366,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename, bool
asset.setUnit(unitname, linearmeasure); asset.setUnit(unitname, linearmeasure);
asset.setUpAxisType(COLLADASW::Asset::Z_UP); asset.setUpAxisType(COLLADASW::Asset::Z_UP);
// TODO: need an Author field in userpref if(U.author[0] != '\0') {
if(strlen(U.author) > 0) {
asset.getContributor().mAuthor = U.author; asset.getContributor().mAuthor = U.author;
} }
else { else {

@ -56,7 +56,7 @@ bool ExtraHandler::textData(const char* text, size_t textLength)
{ {
char buf[1024]; char buf[1024];
if(currentElement.length() == 0) return false; if(currentElement.length() == 0 || currentExtraTags == 0) return false;
BLI_snprintf(buf, textLength+1, "%s", text); BLI_snprintf(buf, textLength+1, "%s", text);
currentExtraTags->addTag(currentElement, std::string(buf)); currentExtraTags->addTag(currentElement, std::string(buf));

@ -90,32 +90,28 @@ std::string ExtraTags::asString( std::string tag, bool *ok)
void ExtraTags::setData(std::string tag, short *data) void ExtraTags::setData(std::string tag, short *data)
{ {
bool ok = false; bool ok = false;
int tmp = 0; int tmp = asInt(tag, &ok);
tmp = asInt(tag, &ok);
if(ok) if(ok)
*data = (short)tmp; *data = (short)tmp;
} }
void ExtraTags::setData(std::string tag, int *data) void ExtraTags::setData(std::string tag, int *data)
{ {
bool ok = false; bool ok = false;
int tmp = 0; int tmp = asInt(tag, &ok);
tmp = asInt(tag, &ok);
if(ok) if(ok)
*data = tmp; *data = tmp;
} }
void ExtraTags::setData(std::string tag, float *data) void ExtraTags::setData(std::string tag, float *data)
{ {
bool ok = false; bool ok = false;
float tmp = 0.0f; float tmp = asFloat(tag, &ok);
tmp = asFloat(tag, &ok);
if(ok) if(ok)
*data = tmp; *data = tmp;
} }
void ExtraTags::setData(std::string tag, char *data) void ExtraTags::setData(std::string tag, char *data)
{ {
bool ok = false; bool ok = false;
int tmp = 0; int tmp = asInt(tag, &ok);
tmp = asInt(tag, &ok);
if(ok) if(ok)
*data = (char)tmp; *data = (char)tmp;
} }

@ -220,8 +220,8 @@ void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs,
if (quad) uvs.getUV(indices[index + 3], mtface->uv[3]); if (quad) uvs.getUV(indices[index + 3], mtface->uv[3]);
#ifdef COLLADA_DEBUG #if 1 // #ifdef COLLADA_DEBUG
/*if (quad) { if (quad) {
fprintf(stderr, "face uv:\n" fprintf(stderr, "face uv:\n"
"((%d, %d, %d, %d))\n" "((%d, %d, %d, %d))\n"
"((%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f))\n", "((%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f))\n",
@ -248,7 +248,7 @@ void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs,
mtface->uv[0][0], mtface->uv[0][1], mtface->uv[0][0], mtface->uv[0][1],
mtface->uv[1][0], mtface->uv[1][1], mtface->uv[1][0], mtface->uv[1][1],
mtface->uv[2][0], mtface->uv[2][1]); mtface->uv[2][0], mtface->uv[2][1]);
}*/ }
#endif #endif
} }
@ -587,7 +587,7 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris)
for (k = 0; k < index_list_array.getCount(); k++) { for (k = 0; k < index_list_array.getCount(); k++) {
// get mtface by face index and uv set index // get mtface by face index and uv set index
MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k); MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k);
set_face_uv(&mtface[face_index], uvs, *index_list_array[k], index, mface->v4 != 0); set_face_uv(&mtface[face_index], uvs, *index_list_array[k], index, vcount == 4);
} }
#endif #endif

@ -1177,10 +1177,13 @@ static size_t animfilter_nla (bAnimContext *UNUSED(ac), ListBase *anim_data, bDo
/* determine what animation data from AnimData block should get displayed */ /* determine what animation data from AnimData block should get displayed */
static size_t animfilter_block_data (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, ID *id, int filter_mode) static size_t animfilter_block_data (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, ID *id, int filter_mode)
{ {
IdAdtTemplate *iat = (IdAdtTemplate*)id;
AnimData *adt = BKE_animdata_from_id(id); AnimData *adt = BKE_animdata_from_id(id);
size_t items = 0; size_t items = 0;
/* image object datablocks have no anim-data so check for NULL */
if(adt) {
IdAdtTemplate *iat = (IdAdtTemplate*)id;
/* NOTE: this macro is used instead of inlining the logic here, since this sort of filtering is still needed /* NOTE: this macro is used instead of inlining the logic here, since this sort of filtering is still needed
* in a few places in he rest of the code still - notably for the few cases where special mode-based * in a few places in he rest of the code still - notably for the few cases where special mode-based
* different types of data expanders are required. * different types of data expanders are required.
@ -1198,7 +1201,9 @@ static size_t animfilter_block_data (bAnimContext *ac, ListBase *anim_data, bDop
}, },
{ /* Keyframes */ { /* Keyframes */
items += animfilter_action(ac, anim_data, ads, adt->action, filter_mode, id); items += animfilter_action(ac, anim_data, ads, adt->action, filter_mode, id);
}); }
);
}
return items; return items;
} }

@ -530,6 +530,7 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
{ {
bConstraint *con= NULL; bConstraint *con= NULL;
short searchtype= VISUALKEY_NONE; short searchtype= VISUALKEY_NONE;
short has_parent = FALSE;
char *identifier= NULL; char *identifier= NULL;
/* validate data */ /* validate data */
@ -548,6 +549,7 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
con= ob->constraints.first; con= ob->constraints.first;
identifier= (char *)RNA_property_identifier(prop); identifier= (char *)RNA_property_identifier(prop);
has_parent= (ob->parent != NULL);
} }
else if (ptr->type == &RNA_PoseBone) { else if (ptr->type == &RNA_PoseBone) {
/* Pose Channel */ /* Pose Channel */
@ -555,10 +557,11 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
con= pchan->constraints.first; con= pchan->constraints.first;
identifier= (char *)RNA_property_identifier(prop); identifier= (char *)RNA_property_identifier(prop);
has_parent= (pchan->parent != NULL);
} }
/* check if any data to search using */ /* check if any data to search using */
if (ELEM(NULL, con, identifier)) if (ELEM(NULL, con, identifier) && (has_parent == FALSE))
return 0; return 0;
/* location or rotation identifiers only... */ /* location or rotation identifiers only... */
@ -573,7 +576,12 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
/* only search if a searchtype and initial constraint are available */ /* only search if a searchtype and initial constraint are available */
if (searchtype && con) { if (searchtype) {
/* parent is always matching */
if (has_parent)
return 1;
/* constraints */
for (; con; con= con->next) { for (; con; con= con->next) {
/* only consider constraint if it is not disabled, and has influence */ /* only consider constraint if it is not disabled, and has influence */
if (con->flag & CONSTRAINT_DISABLE) continue; if (con->flag & CONSTRAINT_DISABLE) continue;
@ -645,10 +653,6 @@ static float visualkey_get_value (PointerRNA *ptr, PropertyRNA *prop, int array_
if (ptr->type == &RNA_Object) { if (ptr->type == &RNA_Object) {
Object *ob= (Object *)ptr->data; Object *ob= (Object *)ptr->data;
/* parented objects are not supported, as the effects of the parent
* are included in the matrix, which kindof beats the point
*/
if (ob->parent == NULL) {
/* only Location or Rotation keyframes are supported now */ /* only Location or Rotation keyframes are supported now */
if (strstr(identifier, "location")) { if (strstr(identifier, "location")) {
return ob->obmat[3][array_index]; return ob->obmat[3][array_index];
@ -679,7 +683,6 @@ static float visualkey_get_value (PointerRNA *ptr, PropertyRNA *prop, int array_
return axis[array_index - 1]; return axis[array_index - 1];
} }
} }
}
else if (ptr->type == &RNA_PoseBone) { else if (ptr->type == &RNA_PoseBone) {
Object *ob = (Object *)ptr->id.data; /* we assume that this is always set, and is an object */ Object *ob = (Object *)ptr->id.data; /* we assume that this is always set, and is an object */
bPoseChannel *pchan= (bPoseChannel *)ptr->data; bPoseChannel *pchan= (bPoseChannel *)ptr->data;

@ -771,6 +771,10 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol)
uiSetRoundBox(15); uiSetRoundBox(15);
uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f); uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f);
/* need scissor test, histogram can draw outside of boundary */
glGetIntegerv(GL_VIEWPORT, scissor);
glScissor(ar->winrct.xmin + (rect.xmin-1), ar->winrct.ymin+(rect.ymin-1), (rect.xmax+1)-(rect.xmin-1), (rect.ymax+1)-(rect.ymin-1));
glColor4f(1.f, 1.f, 1.f, 0.08f); glColor4f(1.f, 1.f, 1.f, 0.08f);
/* draw grid lines here */ /* draw grid lines here */
for (i=1; i<4; i++) { for (i=1; i<4; i++) {
@ -778,10 +782,6 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol)
fdrawline(rect.xmin+(i/4.f)*w, rect.ymin, rect.xmin+(i/4.f)*w, rect.ymax); fdrawline(rect.xmin+(i/4.f)*w, rect.ymin, rect.xmin+(i/4.f)*w, rect.ymax);
} }
/* need scissor test, histogram can draw outside of boundary */
glGetIntegerv(GL_VIEWPORT, scissor);
glScissor(ar->winrct.xmin + (rect.xmin-1), ar->winrct.ymin+(rect.ymin-1), (rect.xmax+1)-(rect.xmin-1), (rect.ymax+1)-(rect.ymin-1));
if (hist->mode == HISTO_MODE_LUMA) if (hist->mode == HISTO_MODE_LUMA)
histogram_draw_one(1.0, 1.0, 1.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_luma, res); histogram_draw_one(1.0, 1.0, 1.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_luma, res);
else { else {

@ -1099,7 +1099,7 @@ void load_editMesh(Scene *scene, Object *obedit)
int j; int j;
for (ob=G.main->object.first; ob; ob=ob->id.next) { for (ob=G.main->object.first; ob; ob=ob->id.next) {
if (ob->parent==ob && ELEM(ob->partype, PARVERT1,PARVERT3)) { if (ob->parent==obedit && ELEM(ob->partype, PARVERT1,PARVERT3)) {
/* duplicate code from below, make it function later...? */ /* duplicate code from below, make it function later...? */
if (!vertMap) { if (!vertMap) {

@ -1141,6 +1141,9 @@ short extrudeflag_face_indiv(EditMesh *em, short UNUSED(flag), float *UNUSED(nor
EM_select_flush(em); EM_select_flush(em);
/* step 5; update normals after extrude */
recalc_editnormals(em);
return 'n'; return 'n';
} }
@ -1206,6 +1209,9 @@ short extrudeflag_edges_indiv(EditMesh *em, short flag, float *nor)
if(eed->v1->f & eed->v2->f & flag) eed->f |= flag; if(eed->v1->f & eed->v2->f & flag) eed->f |= flag;
} }
/* update normals after extrude */
recalc_editnormals(em);
if(is_zero_v3(nor)) return 'g'; // g is grab if(is_zero_v3(nor)) return 'g'; // g is grab
return 'n'; // n is for normal constraint return 'n'; // n is for normal constraint
} }
@ -1485,6 +1491,9 @@ static short extrudeflag_edge(Object *obedit, EditMesh *em, short UNUSED(flag),
EM_select_flush(em); EM_select_flush(em);
/* step 8; update normals after extrude */
recalc_editnormals(em);
if(is_zero_v3(nor)) return 'g'; // grab if(is_zero_v3(nor)) return 'g'; // grab
return 'n'; // normal constraint return 'n'; // normal constraint
} }

@ -276,8 +276,10 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, floa
RNA_boolean_set(op->ptr, "view_align", view_align); RNA_boolean_set(op->ptr, "view_align", view_align);
} }
if (view_align) if (view_align) {
ED_object_rotation_from_view(C, rot); ED_object_rotation_from_view(C, rot);
RNA_float_set_array(op->ptr, "rotation", rot);
}
else else
RNA_float_get_array(op->ptr, "rotation", rot); RNA_float_get_array(op->ptr, "rotation", rot);

@ -1411,6 +1411,8 @@ static int forcefield_toggle_exec(bContext *C, wmOperator *UNUSED(op))
else else
ob->pd->forcefield = 0; ob->pd->forcefield = 0;
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, NULL);
return OPERATOR_FINISHED; return OPERATOR_FINISHED;
} }

@ -64,6 +64,7 @@
#include "ED_curve.h" #include "ED_curve.h"
#include "ED_mesh.h" #include "ED_mesh.h"
#include "ED_lattice.h"
#include "ED_screen.h" #include "ED_screen.h"
#include "WM_types.h" #include "WM_types.h"
@ -292,7 +293,7 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
return totvert; return totvert;
} }
static int object_hook_index_array(Object *obedit, int *tot, int **indexar, char *name, float *cent_r) static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int **indexar, char *name, float *cent_r)
{ {
*indexar= NULL; *indexar= NULL;
*tot= 0; *tot= 0;
@ -302,7 +303,12 @@ static int object_hook_index_array(Object *obedit, int *tot, int **indexar, char
case OB_MESH: case OB_MESH:
{ {
Mesh *me= obedit->data; Mesh *me= obedit->data;
EditMesh *em = BKE_mesh_get_editmesh(me); EditMesh *em;
load_editMesh(scene, obedit);
make_editMesh(scene, obedit);
em = BKE_mesh_get_editmesh(me);
/* check selected vertices first */ /* check selected vertices first */
if( return_editmesh_indexar(em, tot, indexar, cent_r)) { if( return_editmesh_indexar(em, tot, indexar, cent_r)) {
@ -316,10 +322,17 @@ static int object_hook_index_array(Object *obedit, int *tot, int **indexar, char
} }
case OB_CURVE: case OB_CURVE:
case OB_SURF: case OB_SURF:
load_editNurb(obedit);
make_editNurb(obedit);
return return_editcurve_indexar(obedit, tot, indexar, cent_r); return return_editcurve_indexar(obedit, tot, indexar, cent_r);
case OB_LATTICE: case OB_LATTICE:
{ {
Lattice *lt= obedit->data; Lattice *lt= obedit->data;
load_editLatt(obedit);
make_editLatt(obedit);
return return_editlattice_indexar(lt->editlatt->latt, tot, indexar, cent_r); return return_editlattice_indexar(lt->editlatt->latt, tot, indexar, cent_r);
} }
default: default:
@ -427,7 +440,7 @@ static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *o
int tot, ok, *indexar; int tot, ok, *indexar;
char name[32]; char name[32];
ok = object_hook_index_array(obedit, &tot, &indexar, name, cent); ok = object_hook_index_array(scene, obedit, &tot, &indexar, name, cent);
if (!ok) return; // XXX error("Requires selected vertices or active Vertex Group"); if (!ok) return; // XXX error("Requires selected vertices or active Vertex Group");
@ -760,7 +773,7 @@ static int object_hook_assign_exec(bContext *C, wmOperator *op)
/* assign functionality */ /* assign functionality */
if(!object_hook_index_array(ob, &tot, &indexar, name, cent)) { if(!object_hook_index_array(CTX_data_scene(C), ob, &tot, &indexar, name, cent)) {
BKE_report(op->reports, RPT_WARNING, "Requires selected vertices or active vertex group"); BKE_report(op->reports, RPT_WARNING, "Requires selected vertices or active vertex group");
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
} }

@ -91,6 +91,8 @@
#include "ED_armature.h" #include "ED_armature.h"
#include "ED_curve.h" #include "ED_curve.h"
#include "ED_lattice.h"
#include "ED_mesh.h"
#include "ED_keyframing.h" #include "ED_keyframing.h"
#include "ED_object.h" #include "ED_object.h"
#include "ED_screen.h" #include "ED_screen.h"
@ -122,7 +124,12 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
if(obedit->type==OB_MESH) { if(obedit->type==OB_MESH) {
Mesh *me= obedit->data; Mesh *me= obedit->data;
EditMesh *em = BKE_mesh_get_editmesh(me); EditMesh *em;
load_editMesh(scene, obedit);
make_editMesh(scene, obedit);
em = BKE_mesh_get_editmesh(me);
eve= em->verts.first; eve= em->verts.first;
while(eve) { while(eve) {
@ -140,7 +147,12 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
BKE_mesh_end_editmesh(me, em); BKE_mesh_end_editmesh(me, em);
} }
else if(ELEM(obedit->type, OB_SURF, OB_CURVE)) { else if(ELEM(obedit->type, OB_SURF, OB_CURVE)) {
ListBase *editnurb= curve_get_editcurve(obedit); ListBase *editnurb;
load_editNurb(obedit);
make_editNurb(obedit);
editnurb= curve_get_editcurve(obedit);
cu= obedit->data; cu= obedit->data;
@ -180,7 +192,12 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
} }
} }
else if(obedit->type==OB_LATTICE) { else if(obedit->type==OB_LATTICE) {
Lattice *lt= obedit->data; Lattice *lt;
load_editLatt(obedit);
make_editLatt(obedit);
lt= obedit->data;
a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw; a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
bp= lt->editlatt->latt->def; bp= lt->editlatt->latt->def;

@ -221,6 +221,7 @@ void SOUND_OT_open_mono(wmOperatorType *ot)
static int mixdown_exec(bContext *C, wmOperator *op) static int mixdown_exec(bContext *C, wmOperator *op)
{ {
#ifdef WITH_AUDASPACE
char path[FILE_MAX]; char path[FILE_MAX];
char filename[FILE_MAX]; char filename[FILE_MAX];
Scene *scene; Scene *scene;
@ -254,7 +255,10 @@ static int mixdown_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, result); BKE_report(op->reports, RPT_ERROR, result);
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
} }
#else // WITH_AUDASPACE
(void)C;
(void)op;
#endif // WITH_AUDASPACE
return OPERATOR_FINISHED; return OPERATOR_FINISHED;
} }
@ -278,6 +282,7 @@ static int mixdown_draw_check_prop(PropertyRNA *prop)
); );
} }
#ifdef WITH_AUDASPACE
static void mixdown_draw(bContext *C, wmOperator *op) static void mixdown_draw(bContext *C, wmOperator *op)
{ {
static EnumPropertyItem pcm_format_items[] = { static EnumPropertyItem pcm_format_items[] = {
@ -429,9 +434,11 @@ static void mixdown_draw(bContext *C, wmOperator *op)
/* main draw call */ /* main draw call */
uiDefAutoButsRNA(layout, &ptr, mixdown_draw_check_prop, '\0'); uiDefAutoButsRNA(layout, &ptr, mixdown_draw_check_prop, '\0');
} }
#endif // WITH_AUDASPACE
void SOUND_OT_mixdown(wmOperatorType *ot) void SOUND_OT_mixdown(wmOperatorType *ot)
{ {
#ifdef WITH_AUDASPACE
static EnumPropertyItem format_items[] = { static EnumPropertyItem format_items[] = {
{AUD_FORMAT_U8, "U8", 0, "U8", "8 bit unsigned"}, {AUD_FORMAT_U8, "U8", 0, "U8", "8 bit unsigned"},
{AUD_FORMAT_S16, "S16", 0, "S16", "16 bit signed"}, {AUD_FORMAT_S16, "S16", 0, "S16", "16 bit signed"},
@ -469,6 +476,8 @@ void SOUND_OT_mixdown(wmOperatorType *ot)
{AUD_CODEC_VORBIS, "VORBIS", 0, "Vorbis", "Xiph.Org Vorbis Codec"}, {AUD_CODEC_VORBIS, "VORBIS", 0, "Vorbis", "Xiph.Org Vorbis Codec"},
{0, NULL, 0, NULL, NULL}}; {0, NULL, 0, NULL, NULL}};
#endif // WITH_AUDASPACE
/* identifiers */ /* identifiers */
ot->name= "Mixdown"; ot->name= "Mixdown";
ot->description= "Mixes the scene's audio to a sound file"; ot->description= "Mixes the scene's audio to a sound file";
@ -477,18 +486,22 @@ void SOUND_OT_mixdown(wmOperatorType *ot)
/* api callbacks */ /* api callbacks */
ot->exec= mixdown_exec; ot->exec= mixdown_exec;
ot->invoke= mixdown_invoke; ot->invoke= mixdown_invoke;
ot->ui= mixdown_draw;
#ifdef WITH_AUDASPACE
ot->ui= mixdown_draw;
#endif
/* flags */ /* flags */
ot->flag= OPTYPE_REGISTER; ot->flag= OPTYPE_REGISTER;
/* properties */ /* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH); WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH);
#ifdef WITH_AUDASPACE
RNA_def_int(ot->srna, "accuracy", 1024, 1, 16777216, "Accuracy", "Sample accuracy. Important for animation data. The lower the value, the more accurate.", 1, 16777216); RNA_def_int(ot->srna, "accuracy", 1024, 1, 16777216, "Accuracy", "Sample accuracy. Important for animation data. The lower the value, the more accurate.", 1, 16777216);
RNA_def_enum(ot->srna, "container", container_items, AUD_CONTAINER_FLAC, "Container", "File format"); RNA_def_enum(ot->srna, "container", container_items, AUD_CONTAINER_FLAC, "Container", "File format");
RNA_def_enum(ot->srna, "codec", codec_items, AUD_CODEC_FLAC, "Codec", "Audio Codec"); RNA_def_enum(ot->srna, "codec", codec_items, AUD_CODEC_FLAC, "Codec", "Audio Codec");
RNA_def_enum(ot->srna, "format", format_items, AUD_FORMAT_S16, "Format", "Sample format"); RNA_def_enum(ot->srna, "format", format_items, AUD_FORMAT_S16, "Format", "Sample format");
RNA_def_int(ot->srna, "bitrate", 192, 32, 512, "Bitrate", "Bitrate in kbit/s", 32, 512); RNA_def_int(ot->srna, "bitrate", 192, 32, 512, "Bitrate", "Bitrate in kbit/s", 32, 512);
#endif // WITH_AUDASPACE
} }
/* ******************************************************* */ /* ******************************************************* */

@ -960,20 +960,19 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
if(ibuf) { if(ibuf) {
Image *ima= sima->image; Image *ima= sima->image;
RenderResult *rr= BKE_image_acquire_renderresult(scene, ima);
simopts->planes= ibuf->depth; simopts->planes= ibuf->depth;
/* cant save multilayer sequence, ima->rr isn't valid for a specific frame */ if(ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) {
if(rr && !(ima->source==IMA_SRC_SEQUENCE && ima->type==IMA_TYPE_MULTILAYER))
simopts->imtype= R_MULTILAYER;
else if(ima->type==IMA_TYPE_R_RESULT)
simopts->imtype= scene->r.imtype; simopts->imtype= scene->r.imtype;
else if (ima->source == IMA_SRC_GENERATED) simopts->planes= scene->r.planes;
}
else if (ima->source == IMA_SRC_GENERATED) {
simopts->imtype= R_PNG; simopts->imtype= R_PNG;
else }
else {
simopts->imtype= BKE_ftype_to_imtype(ibuf->ftype); simopts->imtype= BKE_ftype_to_imtype(ibuf->ftype);
}
simopts->subimtype= scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */ simopts->subimtype= scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */
simopts->quality= ibuf->ftype & 0xff; simopts->quality= ibuf->ftype & 0xff;
@ -1000,8 +999,6 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
} }
BLI_path_abs(simopts->filepath, G.main->name); BLI_path_abs(simopts->filepath, G.main->name);
} }
/* cleanup */
BKE_image_release_renderresult(scene, ima);
} }
ED_space_image_release_buffer(sima, lock); ED_space_image_release_buffer(sima, lock);
@ -1016,7 +1013,10 @@ static void save_image_options_from_op(SaveImageOptions *simopts, wmOperator *op
// if (RNA_property_is_set(op->ptr, "subimtype")) simopts->subimtype= RNA_enum_get(op->ptr, "subimtype"); // XXX // if (RNA_property_is_set(op->ptr, "subimtype")) simopts->subimtype= RNA_enum_get(op->ptr, "subimtype"); // XXX
if (RNA_property_is_set(op->ptr, "file_quality")) simopts->quality= RNA_int_get(op->ptr, "file_quality"); if (RNA_property_is_set(op->ptr, "file_quality")) simopts->quality= RNA_int_get(op->ptr, "file_quality");
if (RNA_property_is_set(op->ptr, "filepath")) RNA_string_get(op->ptr, "filepath", simopts->filepath); if (RNA_property_is_set(op->ptr, "filepath")) {
RNA_string_get(op->ptr, "filepath", simopts->filepath);
BLI_path_abs(simopts->filepath, G.main->name);
}
} }
static void save_image_options_to_op(SaveImageOptions *simopts, wmOperator *op) static void save_image_options_to_op(SaveImageOptions *simopts, wmOperator *op)
@ -1069,7 +1069,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
Scene *scene= CTX_data_scene(C); Scene *scene= CTX_data_scene(C);
RenderResult *rr= BKE_image_acquire_renderresult(scene, ima); RenderResult *rr= BKE_image_acquire_renderresult(scene, ima);
if(rr) { if(rr) {
RE_WriteRenderResult(rr, simopts->filepath, simopts->quality); RE_WriteRenderResult(op->reports, rr, simopts->filepath, simopts->quality);
ok= TRUE; ok= TRUE;
} }
else { else {

@ -3677,7 +3677,7 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr)
{ {
Object *ob = (Object *)ptr->id.data; Object *ob = (Object *)ptr->id.data;
PointerRNA settings_ptr; PointerRNA settings_ptr;
uiLayout *row, *subrow, *col;; uiLayout *row, *subrow, *col;
RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);

@ -236,7 +236,7 @@ static int group_select_flag(Group *gr)
return 0; return 0;
} }
static void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag) void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag)
{ {
Scene *scene = (Scene *)poin; Scene *scene = (Scene *)poin;
GroupObject *gob; GroupObject *gob;

@ -218,16 +218,8 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot)
/* Rename --------------------------------------------------- */ /* Rename --------------------------------------------------- */
static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, TreeElement *te, const float mval[2]) void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, ReportList *reports)
{ {
ReportList *reports= CTX_wm_reports(C); // XXX
if(mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
TreeStoreElem *tselem= TREESTORE(te);
/* name and first icon */
if(mval[0]>te->xs+UI_UNIT_X && mval[0]<te->xend) {
/* can't rename rna datablocks entries */ /* can't rename rna datablocks entries */
if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))
; ;
@ -245,6 +237,26 @@ static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, T
tselem->flag |= TSE_TEXTBUT; tselem->flag |= TSE_TEXTBUT;
ED_region_tag_redraw(ar); ED_region_tag_redraw(ar);
} }
}
void item_rename_cb(bContext *C, Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
ARegion *ar= CTX_wm_region(C);
ReportList *reports= CTX_wm_reports(C); // XXX
do_item_rename(ar, te, tselem, reports) ;
}
static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, TreeElement *te, const float mval[2])
{
ReportList *reports= CTX_wm_reports(C); // XXX
if(mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
TreeStoreElem *tselem= TREESTORE(te);
/* name and first icon */
if(mval[0]>te->xs+UI_UNIT_X && mval[0]<te->xend) {
do_item_rename(ar, te, tselem, reports) ;
} }
return 1; return 1;
} }
@ -377,6 +389,12 @@ void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, Tre
} }
} }
void group_toggle_visibility_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
Group *group= (Group *)tselem->id;
restrictbutton_gr_restrict_flag(scene, group, OB_RESTRICT_VIEW);
}
static int outliner_toggle_visibility_exec(bContext *C, wmOperator *UNUSED(op)) static int outliner_toggle_visibility_exec(bContext *C, wmOperator *UNUSED(op))
{ {
SpaceOops *soops= CTX_wm_space_outliner(C); SpaceOops *soops= CTX_wm_space_outliner(C);
@ -417,6 +435,12 @@ void object_toggle_selectability_cb(bContext *UNUSED(C), Scene *scene, TreeEleme
} }
} }
void group_toggle_selectability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
Group *group= (Group *)tselem->id;
restrictbutton_gr_restrict_flag(scene, group, OB_RESTRICT_SELECT);
}
static int outliner_toggle_selectability_exec(bContext *C, wmOperator *UNUSED(op)) static int outliner_toggle_selectability_exec(bContext *C, wmOperator *UNUSED(op))
{ {
SpaceOops *soops= CTX_wm_space_outliner(C); SpaceOops *soops= CTX_wm_space_outliner(C);
@ -457,6 +481,12 @@ void object_toggle_renderability_cb(bContext *UNUSED(C), Scene *scene, TreeEleme
} }
} }
void group_toggle_renderability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
Group *group= (Group *)tselem->id;
restrictbutton_gr_restrict_flag(scene, group, OB_RESTRICT_RENDER);
}
static int outliner_toggle_renderability_exec(bContext *C, wmOperator *UNUSED(op)) static int outliner_toggle_renderability_exec(bContext *C, wmOperator *UNUSED(op))
{ {
SpaceOops *soops= CTX_wm_space_outliner(C); SpaceOops *soops= CTX_wm_space_outliner(C);

@ -129,6 +129,7 @@ typedef struct TreeElement {
/* outliner_tree.c ----------------------------------------------- */ /* outliner_tree.c ----------------------------------------------- */
void outliner_free_tree(ListBase *lb); void outliner_free_tree(ListBase *lb);
void outliner_cleanup_tree(struct SpaceOops *soops);
TreeElement *outliner_find_tse(struct SpaceOops *soops, TreeStoreElem *tse); TreeElement *outliner_find_tse(struct SpaceOops *soops, TreeStoreElem *tse);
TreeElement *outliner_find_id(struct SpaceOops *soops, ListBase *lb, struct ID *id); TreeElement *outliner_find_id(struct SpaceOops *soops, ListBase *lb, struct ID *id);
@ -139,6 +140,7 @@ void outliner_build_tree(struct Main *mainvar, struct Scene *scene, struct Space
/* outliner_draw.c ---------------------------------------------- */ /* outliner_draw.c ---------------------------------------------- */
void draw_outliner(const struct bContext *C); void draw_outliner(const struct bContext *C);
void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag);
/* outliner_select.c -------------------------------------------- */ /* outliner_select.c -------------------------------------------- */
int tree_element_type_active(struct bContext *C, struct Scene *scene, struct SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, int set); int tree_element_type_active(struct bContext *C, struct Scene *scene, struct SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, int set);
@ -158,6 +160,13 @@ void object_toggle_visibility_cb(struct bContext *C, struct Scene *scene, TreeEl
void object_toggle_selectability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem); void object_toggle_selectability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
void object_toggle_renderability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem); void object_toggle_renderability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
void group_toggle_visibility_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
void group_toggle_selectability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
void group_toggle_renderability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
void item_rename_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
/* ...................................................... */ /* ...................................................... */
void OUTLINER_OT_item_activate(struct wmOperatorType *ot); void OUTLINER_OT_item_activate(struct wmOperatorType *ot);

@ -287,6 +287,8 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto
if(base==NULL) if(base==NULL)
base= object_in_scene((Object *)tselem->id, scene); base= object_in_scene((Object *)tselem->id, scene);
if(base) { if(base) {
SpaceOops *soops= CTX_wm_space_outliner(C);
// check also library later // check also library later
if(scene->obedit==base->object) if(scene->obedit==base->object)
ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO); ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO);
@ -294,6 +296,13 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto
ED_base_object_free_and_unlink(CTX_data_main(C), scene, base); ED_base_object_free_and_unlink(CTX_data_main(C), scene, base);
te->directdata= NULL; te->directdata= NULL;
tselem->id= NULL; tselem->id= NULL;
/* XXX: tree management normally happens from draw_outliner(), but when
you're clicking to fast on Delete object from context menu in
outliner several mouse events can be handled in one cycle without
handling notifiers/redraw which leads to deleting the same object twice.
cleanup tree here to prevent such cases. */
outliner_cleanup_tree(soops);
} }
} }
@ -510,6 +519,7 @@ static EnumPropertyItem prop_object_op_types[] = {
{6, "TOGVIS", 0, "Toggle Visible", ""}, {6, "TOGVIS", 0, "Toggle Visible", ""},
{7, "TOGSEL", 0, "Toggle Selectable", ""}, {7, "TOGSEL", 0, "Toggle Selectable", ""},
{8, "TOGREN", 0, "Toggle Renderable", ""}, {8, "TOGREN", 0, "Toggle Renderable", ""},
{9, "RENAME", 0, "Rename", ""},
{0, NULL, 0, NULL, NULL} {0, NULL, 0, NULL, NULL}
}; };
@ -567,6 +577,10 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
str= "Toggle Renderability"; str= "Toggle Renderability";
WM_event_add_notifier(C, NC_SCENE|ND_OB_RENDER, scene); WM_event_add_notifier(C, NC_SCENE|ND_OB_RENDER, scene);
} }
else if(event==9) {
outliner_do_object_operation(C, scene, soops, &soops->tree, item_rename_cb);
str= "Rename Object";
}
ED_undo_push(C, str); ED_undo_push(C, str);
@ -600,6 +614,7 @@ static EnumPropertyItem prop_group_op_types[] = {
{4, "TOGVIS", 0, "Toggle Visible", ""}, {4, "TOGVIS", 0, "Toggle Visible", ""},
{5, "TOGSEL", 0, "Toggle Selectable", ""}, {5, "TOGSEL", 0, "Toggle Selectable", ""},
{6, "TOGREN", 0, "Toggle Renderable", ""}, {6, "TOGREN", 0, "Toggle Renderable", ""},
{7, "RENAME", 0, "Rename", ""},
{0, NULL, 0, NULL, NULL} {0, NULL, 0, NULL, NULL}
}; };
@ -608,6 +623,7 @@ static int outliner_group_operation_exec(bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C); Scene *scene= CTX_data_scene(C);
SpaceOops *soops= CTX_wm_space_outliner(C); SpaceOops *soops= CTX_wm_space_outliner(C);
int event; int event;
const char *str= NULL;
/* check for invalid states */ /* check for invalid states */
if (soops == NULL) if (soops == NULL)
@ -617,18 +633,35 @@ static int outliner_group_operation_exec(bContext *C, wmOperator *op)
if(event==1) { if(event==1) {
outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_group_cb); outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_group_cb);
ED_undo_push(C, "Unlink group"); str= "Unlink group";
} }
else if(event==2) { else if(event==2) {
outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb); outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb);
ED_undo_push(C, "Localized Data"); str= "Localized Data";
} }
else if(event==3) { else if(event==3) {
outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_linkobs2scene_cb); outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_linkobs2scene_cb);
ED_undo_push(C, "Link Group Objects to Scene"); str= "Link Group Objects to Scene";
}
else if(event==4) {
outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_visibility_cb);
str= "Toggle Visibility";
}
else if(event==5) {
outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_selectability_cb);
str= "Toggle Selectability";
}
else if(event==6) {
outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_renderability_cb);
str= "Toggle Renderability";
}
else if(event==7) {
outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb);
str= "Rename";
} }
ED_undo_push(C, str);
WM_event_add_notifier(C, NC_GROUP, NULL); WM_event_add_notifier(C, NC_GROUP, NULL);
return OPERATOR_FINISHED; return OPERATOR_FINISHED;
@ -662,7 +695,8 @@ typedef enum eOutlinerIdOpTypes {
OUTLINER_IDOP_SINGLE, OUTLINER_IDOP_SINGLE,
OUTLINER_IDOP_FAKE_ADD, OUTLINER_IDOP_FAKE_ADD,
OUTLINER_IDOP_FAKE_CLEAR OUTLINER_IDOP_FAKE_CLEAR,
OUTLINER_IDOP_RENAME
} eOutlinerIdOpTypes; } eOutlinerIdOpTypes;
// TODO: implement support for changing the ID-block used // TODO: implement support for changing the ID-block used
@ -672,6 +706,7 @@ static EnumPropertyItem prop_id_op_types[] = {
{OUTLINER_IDOP_SINGLE, "SINGLE", 0, "Make Single User", ""}, {OUTLINER_IDOP_SINGLE, "SINGLE", 0, "Make Single User", ""},
{OUTLINER_IDOP_FAKE_ADD, "ADD_FAKE", 0, "Add Fake User", "Ensure datablock gets saved even if it isn't in use (e.g. for motion and material libraries)"}, {OUTLINER_IDOP_FAKE_ADD, "ADD_FAKE", 0, "Add Fake User", "Ensure datablock gets saved even if it isn't in use (e.g. for motion and material libraries)"},
{OUTLINER_IDOP_FAKE_CLEAR, "CLEAR_FAKE", 0, "Clear Fake User", ""}, {OUTLINER_IDOP_FAKE_CLEAR, "CLEAR_FAKE", 0, "Clear Fake User", ""},
{OUTLINER_IDOP_RENAME, "RENAME", 0, "Rename", ""},
{0, NULL, 0, NULL, NULL} {0, NULL, 0, NULL, NULL}
}; };
@ -765,6 +800,14 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
ED_undo_push(C, "Clear Fake User"); ED_undo_push(C, "Clear Fake User");
} }
break; break;
case OUTLINER_IDOP_RENAME:
/* rename */
outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb);
WM_event_add_notifier(C, NC_ID|NA_EDITED, NULL);
ED_undo_push(C, "Rename");
break;
default: default:
// invalid - unhandled // invalid - unhandled

@ -222,6 +222,12 @@ void outliner_free_tree(ListBase *lb)
} }
} }
void outliner_cleanup_tree(SpaceOops *soops)
{
outliner_free_tree(&soops->tree);
outliner_storage_cleanup(soops);
}
/* Find ith item from the treestore */ /* Find ith item from the treestore */
static TreeElement *outliner_find_tree_element(ListBase *lb, int store_index) static TreeElement *outliner_find_tree_element(ListBase *lb, int store_index)
{ {

@ -154,6 +154,11 @@ static void text_listener(ScrArea *sa, wmNotifier *wmn)
case NA_REMOVED: case NA_REMOVED:
ED_area_tag_redraw(sa); ED_area_tag_redraw(sa);
break; break;
case NA_SELECTED:
if(st->text && st->text == wmn->reference)
text_scroll_to_cursor(st, sa);
break;
} }
break; break;

@ -1821,12 +1821,10 @@ void text_update_character_width(SpaceText *st)
/* Moves the view to the cursor location, /* Moves the view to the cursor location,
also used to make sure the view isnt outside the file */ also used to make sure the view isnt outside the file */
void text_update_cursor_moved(bContext *C) void text_scroll_to_cursor(SpaceText *st, ScrArea *sa)
{ {
ScrArea *sa= CTX_wm_area(C);
SpaceText *st= CTX_wm_space_text(C);
Text *text; Text *text;
ARegion *ar; ARegion *ar= NULL;
int i, x, winx= 0; int i, x, winx= 0;
if(ELEM3(NULL, st, st->text, st->text->curl)) return; if(ELEM3(NULL, st, st->text, st->text->curl)) return;
@ -1834,8 +1832,10 @@ void text_update_cursor_moved(bContext *C)
text= st->text; text= st->text;
for(ar=sa->regionbase.first; ar; ar= ar->next) for(ar=sa->regionbase.first; ar; ar= ar->next)
if(ar->regiontype==RGN_TYPE_WINDOW) if(ar->regiontype==RGN_TYPE_WINDOW) {
winx= ar->winx; winx= ar->winx;
break;
}
winx -= TXT_SCROLL_WIDTH; winx -= TXT_SCROLL_WIDTH;
@ -1844,7 +1844,7 @@ void text_update_cursor_moved(bContext *C)
i= txt_get_span(text->lines.first, text->sell); i= txt_get_span(text->lines.first, text->sell);
if(st->wordwrap) { if(st->wordwrap) {
int offl, offc; int offl, offc;
wrap_offset(st, CTX_wm_region(C), text->sell, text->selc, &offl, &offc); wrap_offset(st, ar, text->sell, text->selc, &offl, &offc);
i+= offl; i+= offl;
} }
@ -1865,3 +1865,10 @@ void text_update_cursor_moved(bContext *C)
if(st->left <0) st->left= 0; if(st->left <0) st->left= 0;
} }
void text_update_cursor_moved(bContext *C)
{
ScrArea *sa= CTX_wm_area(C);
SpaceText *st= CTX_wm_space_text(C);
text_scroll_to_cursor(st, sa);
}

@ -55,6 +55,7 @@ int text_font_width(struct SpaceText *st, const char *str);
void text_update_line_edited(struct TextLine *line); void text_update_line_edited(struct TextLine *line);
void text_update_edited(struct Text *text); void text_update_edited(struct Text *text);
void text_update_character_width(struct SpaceText *st); void text_update_character_width(struct SpaceText *st);
void text_scroll_to_cursor(struct SpaceText *st, struct ScrArea *sa);
void text_update_cursor_moved(struct bContext *C); void text_update_cursor_moved(struct bContext *C);
/* TXT_OFFSET used to be 35 when the scrollbar was on the left... */ /* TXT_OFFSET used to be 35 when the scrollbar was on the left... */

@ -3475,7 +3475,7 @@ void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist)
copy_m3_m4(nmat, mat); copy_m3_m4(nmat, mat);
normalize_m3(nmat); normalize_m3(nmat);
mul_m3_v3(nmat, vec);; mul_m3_v3(nmat, vec);
sub_v3_v3(ofs, vec); sub_v3_v3(ofs, vec);
} }
} }

@ -499,7 +499,7 @@ void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, i
void IMB_rectfill_alpha(struct ImBuf *ibuf, const float value); void IMB_rectfill_alpha(struct ImBuf *ibuf, const float value);
/* this should not be here, really, we needed it for operating on render data, IMB_rectfill_area calls it */ /* this should not be here, really, we needed it for operating on render data, IMB_rectfill_area calls it */
void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, float *col, int x1, int y1, int x2, int y2); void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, const float col[4], int x1, int y1, int x2, int y2);
/* defined in metadata.c */ /* defined in metadata.c */
int IMB_metadata_change_field(struct ImBuf *img, const char *key, const char *field); int IMB_metadata_change_field(struct ImBuf *img, const char *key, const char *field);

@ -487,7 +487,7 @@ void IMB_exr_add_channel(void *handle, const char *layname, const char *passname
} }
/* only used for writing temp. render results (not image files) */ /* only used for writing temp. render results (not image files) */
void IMB_exr_begin_write(void *handle, const char *filename, int width, int height, int compress) int IMB_exr_begin_write(void *handle, const char *filename, int width, int height, int compress)
{ {
ExrHandle *data= (ExrHandle *)handle; ExrHandle *data= (ExrHandle *)handle;
Header header (width, height); Header header (width, height);
@ -505,7 +505,16 @@ void IMB_exr_begin_write(void *handle, const char *filename, int width, int heig
header.insert ("BlenderMultiChannel", StringAttribute ("Blender V2.55.1 and newer")); header.insert ("BlenderMultiChannel", StringAttribute ("Blender V2.55.1 and newer"));
/* avoid crash/abort when we dont have permission to write here */
try {
data->ofile = new OutputFile(filename, header); data->ofile = new OutputFile(filename, header);
}
catch (const std::exception &exc) {
std::cerr << "IMB_exr_begin_write: ERROR: " << exc.what() << std::endl;
data->ofile = NULL;
}
return (data->ofile != NULL);
} }
void IMB_exrtile_begin_write(void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley) void IMB_exrtile_begin_write(void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley)

@ -50,7 +50,7 @@ void * IMB_exr_get_handle (void);
void IMB_exr_add_channel (void *handle, const char *layname, const char *passname, int xstride, int ystride, float *rect); void IMB_exr_add_channel (void *handle, const char *layname, const char *passname, int xstride, int ystride, float *rect);
int IMB_exr_begin_read (void *handle, const char *filename, int *width, int *height); int IMB_exr_begin_read (void *handle, const char *filename, int *width, int *height);
void IMB_exr_begin_write (void *handle, const char *filename, int width, int height, int compress); int IMB_exr_begin_write (void *handle, const char *filename, int width, int height, int compress);
void IMB_exrtile_begin_write (void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley); void IMB_exrtile_begin_write (void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley);
void IMB_exr_set_channel (void *handle, const char *layname, const char *passname, int xstride, int ystride, float *rect); void IMB_exr_set_channel (void *handle, const char *layname, const char *passname, int xstride, int ystride, float *rect);
@ -75,7 +75,7 @@ void * IMB_exr_get_handle (void) {return NULL;}
void IMB_exr_add_channel (void *handle, const char *layname, const char *channame, int xstride, int ystride, float *rect) { (void)handle; (void)layname; (void)channame; (void)xstride; (void)ystride; (void)rect; } void IMB_exr_add_channel (void *handle, const char *layname, const char *channame, int xstride, int ystride, float *rect) { (void)handle; (void)layname; (void)channame; (void)xstride; (void)ystride; (void)rect; }
int IMB_exr_begin_read (void *handle, const char *filename, int *width, int *height) { (void)handle; (void)filename; (void)width; (void)height; return 0;} int IMB_exr_begin_read (void *handle, const char *filename, int *width, int *height) { (void)handle; (void)filename; (void)width; (void)height; return 0;}
void IMB_exr_begin_write (void *handle, const char *filename, int width, int height, int compress) { (void)handle; (void)filename; (void)width; (void)height; (void)compress; } int IMB_exr_begin_write (void *handle, const char *filename, int width, int height, int compress) { (void)handle; (void)filename; (void)width; (void)height; (void)compress; return 0;}
void IMB_exrtile_begin_write (void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley) { (void)handle; (void)filename; (void)mipmap; (void)width; (void)height; (void)tilex; (void)tiley; } void IMB_exrtile_begin_write (void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley) { (void)handle; (void)filename; (void)mipmap; (void)width; (void)height; (void)tilex; (void)tiley; }
void IMB_exr_set_channel (void *handle, char *layname, const char *channame, int xstride, int ystride, float *rect) { (void)handle; (void)layname; (void)channame; (void)xstride; (void)ystride; (void)rect; } void IMB_exr_set_channel (void *handle, char *layname, const char *channame, int xstride, int ystride, float *rect) { (void)handle; (void)layname; (void)channame; (void)xstride; (void)ystride; (void)rect; }

@ -482,7 +482,7 @@ void IMB_rectfill(struct ImBuf *drect, const float col[4])
} }
void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, float *col, int x1, int y1, int x2, int y2) void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, const float col[4], int x1, int y1, int x2, int y2)
{ {
int i, j; int i, j;
float a; /* alpha */ float a; /* alpha */
@ -510,6 +510,8 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
unsigned char chr=0, chg=0, chb=0; unsigned char chr=0, chg=0, chb=0;
float fr=0, fg=0, fb=0; float fr=0, fg=0, fb=0;
const int alphaint= FTOCHAR(a);
if (a == 1.0f) { if (a == 1.0f) {
chr = FTOCHAR(col[0]); chr = FTOCHAR(col[0]);
chg = FTOCHAR(col[1]); chg = FTOCHAR(col[1]);
@ -527,10 +529,13 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
pixel[0] = chr; pixel[0] = chr;
pixel[1] = chg; pixel[1] = chg;
pixel[2] = chb; pixel[2] = chb;
pixel[3] = 255;
} else { } else {
int alphatest;
pixel[0] = (char)((fr + ((float)pixel[0]*aich))*255.0f); pixel[0] = (char)((fr + ((float)pixel[0]*aich))*255.0f);
pixel[1] = (char)((fg + ((float)pixel[1]*aich))*255.0f); pixel[1] = (char)((fg + ((float)pixel[1]*aich))*255.0f);
pixel[2] = (char)((fb + ((float)pixel[2]*aich))*255.0f); pixel[2] = (char)((fb + ((float)pixel[2]*aich))*255.0f);
pixel[3] = (char)((alphatest= ((int)pixel[3] + alphaint)) < 255 ? alphatest : 255);
} }
} }
} }
@ -546,10 +551,13 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
pixel[0] = col[0]; pixel[0] = col[0];
pixel[1] = col[1]; pixel[1] = col[1];
pixel[2] = col[2]; pixel[2] = col[2];
pixel[3] = 1.0f;
} else { } else {
float alphatest;
pixel[0] = (col[0]*a) + (pixel[0]*ai); pixel[0] = (col[0]*a) + (pixel[0]*ai);
pixel[1] = (col[1]*a) + (pixel[1]*ai); pixel[1] = (col[1]*a) + (pixel[1]*ai);
pixel[2] = (col[2]*a) + (pixel[2]*ai); pixel[2] = (col[2]*a) + (pixel[2]*ai);
pixel[3] = (alphatest= (pixel[3] + a)) < 1.0f ? alphatest : 1.0f;
} }
} }
} }

@ -55,7 +55,6 @@ short IMB_saveiff(struct ImBuf *ibuf, const char *name, int flags)
if(ibuf->rect==NULL && ibuf->rect_float) if(ibuf->rect==NULL && ibuf->rect_float)
IMB_rect_from_float(ibuf); IMB_rect_from_float(ibuf);
} }
/* TODO. have const char for image write funcs */
return type->save(ibuf, name, flags); return type->save(ibuf, name, flags);
} }
} }

@ -2216,8 +2216,17 @@ char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop, char *fi
else else
buf= MEM_mallocN(sizeof(char)*(length+1), "RNA_string_get_alloc"); buf= MEM_mallocN(sizeof(char)*(length+1), "RNA_string_get_alloc");
#ifndef NDEBUG
/* safety check to ensure the string is actually set */
buf[length]= 255;
#endif
RNA_property_string_get(ptr, prop, buf); RNA_property_string_get(ptr, prop, buf);
#ifndef NDEBUG
BLI_assert(buf[length] == '\0');
#endif
return buf; return buf;
} }

@ -184,7 +184,11 @@ static void rna_DomainFluidSettings_memory_estimate_get(PointerRNA *ptr, char *v
static int rna_DomainFluidSettings_memory_estimate_length(PointerRNA *ptr) static int rna_DomainFluidSettings_memory_estimate_length(PointerRNA *ptr)
{ {
return 32; #ifdef DISABLE_ELBEEM
return 0;
#else
return 31;
#endif
} }
static char *rna_FluidSettings_path(PointerRNA *ptr) static char *rna_FluidSettings_path(PointerRNA *ptr)

@ -111,7 +111,7 @@ void RNA_api_scene(StructRNA *srna)
#ifdef WITH_COLLADA #ifdef WITH_COLLADA
/* don't remove this, as COLLADA exporting cannot be done through operators in render() callback. */ /* don't remove this, as COLLADA exporting cannot be done through operators in render() callback. */
func= RNA_def_function(srna, "collada_export", "rna_Scene_collada_export"); func= RNA_def_function(srna, "collada_export", "rna_Scene_collada_export");
parm= RNA_def_string(func, "filepath", "", FILE_MAX, "File Path", "File path to write Collada file."); RNA_def_string(func, "filepath", "", FILE_MAX, "File Path", "File path to write Collada file.");
parm= RNA_def_boolean(func, "selected", 0, "Export only selected", "Export only selected elements."); parm= RNA_def_boolean(func, "selected", 0, "Export only selected", "Export only selected elements.");
RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_property_flag(parm, PROP_REQUIRED);
RNA_def_property_subtype(parm, PROP_FILEPATH); /* allow non utf8 */ RNA_def_property_subtype(parm, PROP_FILEPATH); /* allow non utf8 */

@ -591,7 +591,8 @@ static void rna_SpaceTextEditor_text_set(PointerRNA *ptr, PointerRNA value)
SpaceText *st= (SpaceText*)(ptr->data); SpaceText *st= (SpaceText*)(ptr->data);
st->text= value.data; st->text= value.data;
st->top= 0;
WM_main_add_notifier(NC_TEXT|NA_SELECTED, st->text);
} }
static void rna_SpaceTextEditor_updateEdited(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) static void rna_SpaceTextEditor_updateEdited(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)

@ -680,20 +680,14 @@ static void rna_wmKeyMapItem_name_get(PointerRNA *ptr, char *value)
{ {
wmKeyMapItem *kmi= ptr->data; wmKeyMapItem *kmi= ptr->data;
wmOperatorType *ot= WM_operatortype_find(kmi->idname, 1); wmOperatorType *ot= WM_operatortype_find(kmi->idname, 1);
strcpy(value, ot ? ot->name : kmi->idname);
if (ot)
strcpy(value, ot->name);
} }
static int rna_wmKeyMapItem_name_length(PointerRNA *ptr) static int rna_wmKeyMapItem_name_length(PointerRNA *ptr)
{ {
wmKeyMapItem *kmi= ptr->data; wmKeyMapItem *kmi= ptr->data;
wmOperatorType *ot= WM_operatortype_find(kmi->idname, 1); wmOperatorType *ot= WM_operatortype_find(kmi->idname, 1);
return strlen(ot ? ot->name : kmi->idname);
if (ot)
return strlen(ot->name);
else
return 0;
} }
static int rna_KeyMapItem_userdefined_get(PointerRNA *ptr) static int rna_KeyMapItem_userdefined_get(PointerRNA *ptr)
@ -1653,6 +1647,8 @@ static void rna_def_keyconfig(BlenderRNA *brna)
RNA_def_struct_name_property(srna, prop); RNA_def_struct_name_property(srna, prop);
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
/* this is infact the operator name, but if the operator can't be found we
* fallback on the operator ID */
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Name", "Name of operator to call on input event"); RNA_def_property_ui_text(prop, "Name", "Name of operator to call on input event");

@ -52,11 +52,9 @@ static int Buffer_len(Buffer *self);
static PyObject *Buffer_item(Buffer *self, int i); static PyObject *Buffer_item(Buffer *self, int i);
static PyObject *Buffer_slice(Buffer *self, int begin, int end); static PyObject *Buffer_slice(Buffer *self, int begin, int end);
static int Buffer_ass_item(Buffer *self, int i, PyObject *v); static int Buffer_ass_item(Buffer *self, int i, PyObject *v);
static int Buffer_ass_slice(Buffer *self, int begin, int end, static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq);
PyObject *seq);
static PyObject *Buffer_subscript(Buffer *self, PyObject *item); static PyObject *Buffer_subscript(Buffer *self, PyObject *item);
static int Buffer_ass_subscript(Buffer *self, PyObject *item, static int Buffer_ass_subscript(Buffer *self, PyObject *item, PyObject *value);
PyObject *value);
static PySequenceMethods Buffer_SeqMethods = { static PySequenceMethods Buffer_SeqMethods = {
(lenfunc) Buffer_len, /*sq_length */ (lenfunc) Buffer_len, /*sq_length */

@ -208,78 +208,35 @@ PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...)
return item; return item;
} }
/* returns the exception string as a new PyUnicode object, depends on external StringIO module */ /* returns the exception string as a new PyUnicode object, depends on external traceback module */
PyObject *PyC_ExceptionBuffer(void) PyObject *PyC_ExceptionBuffer(void)
{ {
PyObject *stdout_backup = PySys_GetObject("stdout"); /* borrowed */ PyObject *traceback_mod= NULL;
PyObject *stderr_backup = PySys_GetObject("stderr"); /* borrowed */ PyObject *format_tb_func= NULL;
PyObject *string_io = NULL; PyObject *ret= NULL;
PyObject *string_io_buf = NULL;
PyObject *string_io_mod= NULL;
PyObject *string_io_getvalue= NULL;
PyObject *error_type, *error_value, *error_traceback; if(! (traceback_mod= PyImport_ImportModule("traceback")) ) {
if (!PyErr_Occurred())
return NULL;
PyErr_Fetch(&error_type, &error_value, &error_traceback);
PyErr_Clear();
/* import io
* string_io = io.StringIO()
*/
if(! (string_io_mod= PyImport_ImportModule("io")) ) {
goto error_cleanup; goto error_cleanup;
} }
else if (! (string_io = PyObject_CallMethod(string_io_mod, (char *)"StringIO", NULL))) { else if (! (format_tb_func= PyObject_GetAttrString(traceback_mod, "format_exc"))) {
goto error_cleanup;
}
else if (! (string_io_getvalue= PyObject_GetAttrString(string_io, "getvalue"))) {
goto error_cleanup; goto error_cleanup;
} }
Py_INCREF(stdout_backup); // since these were borrowed we dont want them freed when replaced. ret= PyObject_CallObject(format_tb_func, NULL);
Py_INCREF(stderr_backup);
PySys_SetObject("stdout", string_io); // both of these are free'd when restoring
PySys_SetObject("stderr", string_io);
PyErr_Restore(error_type, error_value, error_traceback);
PyErr_Print(); /* print the error */
PyErr_Clear();
string_io_buf = PyObject_CallObject(string_io_getvalue, NULL);
PySys_SetObject("stdout", stdout_backup);
PySys_SetObject("stderr", stderr_backup);
Py_DECREF(stdout_backup); /* now sys owns the ref again */
Py_DECREF(stderr_backup);
Py_DECREF(string_io_mod);
Py_DECREF(string_io_getvalue);
Py_DECREF(string_io); /* free the original reference */
PyErr_Clear();
return string_io_buf;
if(ret == Py_None) {
Py_DECREF(ret);
ret= NULL;
}
error_cleanup: error_cleanup:
/* could not import the module so print the error and close */ /* could not import the module so print the error and close */
Py_XDECREF(string_io_mod); Py_XDECREF(traceback_mod);
Py_XDECREF(string_io); Py_XDECREF(format_tb_func);
PyErr_Restore(error_type, error_value, error_traceback); return ret;
PyErr_Print(); /* print the error */
PyErr_Clear();
return NULL;
} }
/* string conversion, escape non-unicode chars, coerce must be set to NULL */ /* string conversion, escape non-unicode chars, coerce must be set to NULL */
const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce) const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
{ {

@ -42,6 +42,7 @@ static PyTypeObject BlenderAppCbType;
static PyStructSequence_Field app_cb_info_fields[]= { static PyStructSequence_Field app_cb_info_fields[]= {
{(char *)"render_pre", NULL}, {(char *)"render_pre", NULL},
{(char *)"render_post", NULL}, {(char *)"render_post", NULL},
{(char *)"render_stats", NULL},
{(char *)"load_pre", NULL}, {(char *)"load_pre", NULL},
{(char *)"load_post", NULL}, {(char *)"load_post", NULL},
{(char *)"save_pre", NULL}, {(char *)"save_pre", NULL},

@ -40,7 +40,7 @@ PyObject *bpy_intern_str___slots__;
void bpy_intern_string_init(void) void bpy_intern_string_init(void)
{ {
bpy_intern_str_register= PyUnicode_FromString("register"); bpy_intern_str_register= PyUnicode_FromString("register");
bpy_intern_str_unregister= PyUnicode_FromString("unregister");; bpy_intern_str_unregister= PyUnicode_FromString("unregister");
bpy_intern_str_bl_rna= PyUnicode_FromString("bl_rna"); bpy_intern_str_bl_rna= PyUnicode_FromString("bl_rna");
bpy_intern_str_order= PyUnicode_FromString("order"); bpy_intern_str_order= PyUnicode_FromString("order");
bpy_intern_str_attr= PyUnicode_FromString("attr"); bpy_intern_str_attr= PyUnicode_FromString("attr");

@ -1298,7 +1298,9 @@ PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
{ {
int subtype= RNA_property_subtype(prop); int subtype= RNA_property_subtype(prop);
const char *buf; const char *buf;
buf= RNA_property_string_get_alloc(ptr, prop, NULL, -1); char buf_fixed[32];
buf= RNA_property_string_get_alloc(ptr, prop, buf_fixed, sizeof(buf_fixed));
#ifdef USE_STRING_COERCE #ifdef USE_STRING_COERCE
/* only file paths get special treatment, they may contain non utf-8 chars */ /* only file paths get special treatment, they may contain non utf-8 chars */
if(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) { if(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
@ -1310,7 +1312,9 @@ PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
#else // USE_STRING_COERCE #else // USE_STRING_COERCE
ret= PyUnicode_FromString(buf); ret= PyUnicode_FromString(buf);
#endif // USE_STRING_COERCE #endif // USE_STRING_COERCE
if(buf_fixed != buf) {
MEM_freeN((void *)buf); MEM_freeN((void *)buf);
}
break; break;
} }
case PROP_ENUM: case PROP_ENUM:
@ -5107,7 +5111,7 @@ static PyTypeObject pyrna_prop_collection_idprop_Type= {
pyrna_prop_collection_idprop_methods, /* struct PyMethodDef *tp_methods; */ pyrna_prop_collection_idprop_methods, /* struct PyMethodDef *tp_methods; */
NULL, /* struct PyMemberDef *tp_members; */ NULL, /* struct PyMemberDef *tp_members; */
NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */ NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */
&pyrna_prop_collection_Type, /* struct _typeobject *tp_base; */ &pyrna_prop_collection_Type,/* struct _typeobject *tp_base; */
NULL, /* PyObject *tp_dict; */ NULL, /* PyObject *tp_dict; */
NULL, /* descrgetfunc tp_descr_get; */ NULL, /* descrgetfunc tp_descr_get; */
NULL, /* descrsetfunc tp_descr_set; */ NULL, /* descrsetfunc tp_descr_set; */

@ -227,8 +227,8 @@ void RE_SetReports(struct Render *re, struct ReportList *reports);
/* main preview render call */ /* main preview render call */
void RE_PreviewRender(struct Render *re, struct Main *bmain, struct Scene *scene); void RE_PreviewRender(struct Render *re, struct Main *bmain, struct Scene *scene);
void RE_ReadRenderResult(struct Scene *scene, struct Scene *scenode); int RE_ReadRenderResult(struct Scene *scene, struct Scene *scenode);
void RE_WriteRenderResult(RenderResult *rr, const char *filename, int compress); int RE_WriteRenderResult(struct ReportList *reports, RenderResult *rr, const char *filename, int compress);
struct RenderResult *RE_MultilayerConvert(void *exrhandle, int rectx, int recty); struct RenderResult *RE_MultilayerConvert(void *exrhandle, int rectx, int recty);
extern const float default_envmap_layout[]; extern const float default_envmap_layout[];

@ -173,6 +173,9 @@ static void stats_background(void *UNUSED(arg), RenderStats *rs)
else else
fprintf(stdout, "Sce: %s Ve:%d Fa:%d La:%d", rs->scenename, rs->totvert, rs->totface, rs->totlamp); fprintf(stdout, "Sce: %s Ve:%d Fa:%d La:%d", rs->scenename, rs->totvert, rs->totface, rs->totlamp);
} }
BLI_exec_cb(G.main, NULL, BLI_CB_EVT_RENDER_STATS);
fputc('\n', stdout); fputc('\n', stdout);
fflush(stdout); fflush(stdout);
} }
@ -824,11 +827,12 @@ static char *make_pass_name(RenderPass *rpass, int chan)
/* filename already made absolute */ /* filename already made absolute */
/* called from within UI, saves both rendered result as a file-read result */ /* called from within UI, saves both rendered result as a file-read result */
void RE_WriteRenderResult(RenderResult *rr, const char *filename, int compress) int RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *filename, int compress)
{ {
RenderLayer *rl; RenderLayer *rl;
RenderPass *rpass; RenderPass *rpass;
void *exrhandle= IMB_exr_get_handle(); void *exrhandle= IMB_exr_get_handle();
int success;
BLI_make_existing_file(filename); BLI_make_existing_file(filename);
@ -865,10 +869,19 @@ void RE_WriteRenderResult(RenderResult *rr, const char *filename, int compress)
} }
} }
IMB_exr_begin_write(exrhandle, filename, rr->rectx, rr->recty, compress); /* when the filename has no permissions, this can fail */
if(IMB_exr_begin_write(exrhandle, filename, rr->rectx, rr->recty, compress)) {
IMB_exr_write_channels(exrhandle); IMB_exr_write_channels(exrhandle);
success= TRUE;
}
else {
/* TODO, get the error from openexr's exception */
BKE_report(reports, RPT_ERROR, "Error Writing Render Result, see console");
success= FALSE;
}
IMB_exr_close(exrhandle); IMB_exr_close(exrhandle);
return success;
} }
/* callbacks for RE_MultilayerConvert */ /* callbacks for RE_MultilayerConvert */
@ -992,9 +1005,10 @@ static int read_render_result_from_file(const char *filename, RenderResult *rr)
} }
/* only for temp buffer files, makes exact copy of render result */ /* only for temp buffer files, makes exact copy of render result */
static void read_render_result(Render *re, int sample) static int read_render_result(Render *re, int sample)
{ {
char str[FILE_MAX]; char str[FILE_MAX];
int success;
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE); BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
@ -1004,10 +1018,18 @@ static void read_render_result(Render *re, int sample)
render_unique_exr_name(re, str, sample); render_unique_exr_name(re, str, sample);
printf("read exr tmp file: %s\n", str); printf("read exr tmp file: %s\n", str);
if(!read_render_result_from_file(str, re->result)) if(read_render_result_from_file(str, re->result)) {
success= TRUE;
}
else {
printf("cannot read: %s\n", str); printf("cannot read: %s\n", str);
success= FALSE;
}
BLI_rw_mutex_unlock(&re->resultmutex); BLI_rw_mutex_unlock(&re->resultmutex);
return success;
} }
/* *************************************************** */ /* *************************************************** */
@ -2981,7 +3003,7 @@ static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, c
if(re->r.imtype==R_MULTILAYER) { if(re->r.imtype==R_MULTILAYER) {
if(re->result) { if(re->result) {
RE_WriteRenderResult(re->result, name, scene->r.quality); RE_WriteRenderResult(re->reports, re->result, name, scene->r.quality);
printf("Saved: %s", name); printf("Saved: %s", name);
} }
} }
@ -3198,7 +3220,7 @@ void RE_PreviewRender(Render *re, Main *bmain, Scene *sce)
/* note; repeated win/disprect calc... solve that nicer, also in compo */ /* note; repeated win/disprect calc... solve that nicer, also in compo */
/* only the temp file! */ /* only the temp file! */
void RE_ReadRenderResult(Scene *scene, Scene *scenode) int RE_ReadRenderResult(Scene *scene, Scene *scenode)
{ {
Render *re; Render *re;
int winx, winy; int winx, winy;
@ -3232,7 +3254,7 @@ void RE_ReadRenderResult(Scene *scene, Scene *scenode)
RE_InitState(re, NULL, &scene->r, NULL, winx, winy, &disprect); RE_InitState(re, NULL, &scene->r, NULL, winx, winy, &disprect);
re->scene= scene; re->scene= scene;
read_render_result(re, 0); return read_render_result(re, 0);
} }
void RE_set_max_threads(int threads) void RE_set_max_threads(int threads)

@ -282,10 +282,10 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
else if(ok1==0 || ok2==0) return; else if(ok1==0 || ok2==0) return;
/* at least 1 visible interesction point */ /* at least 1 visible interesction point */
if(t1<0.0f && t2<0.0f) return; if(t1<0.0 && t2<0.0) return;
if(t1<0.0f) t1= 0.0f; if(t1<0.0) t1= 0.0;
if(t2<0.0f) t2= 0.0f; if(t2<0.0) t2= 0.0;
if(t1==t2) return; if(t1==t2) return;
@ -423,8 +423,8 @@ float fresnel_fac(float *view, float *vn, float grad, float fac)
static double saacos_d(double fac) static double saacos_d(double fac)
{ {
if(fac<= -1.0f) return M_PI; if(fac<= -1.0) return M_PI;
else if(fac>=1.0f) return 0.0; else if(fac>=1.0) return 0.0;
else return acos(fac); else return acos(fac);
} }
@ -590,7 +590,7 @@ static float CookTorr_Spec(float *n, float *l, float *v, int hard, int tangent)
i= spec(nh, hard); i= spec(nh, hard);
i= i/(0.1+nv); i= i/(0.1f+nv);
return i; return i;
} }
@ -896,7 +896,7 @@ static void ramp_diffuse_result(float *diff, ShadeInput *shi)
if(ma->ramp_col) { if(ma->ramp_col) {
if(ma->rampin_col==MA_RAMP_IN_RESULT) { if(ma->rampin_col==MA_RAMP_IN_RESULT) {
fac= 0.3*diff[0] + 0.58*diff[1] + 0.12*diff[2]; fac= 0.3f*diff[0] + 0.58f*diff[1] + 0.12f*diff[2];
do_colorband(ma->ramp_col, fac, col); do_colorband(ma->ramp_col, fac, col);
/* blending method */ /* blending method */
@ -926,7 +926,7 @@ static void add_to_diffuse(float *diff, ShadeInput *shi, float is, float r, floa
/* input */ /* input */
switch(ma->rampin_col) { switch(ma->rampin_col) {
case MA_RAMP_IN_ENERGY: case MA_RAMP_IN_ENERGY:
fac= 0.3*r + 0.58*g + 0.12*b; fac= 0.3f*r + 0.58f*g + 0.12f*b;
break; break;
case MA_RAMP_IN_SHADER: case MA_RAMP_IN_SHADER:
fac= is; fac= is;
@ -966,7 +966,7 @@ static void ramp_spec_result(float *specr, float *specg, float *specb, ShadeInpu
float fac; float fac;
if(ma->ramp_spec && (ma->rampin_spec==MA_RAMP_IN_RESULT)) { if(ma->ramp_spec && (ma->rampin_spec==MA_RAMP_IN_RESULT)) {
fac= 0.3*(*specr) + 0.58*(*specg) + 0.12*(*specb); fac= 0.3f*(*specr) + 0.58f*(*specg) + 0.12f*(*specb);
do_colorband(ma->ramp_spec, fac, col); do_colorband(ma->ramp_spec, fac, col);
/* blending method */ /* blending method */
@ -1213,7 +1213,7 @@ float lamp_get_visibility(LampRen *lar, float *co, float *lv, float *dist)
} }
} }
} }
if (visifac <= 0.001) visifac = 0.0f; if (visifac <= 0.001f) visifac = 0.0f;
return visifac; return visifac;
} }
} }
@ -1231,7 +1231,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
view= shi->view; view= shi->view;
if (lar->energy == 0.0) return; if (lar->energy == 0.0f) return;
/* only shadow lamps shouldn't affect shadow-less materials at all */ /* only shadow lamps shouldn't affect shadow-less materials at all */
if ((lar->mode & LA_ONLYSHADOW) && (!(ma->mode & MA_SHADOW) || !(R.r.mode & R_SHADOW))) if ((lar->mode & LA_ONLYSHADOW) && (!(ma->mode & MA_SHADOW) || !(R.r.mode & R_SHADOW)))
return; return;
@ -1359,7 +1359,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
/* 'is' is diffuse */ /* 'is' is diffuse */
if((ma->shade_flag & MA_CUBIC) && is>0.0f && is<1.0f) if((ma->shade_flag & MA_CUBIC) && is>0.0f && is<1.0f)
is= 3.0*is*is - 2.0*is*is*is; // nicer termination of shades is= 3.0f*is*is - 2.0f*is*is*is; // nicer termination of shades
i= is*phongcorr; i= is*phongcorr;
@ -1388,7 +1388,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
lamp_get_shadow(lar, shi, inp, shadfac, shi->depth); lamp_get_shadow(lar, shi, inp, shadfac, shi->depth);
/* warning, here it skips the loop */ /* warning, here it skips the loop */
if((lar->mode & LA_ONLYSHADOW) && i>0.0) { if((lar->mode & LA_ONLYSHADOW) && i>0.0f) {
shadfac[3]= i*lar->energy*(1.0f-shadfac[3]); shadfac[3]= i*lar->energy*(1.0f-shadfac[3]);
shr->shad[0] -= shadfac[3]*shi->r*(1.0f-lashdw[0]); shr->shad[0] -= shadfac[3]*shi->r*(1.0f-lashdw[0]);
@ -1448,7 +1448,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
t= vn[0]*lv[0]+vn[1]*lv[1]+vn[2]*lv[2]; t= vn[0]*lv[0]+vn[1]*lv[1]+vn[2]*lv[2];
if(lar->type==LA_HEMI) { if(lar->type==LA_HEMI) {
t= 0.5*t+0.5; t= 0.5f*t+0.5f;
} }
t= shadfac[3]*shi->spec*spec(t, shi->har); t= shadfac[3]*shi->spec*spec(t, shi->har);

@ -108,20 +108,27 @@ static GHash *global_ops_hash= NULL;
wmOperatorType *WM_operatortype_find(const char *idname, int quiet) wmOperatorType *WM_operatortype_find(const char *idname, int quiet)
{ {
if(idname[0]) {
wmOperatorType *ot; wmOperatorType *ot;
char idname_bl[OP_MAX_TYPENAME]; // XXX, needed to support python style names without the _OT_ syntax /* needed to support python style names without the _OT_ syntax */
char idname_bl[OP_MAX_TYPENAME];
WM_operator_bl_idname(idname_bl, idname); WM_operator_bl_idname(idname_bl, idname);
if (idname_bl[0]) {
ot= BLI_ghash_lookup(global_ops_hash, idname_bl); ot= BLI_ghash_lookup(global_ops_hash, idname_bl);
if(ot) { if(ot) {
return ot; return ot;
} }
}
if(!quiet) if(!quiet) {
printf("search for unknown operator %s, %s\n", idname_bl, idname); printf("search for unknown operator '%s', '%s'\n", idname_bl, idname);
}
}
else {
if(!quiet) {
printf("search for empty operator\n");
}
}
return NULL; return NULL;
} }
@ -1259,11 +1266,12 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
split = uiLayoutSplit(layout, 0, 0); split = uiLayoutSplit(layout, 0, 0);
col = uiLayoutColumn(split, 0); col = uiLayoutColumn(split, 0);
uiItemL(col, "Links", ICON_NONE); uiItemL(col, "Links", ICON_NONE);
uiItemStringO(col, "Donations", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment/"); uiItemStringO(col, "Donations", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment");
uiItemStringO(col, "Release Log", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-259/"); uiItemStringO(col, "Credits", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/credits");
uiItemStringO(col, "Release Log", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-259");
uiItemStringO(col, "Manual", ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.5/Manual"); uiItemStringO(col, "Manual", ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.5/Manual");
uiItemStringO(col, "Blender Website", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/"); uiItemStringO(col, "Blender Website", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org");
uiItemStringO(col, "User Community", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community/"); // uiItemStringO(col, "User Community", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community");
if(strcmp(STRINGIFY(BLENDER_VERSION_CYCLE), "release")==0) { if(strcmp(STRINGIFY(BLENDER_VERSION_CYCLE), "release")==0) {
BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d" STRINGIFY(BLENDER_VERSION_CHAR) "_release", BLENDER_VERSION/100, BLENDER_VERSION%100); BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d" STRINGIFY(BLENDER_VERSION_CHAR) "_release", BLENDER_VERSION/100, BLENDER_VERSION%100);
} }

@ -61,166 +61,164 @@ public:
/* The reverse table. In order to not confuse ourselves, we */ /* The reverse table. In order to not confuse ourselves, we */
/* immediately convert all events that come in to KX codes. */ /* immediately convert all events that come in to KX codes. */
m_reverseKeyTranslateTable[LEFTMOUSE ] = KX_LEFTMOUSE ; m_reverseKeyTranslateTable[LEFTMOUSE ] = KX_LEFTMOUSE;
m_reverseKeyTranslateTable[MIDDLEMOUSE ] = KX_MIDDLEMOUSE ; m_reverseKeyTranslateTable[MIDDLEMOUSE ] = KX_MIDDLEMOUSE;
m_reverseKeyTranslateTable[RIGHTMOUSE ] = KX_RIGHTMOUSE ; m_reverseKeyTranslateTable[RIGHTMOUSE ] = KX_RIGHTMOUSE;
m_reverseKeyTranslateTable[WHEELUPMOUSE ] = KX_WHEELUPMOUSE ; m_reverseKeyTranslateTable[WHEELUPMOUSE ] = KX_WHEELUPMOUSE;
m_reverseKeyTranslateTable[WHEELDOWNMOUSE ] = KX_WHEELDOWNMOUSE ; m_reverseKeyTranslateTable[WHEELDOWNMOUSE ] = KX_WHEELDOWNMOUSE;
m_reverseKeyTranslateTable[MOUSEX ] = KX_MOUSEX ; m_reverseKeyTranslateTable[MOUSEX ] = KX_MOUSEX;
m_reverseKeyTranslateTable[MOUSEY ] = KX_MOUSEY ; m_reverseKeyTranslateTable[MOUSEY ] = KX_MOUSEY;
// TIMERS // TIMERS
m_reverseKeyTranslateTable[TIMER0 ] = KX_TIMER0 ; m_reverseKeyTranslateTable[TIMER0 ] = KX_TIMER0;
m_reverseKeyTranslateTable[TIMER1 ] = KX_TIMER1 ; m_reverseKeyTranslateTable[TIMER1 ] = KX_TIMER1;
m_reverseKeyTranslateTable[TIMER2 ] = KX_TIMER2 ; m_reverseKeyTranslateTable[TIMER2 ] = KX_TIMER2;
// SYSTEM // SYSTEM
#if 0 #if 0
/* **** XXX **** */ /* **** XXX **** */
m_reverseKeyTranslateTable[KEYBD ] = KX_KEYBD ; m_reverseKeyTranslateTable[KEYBD ] = KX_KEYBD;
m_reverseKeyTranslateTable[RAWKEYBD ] = KX_RAWKEYBD ; m_reverseKeyTranslateTable[RAWKEYBD ] = KX_RAWKEYBD;
m_reverseKeyTranslateTable[REDRAW ] = KX_REDRAW ; m_reverseKeyTranslateTable[REDRAW ] = KX_REDRAW;
m_reverseKeyTranslateTable[INPUTCHANGE ] = KX_INPUTCHANGE ; m_reverseKeyTranslateTable[INPUTCHANGE ] = KX_INPUTCHANGE;
m_reverseKeyTranslateTable[QFULL ] = KX_QFULL ; m_reverseKeyTranslateTable[QFULL ] = KX_QFULL;
m_reverseKeyTranslateTable[WINFREEZE ] = KX_WINFREEZE ; m_reverseKeyTranslateTable[WINFREEZE ] = KX_WINFREEZE;
m_reverseKeyTranslateTable[WINTHAW ] = KX_WINTHAW ; m_reverseKeyTranslateTable[WINTHAW ] = KX_WINTHAW;
m_reverseKeyTranslateTable[WINCLOSE ] = KX_WINCLOSE ; m_reverseKeyTranslateTable[WINCLOSE ] = KX_WINCLOSE;
m_reverseKeyTranslateTable[WINQUIT ] = KX_WINQUIT ; m_reverseKeyTranslateTable[WINQUIT ] = KX_WINQUIT;
m_reverseKeyTranslateTable[Q_FIRSTTIME ] = KX_Q_FIRSTTIME ; m_reverseKeyTranslateTable[Q_FIRSTTIME ] = KX_Q_FIRSTTIME;
/* **** XXX **** */ /* **** XXX **** */
#endif #endif
// standard keyboard // standard keyboard
m_reverseKeyTranslateTable[AKEY ] = KX_AKEY ; m_reverseKeyTranslateTable[AKEY ] = KX_AKEY;
m_reverseKeyTranslateTable[BKEY ] = KX_BKEY ; m_reverseKeyTranslateTable[BKEY ] = KX_BKEY;
m_reverseKeyTranslateTable[CKEY ] = KX_CKEY ; m_reverseKeyTranslateTable[CKEY ] = KX_CKEY;
m_reverseKeyTranslateTable[DKEY ] = KX_DKEY ; m_reverseKeyTranslateTable[DKEY ] = KX_DKEY;
m_reverseKeyTranslateTable[EKEY ] = KX_EKEY ; m_reverseKeyTranslateTable[EKEY ] = KX_EKEY;
m_reverseKeyTranslateTable[FKEY ] = KX_FKEY ; m_reverseKeyTranslateTable[FKEY ] = KX_FKEY;
m_reverseKeyTranslateTable[GKEY ] = KX_GKEY ; m_reverseKeyTranslateTable[GKEY ] = KX_GKEY;
//XXX clean up //XXX clean up
#ifdef WIN32 #ifdef WIN32
#define HKEY 'h' #define HKEY 'h'
#endif #endif
m_reverseKeyTranslateTable[HKEY ] = KX_HKEY ; m_reverseKeyTranslateTable[HKEY ] = KX_HKEY;
//XXX clean up //XXX clean up
#ifdef WIN32 #ifdef WIN32
#undef HKEY #undef HKEY
#endif #endif
m_reverseKeyTranslateTable[IKEY ] = KX_IKEY ; m_reverseKeyTranslateTable[IKEY ] = KX_IKEY;
m_reverseKeyTranslateTable[JKEY ] = KX_JKEY ; m_reverseKeyTranslateTable[JKEY ] = KX_JKEY;
m_reverseKeyTranslateTable[KKEY ] = KX_KKEY ; m_reverseKeyTranslateTable[KKEY ] = KX_KKEY;
m_reverseKeyTranslateTable[LKEY ] = KX_LKEY ; m_reverseKeyTranslateTable[LKEY ] = KX_LKEY;
m_reverseKeyTranslateTable[MKEY ] = KX_MKEY ; m_reverseKeyTranslateTable[MKEY ] = KX_MKEY;
m_reverseKeyTranslateTable[NKEY ] = KX_NKEY ; m_reverseKeyTranslateTable[NKEY ] = KX_NKEY;
m_reverseKeyTranslateTable[OKEY ] = KX_OKEY ; m_reverseKeyTranslateTable[OKEY ] = KX_OKEY;
m_reverseKeyTranslateTable[PKEY ] = KX_PKEY ; m_reverseKeyTranslateTable[PKEY ] = KX_PKEY;
m_reverseKeyTranslateTable[QKEY ] = KX_QKEY ; m_reverseKeyTranslateTable[QKEY ] = KX_QKEY;
m_reverseKeyTranslateTable[RKEY ] = KX_RKEY ; m_reverseKeyTranslateTable[RKEY ] = KX_RKEY;
m_reverseKeyTranslateTable[SKEY ] = KX_SKEY ; m_reverseKeyTranslateTable[SKEY ] = KX_SKEY;
m_reverseKeyTranslateTable[TKEY ] = KX_TKEY ; m_reverseKeyTranslateTable[TKEY ] = KX_TKEY;
m_reverseKeyTranslateTable[UKEY ] = KX_UKEY ; m_reverseKeyTranslateTable[UKEY ] = KX_UKEY;
m_reverseKeyTranslateTable[VKEY ] = KX_VKEY ; m_reverseKeyTranslateTable[VKEY ] = KX_VKEY;
m_reverseKeyTranslateTable[WKEY ] = KX_WKEY ; m_reverseKeyTranslateTable[WKEY ] = KX_WKEY;
m_reverseKeyTranslateTable[XKEY ] = KX_XKEY ; m_reverseKeyTranslateTable[XKEY ] = KX_XKEY;
m_reverseKeyTranslateTable[YKEY ] = KX_YKEY ; m_reverseKeyTranslateTable[YKEY ] = KX_YKEY;
m_reverseKeyTranslateTable[ZKEY ] = KX_ZKEY ; m_reverseKeyTranslateTable[ZKEY ] = KX_ZKEY;
m_reverseKeyTranslateTable[ZEROKEY ] = KX_ZEROKEY ; m_reverseKeyTranslateTable[ZEROKEY ] = KX_ZEROKEY;
m_reverseKeyTranslateTable[ONEKEY ] = KX_ONEKEY ; m_reverseKeyTranslateTable[ONEKEY ] = KX_ONEKEY;
m_reverseKeyTranslateTable[TWOKEY ] = KX_TWOKEY ; m_reverseKeyTranslateTable[TWOKEY ] = KX_TWOKEY;
m_reverseKeyTranslateTable[THREEKEY ] = KX_THREEKEY ; m_reverseKeyTranslateTable[THREEKEY ] = KX_THREEKEY;
m_reverseKeyTranslateTable[FOURKEY ] = KX_FOURKEY ; m_reverseKeyTranslateTable[FOURKEY ] = KX_FOURKEY;
m_reverseKeyTranslateTable[FIVEKEY ] = KX_FIVEKEY ; m_reverseKeyTranslateTable[FIVEKEY ] = KX_FIVEKEY;
m_reverseKeyTranslateTable[SIXKEY ] = KX_SIXKEY ; m_reverseKeyTranslateTable[SIXKEY ] = KX_SIXKEY;
m_reverseKeyTranslateTable[SEVENKEY ] = KX_SEVENKEY ; m_reverseKeyTranslateTable[SEVENKEY ] = KX_SEVENKEY;
m_reverseKeyTranslateTable[EIGHTKEY ] = KX_EIGHTKEY ; m_reverseKeyTranslateTable[EIGHTKEY ] = KX_EIGHTKEY;
m_reverseKeyTranslateTable[NINEKEY ] = KX_NINEKEY ; m_reverseKeyTranslateTable[NINEKEY ] = KX_NINEKEY;
m_reverseKeyTranslateTable[CAPSLOCKKEY ] = KX_CAPSLOCKKEY ; m_reverseKeyTranslateTable[CAPSLOCKKEY ] = KX_CAPSLOCKKEY;
m_reverseKeyTranslateTable[LEFTCTRLKEY ] = KX_LEFTCTRLKEY ; m_reverseKeyTranslateTable[LEFTCTRLKEY ] = KX_LEFTCTRLKEY;
m_reverseKeyTranslateTable[LEFTALTKEY ] = KX_LEFTALTKEY ; m_reverseKeyTranslateTable[LEFTALTKEY ] = KX_LEFTALTKEY;
m_reverseKeyTranslateTable[RIGHTALTKEY ] = KX_RIGHTALTKEY ; m_reverseKeyTranslateTable[RIGHTALTKEY ] = KX_RIGHTALTKEY;
m_reverseKeyTranslateTable[RIGHTCTRLKEY ] = KX_RIGHTCTRLKEY ; m_reverseKeyTranslateTable[RIGHTCTRLKEY ] = KX_RIGHTCTRLKEY;
m_reverseKeyTranslateTable[RIGHTSHIFTKEY ] = KX_RIGHTSHIFTKEY ; m_reverseKeyTranslateTable[RIGHTSHIFTKEY ] = KX_RIGHTSHIFTKEY;
m_reverseKeyTranslateTable[LEFTSHIFTKEY ] = KX_LEFTSHIFTKEY ; m_reverseKeyTranslateTable[LEFTSHIFTKEY ] = KX_LEFTSHIFTKEY;
m_reverseKeyTranslateTable[ESCKEY ] = KX_ESCKEY ; m_reverseKeyTranslateTable[ESCKEY ] = KX_ESCKEY;
m_reverseKeyTranslateTable[TABKEY ] = KX_TABKEY ; m_reverseKeyTranslateTable[TABKEY ] = KX_TABKEY;
m_reverseKeyTranslateTable[RETKEY ] = KX_RETKEY ; m_reverseKeyTranslateTable[RETKEY ] = KX_RETKEY;
m_reverseKeyTranslateTable[SPACEKEY ] = KX_SPACEKEY ; m_reverseKeyTranslateTable[SPACEKEY ] = KX_SPACEKEY;
m_reverseKeyTranslateTable[LINEFEEDKEY ] = KX_LINEFEEDKEY ; m_reverseKeyTranslateTable[LINEFEEDKEY ] = KX_LINEFEEDKEY;
m_reverseKeyTranslateTable[BACKSPACEKEY ] = KX_BACKSPACEKEY ; m_reverseKeyTranslateTable[BACKSPACEKEY ] = KX_BACKSPACEKEY;
m_reverseKeyTranslateTable[DELKEY ] = KX_DELKEY ; m_reverseKeyTranslateTable[DELKEY ] = KX_DELKEY;
m_reverseKeyTranslateTable[SEMICOLONKEY ] = KX_SEMICOLONKEY ; m_reverseKeyTranslateTable[SEMICOLONKEY ] = KX_SEMICOLONKEY;
m_reverseKeyTranslateTable[PERIODKEY ] = KX_PERIODKEY ; m_reverseKeyTranslateTable[PERIODKEY ] = KX_PERIODKEY;
m_reverseKeyTranslateTable[COMMAKEY ] = KX_COMMAKEY ; m_reverseKeyTranslateTable[COMMAKEY ] = KX_COMMAKEY;
m_reverseKeyTranslateTable[QUOTEKEY ] = KX_QUOTEKEY ; m_reverseKeyTranslateTable[QUOTEKEY ] = KX_QUOTEKEY;
m_reverseKeyTranslateTable[ACCENTGRAVEKEY ] = KX_ACCENTGRAVEKEY ; m_reverseKeyTranslateTable[ACCENTGRAVEKEY ] = KX_ACCENTGRAVEKEY;
m_reverseKeyTranslateTable[MINUSKEY ] = KX_MINUSKEY ; m_reverseKeyTranslateTable[MINUSKEY ] = KX_MINUSKEY;
m_reverseKeyTranslateTable[SLASHKEY ] = KX_SLASHKEY ; m_reverseKeyTranslateTable[SLASHKEY ] = KX_SLASHKEY;
m_reverseKeyTranslateTable[BACKSLASHKEY ] = KX_BACKSLASHKEY ; m_reverseKeyTranslateTable[BACKSLASHKEY ] = KX_BACKSLASHKEY;
m_reverseKeyTranslateTable[EQUALKEY ] = KX_EQUALKEY ; m_reverseKeyTranslateTable[EQUALKEY ] = KX_EQUALKEY;
m_reverseKeyTranslateTable[LEFTBRACKETKEY ] = KX_LEFTBRACKETKEY ; m_reverseKeyTranslateTable[LEFTBRACKETKEY ] = KX_LEFTBRACKETKEY;
m_reverseKeyTranslateTable[RIGHTBRACKETKEY ] = KX_RIGHTBRACKETKEY ; m_reverseKeyTranslateTable[RIGHTBRACKETKEY ] = KX_RIGHTBRACKETKEY;
m_reverseKeyTranslateTable[LEFTARROWKEY ] = KX_LEFTARROWKEY ; m_reverseKeyTranslateTable[LEFTARROWKEY ] = KX_LEFTARROWKEY;
m_reverseKeyTranslateTable[DOWNARROWKEY ] = KX_DOWNARROWKEY ; m_reverseKeyTranslateTable[DOWNARROWKEY ] = KX_DOWNARROWKEY;
m_reverseKeyTranslateTable[RIGHTARROWKEY ] = KX_RIGHTARROWKEY ; m_reverseKeyTranslateTable[RIGHTARROWKEY ] = KX_RIGHTARROWKEY;
m_reverseKeyTranslateTable[UPARROWKEY ] = KX_UPARROWKEY ; m_reverseKeyTranslateTable[UPARROWKEY ] = KX_UPARROWKEY;
m_reverseKeyTranslateTable[PAD2 ] = KX_PAD2 ; m_reverseKeyTranslateTable[PAD2 ] = KX_PAD2;
m_reverseKeyTranslateTable[PAD4 ] = KX_PAD4 ; m_reverseKeyTranslateTable[PAD4 ] = KX_PAD4;
m_reverseKeyTranslateTable[PAD6 ] = KX_PAD6 ; m_reverseKeyTranslateTable[PAD6 ] = KX_PAD6;
m_reverseKeyTranslateTable[PAD8 ] = KX_PAD8 ; m_reverseKeyTranslateTable[PAD8 ] = KX_PAD8;
m_reverseKeyTranslateTable[PAD1 ] = KX_PAD1 ; m_reverseKeyTranslateTable[PAD1 ] = KX_PAD1;
m_reverseKeyTranslateTable[PAD3 ] = KX_PAD3 ; m_reverseKeyTranslateTable[PAD3 ] = KX_PAD3;
m_reverseKeyTranslateTable[PAD5 ] = KX_PAD5 ; m_reverseKeyTranslateTable[PAD5 ] = KX_PAD5;
m_reverseKeyTranslateTable[PAD7 ] = KX_PAD7 ; m_reverseKeyTranslateTable[PAD7 ] = KX_PAD7;
m_reverseKeyTranslateTable[PAD9 ] = KX_PAD9 ; m_reverseKeyTranslateTable[PAD9 ] = KX_PAD9;
m_reverseKeyTranslateTable[PADPERIOD ] = KX_PADPERIOD ; m_reverseKeyTranslateTable[PADPERIOD ] = KX_PADPERIOD;
m_reverseKeyTranslateTable[PADSLASHKEY ] = KX_PADSLASHKEY ; m_reverseKeyTranslateTable[PADSLASHKEY ] = KX_PADSLASHKEY;
m_reverseKeyTranslateTable[PADASTERKEY ] = KX_PADASTERKEY ; m_reverseKeyTranslateTable[PADASTERKEY ] = KX_PADASTERKEY;
m_reverseKeyTranslateTable[PAD0 ] = KX_PAD0 ; m_reverseKeyTranslateTable[PAD0 ] = KX_PAD0;
m_reverseKeyTranslateTable[PADMINUS ] = KX_PADMINUS ; m_reverseKeyTranslateTable[PADMINUS ] = KX_PADMINUS;
m_reverseKeyTranslateTable[PADENTER ] = KX_PADENTER ; m_reverseKeyTranslateTable[PADENTER ] = KX_PADENTER;
m_reverseKeyTranslateTable[PADPLUSKEY ] = KX_PADPLUSKEY ; m_reverseKeyTranslateTable[PADPLUSKEY ] = KX_PADPLUSKEY;
m_reverseKeyTranslateTable[F1KEY ] = KX_F1KEY ; m_reverseKeyTranslateTable[F1KEY ] = KX_F1KEY;
m_reverseKeyTranslateTable[F2KEY ] = KX_F2KEY ; m_reverseKeyTranslateTable[F2KEY ] = KX_F2KEY;
m_reverseKeyTranslateTable[F3KEY ] = KX_F3KEY ; m_reverseKeyTranslateTable[F3KEY ] = KX_F3KEY;
m_reverseKeyTranslateTable[F4KEY ] = KX_F4KEY ; m_reverseKeyTranslateTable[F4KEY ] = KX_F4KEY;
m_reverseKeyTranslateTable[F5KEY ] = KX_F5KEY ; m_reverseKeyTranslateTable[F5KEY ] = KX_F5KEY;
m_reverseKeyTranslateTable[F6KEY ] = KX_F6KEY ; m_reverseKeyTranslateTable[F6KEY ] = KX_F6KEY;
m_reverseKeyTranslateTable[F7KEY ] = KX_F7KEY ; m_reverseKeyTranslateTable[F7KEY ] = KX_F7KEY;
m_reverseKeyTranslateTable[F8KEY ] = KX_F8KEY ; m_reverseKeyTranslateTable[F8KEY ] = KX_F8KEY;
m_reverseKeyTranslateTable[F9KEY ] = KX_F9KEY ; m_reverseKeyTranslateTable[F9KEY ] = KX_F9KEY;
m_reverseKeyTranslateTable[F10KEY ] = KX_F10KEY ; m_reverseKeyTranslateTable[F10KEY ] = KX_F10KEY;
m_reverseKeyTranslateTable[F11KEY ] = KX_F11KEY ; m_reverseKeyTranslateTable[F11KEY ] = KX_F11KEY;
m_reverseKeyTranslateTable[F12KEY ] = KX_F12KEY ; m_reverseKeyTranslateTable[F12KEY ] = KX_F12KEY;
m_reverseKeyTranslateTable[F13KEY ] = KX_F13KEY ; m_reverseKeyTranslateTable[F13KEY ] = KX_F13KEY;
m_reverseKeyTranslateTable[F14KEY ] = KX_F14KEY ; m_reverseKeyTranslateTable[F14KEY ] = KX_F14KEY;
m_reverseKeyTranslateTable[F15KEY ] = KX_F15KEY ; m_reverseKeyTranslateTable[F15KEY ] = KX_F15KEY;
m_reverseKeyTranslateTable[F16KEY ] = KX_F16KEY ; m_reverseKeyTranslateTable[F16KEY ] = KX_F16KEY;
m_reverseKeyTranslateTable[F17KEY ] = KX_F17KEY ; m_reverseKeyTranslateTable[F17KEY ] = KX_F17KEY;
m_reverseKeyTranslateTable[F18KEY ] = KX_F18KEY ; m_reverseKeyTranslateTable[F18KEY ] = KX_F18KEY;
m_reverseKeyTranslateTable[F19KEY ] = KX_F19KEY ; m_reverseKeyTranslateTable[F19KEY ] = KX_F19KEY;
m_reverseKeyTranslateTable[PAUSEKEY ] = KX_PAUSEKEY ;
m_reverseKeyTranslateTable[INSERTKEY ] = KX_INSERTKEY ;
m_reverseKeyTranslateTable[HOMEKEY ] = KX_HOMEKEY ;
m_reverseKeyTranslateTable[PAGEUPKEY ] = KX_PAGEUPKEY ;
m_reverseKeyTranslateTable[PAGEDOWNKEY ] = KX_PAGEDOWNKEY ;
m_reverseKeyTranslateTable[ENDKEY ] = KX_ENDKEY ;
m_reverseKeyTranslateTable[PAUSEKEY ] = KX_PAUSEKEY;
m_reverseKeyTranslateTable[INSERTKEY ] = KX_INSERTKEY;
m_reverseKeyTranslateTable[HOMEKEY ] = KX_HOMEKEY;
m_reverseKeyTranslateTable[PAGEUPKEY ] = KX_PAGEUPKEY;
m_reverseKeyTranslateTable[PAGEDOWNKEY ] = KX_PAGEDOWNKEY;
m_reverseKeyTranslateTable[ENDKEY ] = KX_ENDKEY;
} }
virtual ~BL_BlenderInputDevice() virtual ~BL_BlenderInputDevice()
@ -233,7 +231,7 @@ public:
} }
virtual bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)=0; virtual bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)=0;
// virtual const SCA_InputEvent& GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)=0; // virtual const SCA_InputEvent& GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)=0;
virtual bool ConvertBlenderEvent(unsigned short incode,short val)=0; virtual bool ConvertBlenderEvent(unsigned short incode,short val)=0;

@ -129,6 +129,50 @@ void BL_ActionActuator::SetBlendTime (float newtime){
m_blendframe = newtime; m_blendframe = newtime;
} }
void BL_ActionActuator::SetLocalTime(float curtime)
{
float dt = (curtime-m_starttime)*KX_KetsjiEngine::GetAnimFrameRate();
if (m_endframe < m_startframe)
dt = -dt;
m_localtime = m_startframe + dt;
// Handle wrap around
if (m_localtime < min(m_startframe, m_endframe) || m_localtime > max(m_startframe, m_endframe))
{
switch(m_playtype)
{
case ACT_ACTION_PLAY:
// Clamp
m_localtime = m_endframe;
break;
case ACT_ACTION_LOOP_END:
// Put the time back to the beginning
m_localtime = m_startframe;
m_starttime = curtime;
break;
case ACT_ACTION_PINGPONG:
// Swap the start and end frames
float temp = m_startframe;
m_startframe = m_endframe;
m_endframe = temp;
m_starttime = curtime;
break;
}
}
}
void BL_ActionActuator::ResetStartTime(float curtime)
{
float dt = m_localtime - m_startframe;
m_starttime = curtime - dt / (KX_KetsjiEngine::GetAnimFrameRate());
//SetLocalTime(curtime);
}
CValue* BL_ActionActuator::GetReplica() { CValue* BL_ActionActuator::GetReplica() {
BL_ActionActuator* replica = new BL_ActionActuator(*this);//m_float,GetName()); BL_ActionActuator* replica = new BL_ActionActuator(*this);//m_float,GetName());
replica->ProcessReplica(); replica->ProcessReplica();
@ -173,6 +217,9 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
case ACT_ACTION_FROM_PROP: case ACT_ACTION_FROM_PROP:
CValue* prop = GetParent()->GetProperty(m_propname); CValue* prop = GetParent()->GetProperty(m_propname);
// If we don't have a property, we can't do anything, so just bail
if (!prop) return false;
playtype = BL_Action::ACT_MODE_PLAY; playtype = BL_Action::ACT_MODE_PLAY;
start = end = prop->GetNumber(); start = end = prop->GetNumber();
@ -194,11 +241,46 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
RemoveAllEvents(); RemoveAllEvents();
} }
if (bUseContinue && (m_flag & ACT_FLAG_ACTIVE)) if (m_flag & ACT_FLAG_ATTEMPT_PLAY)
m_localtime = obj->GetActionFrame(m_layer); SetLocalTime(curtime);
if (bPositiveEvent) if (bUseContinue && (m_flag & ACT_FLAG_ACTIVE))
{ {
m_localtime = obj->GetActionFrame(m_layer);
ResetStartTime(curtime);
}
// Handle a frame property if it's defined
if ((m_flag & ACT_FLAG_ACTIVE) && m_framepropname[0] != 0)
{
CValue* oldprop = obj->GetProperty(m_framepropname);
CValue* newval = new CFloatValue(obj->GetActionFrame(m_layer));
if (oldprop)
oldprop->SetValue(newval);
else
obj->SetProperty(m_framepropname, newval);
newval->Release();
}
// Handle a finished animation
if ((m_flag & ACT_FLAG_PLAY_END) && obj->IsActionDone(m_layer))
{
m_flag &= ~ACT_FLAG_ACTIVE;
m_flag &= ~ACT_FLAG_ATTEMPT_PLAY;
obj->StopAction(m_layer);
return false;
}
// If a different action is playing, we've been overruled and are no longer active
if (obj->GetCurrentAction(m_layer) != m_action)
m_flag &= ~ACT_FLAG_ACTIVE;
if (bPositiveEvent || (m_flag & ACT_FLAG_ATTEMPT_PLAY && !(m_flag & ACT_FLAG_ACTIVE)))
{
if (bPositiveEvent)
ResetStartTime(curtime);
if (obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, m_blendin, playtype, m_layer_weight, m_ipo_flags)) if (obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, m_blendin, playtype, m_layer_weight, m_ipo_flags))
{ {
m_flag |= ACT_FLAG_ACTIVE; m_flag |= ACT_FLAG_ACTIVE;
@ -210,11 +292,11 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
else else
m_flag &= ~ACT_FLAG_PLAY_END; m_flag &= ~ACT_FLAG_PLAY_END;
} }
else m_flag |= ACT_FLAG_ATTEMPT_PLAY;
return false;
} }
else if ((m_flag & ACT_FLAG_ACTIVE) && bNegativeEvent) else if ((m_flag & ACT_FLAG_ACTIVE) && bNegativeEvent)
{ {
m_flag &= ~ACT_FLAG_ATTEMPT_PLAY;
bAction *curr_action = obj->GetCurrentAction(m_layer); bAction *curr_action = obj->GetCurrentAction(m_layer);
if (curr_action && curr_action != m_action) if (curr_action && curr_action != m_action)
{ {
@ -259,27 +341,6 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
} }
} }
// Handle a frame property if it's defined
if ((m_flag & ACT_FLAG_ACTIVE) && m_framepropname[0] != 0)
{
CValue* oldprop = obj->GetProperty(m_framepropname);
CValue* newval = new CFloatValue(obj->GetActionFrame(m_layer));
if (oldprop)
oldprop->SetValue(newval);
else
obj->SetProperty(m_framepropname, newval);
newval->Release();
}
// Handle a finished animation
if ((m_flag & ACT_FLAG_PLAY_END) && obj->IsActionDone(m_layer))
{
m_flag &= ~ACT_FLAG_ACTIVE;
obj->StopAction(m_layer);
return false;
}
return true; return true;
} }

@ -64,6 +64,8 @@ public:
virtual void ProcessReplica(); virtual void ProcessReplica();
void SetBlendTime (float newtime); void SetBlendTime (float newtime);
void SetLocalTime (float curtime);
void ResetStartTime (float curtime);
bAction* GetAction() { return m_action; } bAction* GetAction() { return m_action; }
void SetAction(bAction* act) { m_action= act; } void SetAction(bAction* act) { m_action= act; }
@ -150,7 +152,7 @@ enum {
ACT_FLAG_ACTIVE = 1<<3, ACT_FLAG_ACTIVE = 1<<3,
ACT_FLAG_CONTINUE = 1<<4, ACT_FLAG_CONTINUE = 1<<4,
ACT_FLAG_PLAY_END = 1<<5, ACT_FLAG_PLAY_END = 1<<5,
ACT_FLAG_ATTEMPT_PLAY = 1<<6,
}; };
#endif #endif

@ -1483,7 +1483,7 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj,
{ {
objprop.m_gamesoftFlag = OB_BSB_BENDING_CONSTRAINTS | OB_BSB_SHAPE_MATCHING | OB_BSB_AERO_VPOINT; objprop.m_gamesoftFlag = OB_BSB_BENDING_CONSTRAINTS | OB_BSB_SHAPE_MATCHING | OB_BSB_AERO_VPOINT;
objprop.m_soft_linStiff = 0.5;; objprop.m_soft_linStiff = 0.5;
objprop.m_soft_angStiff = 1.f; /* angular stiffness 0..1 */ objprop.m_soft_angStiff = 1.f; /* angular stiffness 0..1 */
objprop.m_soft_volume= 1.f; /* volume preservation 0..1 */ objprop.m_soft_volume= 1.f; /* volume preservation 0..1 */

@ -257,7 +257,7 @@ SG_Controller *BL_CreateCameraIPO(struct bAction *action, KX_GameObject* camera
ipocontr->m_clipstart = blendercamera->clipsta; ipocontr->m_clipstart = blendercamera->clipsta;
ipocontr->m_clipend = blendercamera->clipend; ipocontr->m_clipend = blendercamera->clipend;
BL_InterpolatorList *adtList= GetAdtList(blendercamera->adt->action, converter); BL_InterpolatorList *adtList= GetAdtList(action, converter);
// For each active channel in the adtList add an // For each active channel in the adtList add an
// interpolator to the game object. // interpolator to the game object.

@ -105,7 +105,7 @@ public:
}; };
SCA_ISensor(SCA_IObject* gameobj, SCA_ISensor(SCA_IObject* gameobj,
class SCA_EventManager* eventmgr);; class SCA_EventManager* eventmgr);
~SCA_ISensor(); ~SCA_ISensor();
virtual void ReParent(SCA_IObject* parent); virtual void ReParent(SCA_IObject* parent);

@ -96,8 +96,8 @@ unsigned long SCA_RandomNumberGenerator::Draw() {
int kk; int kk;
/* I set this in the constructor, so it is always satisfied ! */ /* I set this in the constructor, so it is always satisfied ! */
// if (mti == N+1) /* if sgenrand() has not been called, */ // if (mti == N+1) /* if sgenrand() has not been called, */
// GEN_srand(4357); /* a default initial seed is used */ // GEN_srand(4357); /* a default initial seed is used */
for (kk = 0; kk < N - M; kk++) { for (kk = 0; kk < N - M; kk++) {
y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK); y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);

@ -91,8 +91,7 @@ bool KX_NetworkMessageActuator::Update()
CValue* KX_NetworkMessageActuator::GetReplica() CValue* KX_NetworkMessageActuator::GetReplica()
{ {
KX_NetworkMessageActuator* replica = KX_NetworkMessageActuator* replica = new KX_NetworkMessageActuator(*this);
new KX_NetworkMessageActuator(*this);
replica->ProcessReplica(); replica->ProcessReplica();
return replica; return replica;

@ -54,7 +54,7 @@ KX_NetworkMessageSensor::KX_NetworkMessageSensor(
class NG_NetworkScene *NetworkScene, // our scene class NG_NetworkScene *NetworkScene, // our scene
SCA_IObject* gameobj, // the sensor controlling object SCA_IObject* gameobj, // the sensor controlling object
const STR_String &subject const STR_String &subject
) : ) :
SCA_ISensor(gameobj,eventmgr), SCA_ISensor(gameobj,eventmgr),
m_NetworkScene(NetworkScene), m_NetworkScene(NetworkScene),
m_subject(subject), m_subject(subject),

@ -97,10 +97,7 @@ void KX_BlenderMaterial::Initialize(
// as being equal, this is rather important to // as being equal, this is rather important to
// prevent material bleeding // prevent material bleeding
for(int i=0; i<mMaterial->num_enabled; i++) { for(int i=0; i<mMaterial->num_enabled; i++) {
m_multimode += m_multimode += (mMaterial->flag[i] + mMaterial->blend_mode[i]);
( mMaterial->flag[i] +
mMaterial->blend_mode[i]
);
} }
m_multimode += mMaterial->IdMode+ (mMaterial->ras_mode & ~(COLLIDER|USE_LIGHT)); m_multimode += mMaterial->IdMode+ (mMaterial->ras_mode & ~(COLLIDER|USE_LIGHT));
} }

@ -57,7 +57,7 @@ KX_Dome::KX_Dome (
short tilt, short tilt,
struct Text* warptext struct Text* warptext
): ):
dlistSupported(false), dlistSupported(false),
canvaswidth(-1), canvasheight(-1), canvaswidth(-1), canvasheight(-1),
m_drawingmode(engine->GetDrawType()), m_drawingmode(engine->GetDrawType()),

@ -87,7 +87,7 @@ typedef unsigned long uint_ptr;
static MT_Point3 dummy_point= MT_Point3(0.0, 0.0, 0.0); static MT_Point3 dummy_point= MT_Point3(0.0, 0.0, 0.0);
static MT_Vector3 dummy_scaling = MT_Vector3(1.0, 1.0, 1.0); static MT_Vector3 dummy_scaling = MT_Vector3(1.0, 1.0, 1.0);
static MT_Matrix3x3 dummy_orientation = MT_Matrix3x3( 1.0, 0.0, 0.0, static MT_Matrix3x3 dummy_orientation = MT_Matrix3x3(1.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 1.0); 0.0, 0.0, 1.0);
@ -159,6 +159,7 @@ KX_GameObject::~KX_GameObject()
} }
if (m_actionManager) if (m_actionManager)
{ {
KX_GetActiveScene()->RemoveAnimatedObject(this);
delete m_actionManager; delete m_actionManager;
} }
#ifdef WITH_PYTHON #ifdef WITH_PYTHON
@ -355,8 +356,8 @@ BL_ActionManager* KX_GameObject::GetActionManager()
{ {
// We only want to create an action manager if we need it // We only want to create an action manager if we need it
if (!m_actionManager) if (!m_actionManager)
m_actionManager = new BL_ActionManager(this); { KX_GetActiveScene()->AddAnimatedObject(this); m_actionManager = new BL_ActionManager(this);
}
return m_actionManager; return m_actionManager;
} }
@ -3124,7 +3125,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, getActionFrame,
layer_check(layer, "getActionFrame"); layer_check(layer, "getActionFrame");
return PyLong_FromLong(GetActionFrame(layer)); return PyFloat_FromDouble(GetActionFrame(layer));
} }
KX_PYMETHODDEF_DOC(KX_GameObject, setActionFrame, KX_PYMETHODDEF_DOC(KX_GameObject, setActionFrame,

@ -886,8 +886,6 @@ void KX_KetsjiEngine::Render()
{ {
if((*it)->GetViewport()) if((*it)->GetViewport())
{ {
// Change the active camera so Python scripts can figure out what viewport they're in
scene->SetActiveCamera(*it);
if (scene->IsClearingZBuffer()) if (scene->IsClearingZBuffer())
m_rasterizer->ClearDepthBuffer(); m_rasterizer->ClearDepthBuffer();
@ -899,10 +897,6 @@ void KX_KetsjiEngine::Render()
it++; it++;
} }
// Now change the camera back
scene->SetActiveCamera(cam);
PostRenderScene(scene); PostRenderScene(scene);
} }
@ -1322,10 +1316,6 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam)
if (scene->GetPhysicsEnvironment()) if (scene->GetPhysicsEnvironment())
scene->GetPhysicsEnvironment()->debugDrawWorld(); scene->GetPhysicsEnvironment()->debugDrawWorld();
#ifdef WITH_PYTHON
scene->RunDrawingCallbacks(scene->GetPostDrawCB());
#endif
} }
void KX_KetsjiEngine::RenderFonts(KX_Scene* scene) void KX_KetsjiEngine::RenderFonts(KX_Scene* scene)
@ -1345,8 +1335,14 @@ To run once per scene
*/ */
void KX_KetsjiEngine::PostRenderScene(KX_Scene* scene) void KX_KetsjiEngine::PostRenderScene(KX_Scene* scene)
{ {
// We need to first make sure our viewport is correct (enabling multiple viewports can mess this up)
m_canvas->SetViewPort(0, 0, m_canvas->GetWidth(), m_canvas->GetHeight());
m_rendertools->MotionBlur(m_rasterizer); m_rendertools->MotionBlur(m_rasterizer);
scene->Render2DFilters(m_canvas); scene->Render2DFilters(m_canvas);
#ifdef WITH_PYTHON
scene->RunDrawingCallbacks(scene->GetPostDrawCB());
#endif
m_rasterizer->FlushDebugLines(); m_rasterizer->FlushDebugLines();
} }

@ -1208,6 +1208,28 @@ static PyObject* gPyGetMaterialType(PyObject*)
return PyLong_FromSsize_t(flag); return PyLong_FromSsize_t(flag);
} }
static PyObject* gPySetAnisotropicFiltering(PyObject*, PyObject* args)
{
short level;
if (!PyArg_ParseTuple(args, "h:setAnisotropicFiltering", &level))
return NULL;
if (level != 1 && level != 2 && level != 4 && level != 8 && level != 16) {
PyErr_SetString(PyExc_ValueError, "Rasterizer.setAnisotropicFiltering(level): Expected value of 1, 2, 4, 8, or 16 for value");
return NULL;
}
gp_Rasterizer->SetAnisotropicFiltering(level);
Py_RETURN_NONE;
}
static PyObject* gPyGetAnisotropicFiltering(PyObject*, PyObject* args)
{
return PyLong_FromLong(gp_Rasterizer->GetAnisotropicFiltering());
}
static PyObject* gPyDrawLine(PyObject*, PyObject* args) static PyObject* gPyDrawLine(PyObject*, PyObject* args)
{ {
PyObject* ob_from; PyObject* ob_from;
@ -1272,6 +1294,10 @@ static struct PyMethodDef rasterizer_methods[] = {
METH_VARARGS, "set the state of a GLSL material setting"}, METH_VARARGS, "set the state of a GLSL material setting"},
{"getGLSLMaterialSetting",(PyCFunction) gPyGetGLSLMaterialSetting, {"getGLSLMaterialSetting",(PyCFunction) gPyGetGLSLMaterialSetting,
METH_VARARGS, "get the state of a GLSL material setting"}, METH_VARARGS, "get the state of a GLSL material setting"},
{"setAnisotropicFiltering", (PyCFunction) gPySetAnisotropicFiltering,
METH_VARARGS, "set the anisotropic filtering level (must be one of 1, 2, 4, 8, 16)"},
{"getAnisotropicFiltering", (PyCFunction) gPyGetAnisotropicFiltering,
METH_VARARGS, "get the anisotropic filtering level"},
{"drawLine", (PyCFunction) gPyDrawLine, {"drawLine", (PyCFunction) gPyDrawLine,
METH_VARARGS, "draw a line on the screen"}, METH_VARARGS, "draw a line on the screen"},
{ NULL, (PyCFunction) NULL, 0, NULL } { NULL, (PyCFunction) NULL, 0, NULL }

@ -168,6 +168,7 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice,
m_lightlist= new CListValue(); m_lightlist= new CListValue();
m_inactivelist = new CListValue(); m_inactivelist = new CListValue();
m_euthanasyobjects = new CListValue(); m_euthanasyobjects = new CListValue();
m_animatedlist = new CListValue();
m_logicmgr = new SCA_LogicManager(); m_logicmgr = new SCA_LogicManager();
@ -253,6 +254,9 @@ KX_Scene::~KX_Scene()
if (m_euthanasyobjects) if (m_euthanasyobjects)
m_euthanasyobjects->Release(); m_euthanasyobjects->Release();
if (m_animatedlist)
m_animatedlist->Release();
if (m_logicmgr) if (m_logicmgr)
delete m_logicmgr; delete m_logicmgr;
@ -1502,10 +1506,20 @@ void KX_Scene::LogicBeginFrame(double curtime)
m_logicmgr->BeginFrame(curtime, 1.0/KX_KetsjiEngine::GetTicRate()); m_logicmgr->BeginFrame(curtime, 1.0/KX_KetsjiEngine::GetTicRate());
} }
void KX_Scene::AddAnimatedObject(CValue* gameobj)
{
m_animatedlist->Add(gameobj);
}
void KX_Scene::RemoveAnimatedObject(CValue* gameobj)
{
m_animatedlist->RemoveValue(gameobj);
}
void KX_Scene::UpdateAnimations(double curtime) void KX_Scene::UpdateAnimations(double curtime)
{ {
// Update any animations // Update any animations
for (int i=0; i<GetObjectList()->GetCount(); ++i) for (int i=0; i<m_animatedlist->GetCount(); ++i)
((KX_GameObject*)GetObjectList()->GetValue(i))->UpdateActionManager(curtime); ((KX_GameObject*)GetObjectList()->GetValue(i))->UpdateActionManager(curtime);
} }

@ -130,6 +130,7 @@ protected:
CListValue* m_parentlist; // all 'root' parents CListValue* m_parentlist; // all 'root' parents
CListValue* m_lightlist; CListValue* m_lightlist;
CListValue* m_inactivelist; // all objects that are not in the active layer CListValue* m_inactivelist; // all objects that are not in the active layer
CListValue* m_animatedlist; // all animated objects
SG_QList m_sghead; // list of nodes that needs scenegraph update SG_QList m_sghead; // list of nodes that needs scenegraph update
// the Dlist is not object that must be updated // the Dlist is not object that must be updated
@ -334,6 +335,10 @@ public:
int NewRemoveObject(CValue* gameobj); int NewRemoveObject(CValue* gameobj);
void ReplaceMesh(CValue* gameobj, void ReplaceMesh(CValue* gameobj,
void* meshob, bool use_gfx, bool use_phys); void* meshob, bool use_gfx, bool use_phys);
void AddAnimatedObject(CValue* gameobj);
void RemoveAnimatedObject(CValue* gameobj);
/** /**
* @section Logic stuff * @section Logic stuff
* Initiate an update of the logic system. * Initiate an update of the logic system.

@ -433,6 +433,9 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
glCopyTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE16, 0, 0, texturewidth,textureheight, 0); glCopyTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE16, 0, 0, texturewidth,textureheight, 0);
} }
// reverting to texunit 0, without this we get bug [#28462]
glActiveTextureARB(GL_TEXTURE0);
glViewport(0,0, texturewidth, textureheight); glViewport(0,0, texturewidth, textureheight);
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);

@ -418,6 +418,9 @@ public:
virtual void SetBlendingMode(int blendmode)=0; virtual void SetBlendingMode(int blendmode)=0;
virtual void SetFrontFace(bool ccw)=0; virtual void SetFrontFace(bool ccw)=0;
virtual void SetAnisotropicFiltering(short level)=0;
virtual short GetAnisotropicFiltering()=0;
#ifdef WITH_CXX_GUARDEDALLOC #ifdef WITH_CXX_GUARDEDALLOC
public: public:

@ -33,8 +33,8 @@
#define __RAS_EROSION2DFILTER #define __RAS_EROSION2DFILTER
const char * ErosionFragmentShader=STRINGIFY( const char * ErosionFragmentShader=STRINGIFY(
uniform sampler2D bgl_RenderedTexture; uniform sampler2D bgl_RenderedTexture;
uniform vec2 bgl_TextureCoordinateOffset[9]; uniform vec2 bgl_TextureCoordinateOffset[9];
void main(void) void main(void)
{ {

@ -99,12 +99,16 @@ RAS_OpenGLRasterizer::RAS_OpenGLRasterizer(RAS_ICanvas* canvas)
hinterlace_mask[i] = (i&1)*0xFFFFFFFF; hinterlace_mask[i] = (i&1)*0xFFFFFFFF;
} }
hinterlace_mask[32] = 0; hinterlace_mask[32] = 0;
m_prevafvalue = GPU_get_anisotropic();
} }
RAS_OpenGLRasterizer::~RAS_OpenGLRasterizer() RAS_OpenGLRasterizer::~RAS_OpenGLRasterizer()
{ {
// Restore the previous AF value
GPU_set_anisotropic(m_prevafvalue);
} }
bool RAS_OpenGLRasterizer::Init() bool RAS_OpenGLRasterizer::Init()
@ -1204,3 +1208,12 @@ void RAS_OpenGLRasterizer::SetFrontFace(bool ccw)
m_last_frontface = ccw; m_last_frontface = ccw;
} }
void RAS_OpenGLRasterizer::SetAnisotropicFiltering(short level)
{
GPU_set_anisotropic((float)level);
}
short RAS_OpenGLRasterizer::GetAnisotropicFiltering()
{
return (short)GPU_get_anisotropic();
}

@ -94,6 +94,8 @@ class RAS_OpenGLRasterizer : public RAS_IRasterizer
bool m_setfocallength; bool m_setfocallength;
int m_noOfScanlines; int m_noOfScanlines;
short m_prevafvalue;
//motion blur //motion blur
int m_motionblur; int m_motionblur;
float m_motionblurvalue; float m_motionblurvalue;
@ -294,6 +296,9 @@ public:
virtual void SetBlendingMode(int blendmode); virtual void SetBlendingMode(int blendmode);
virtual void SetFrontFace(bool ccw); virtual void SetFrontFace(bool ccw);
virtual void SetAnisotropicFiltering(short level);
virtual short GetAnisotropicFiltering();
#ifdef WITH_CXX_GUARDEDALLOC #ifdef WITH_CXX_GUARDEDALLOC
public: public:

@ -115,8 +115,7 @@ UpdateSpatialData(
const SG_Spatial *parent, const SG_Spatial *parent,
double time, double time,
bool& parentUpdated bool& parentUpdated
){ ){
bool bComputesWorldTransform = false; bool bComputesWorldTransform = false;
// update spatial controllers // update spatial controllers

@ -141,7 +141,7 @@ protected:
/// calculate one color component /// calculate one color component
unsigned int calcColor (unsigned int val, short idx) unsigned int calcColor (unsigned int val, short idx)
{ {
unsigned int col = VT_C(val,idx);; unsigned int col = VT_C(val,idx);
if (col <= levels[idx][0]) col = 0; if (col <= levels[idx][0]) col = 0;
else if (col >= levels[idx][1]) col = 0xFF; else if (col >= levels[idx][1]) col = 0xFF;
else col = (((col - levels[idx][0]) << 8) / levels[idx][2]) & 0xFF; else col = (((col - levels[idx][0]) << 8) / levels[idx][2]) & 0xFF;

@ -135,7 +135,7 @@ PyObject * setWeight (PyImage * self, PyObject * args)
if (!getImageMix(self)->setWeight(id, weight)) if (!getImageMix(self)->setWeight(id, weight))
{ {
// if not set, report error // if not set, report error
PyErr_SetString(PyExc_RuntimeError, "Invalid id of source");; PyErr_SetString(PyExc_RuntimeError, "Invalid id of source");
return NULL; return NULL;
} }
// return none // return none

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