copied across changes which were missed by merging.
This commit is contained in:
parent
6ef77cf95a
commit
14a2330d7b
|
@ -20,6 +20,7 @@
|
|||
|
||||
# <pep8 compliant>
|
||||
|
||||
|
||||
def print_help(targets):
|
||||
print("CMake quicky wrapper, no valid targets given.")
|
||||
print(" * targets can contain a subset of the full target name.")
|
||||
|
@ -36,11 +37,11 @@ def print_help(targets):
|
|||
for t in targets:
|
||||
print(" %s" % t)
|
||||
print("...exiting")
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
targets = set()
|
||||
|
||||
|
||||
# collect targets
|
||||
makefile = open("Makefile", "r")
|
||||
for line in makefile:
|
||||
|
@ -54,13 +55,12 @@ def main():
|
|||
|
||||
line = line.split(":", 1)[0]
|
||||
|
||||
if "/" in line: # cmake terget options, dont need these
|
||||
if "/" in line: # cmake terget options, dont need these
|
||||
continue
|
||||
|
||||
targets.add(line)
|
||||
makefile.close()
|
||||
|
||||
|
||||
# remove cmake targets
|
||||
bad = set([
|
||||
"help",
|
||||
|
@ -75,9 +75,8 @@ def main():
|
|||
"depend",
|
||||
"cmake_check_build_system",
|
||||
])
|
||||
|
||||
targets -= set(bad)
|
||||
|
||||
targets -= set(bad)
|
||||
|
||||
# parse args
|
||||
targets = list(targets)
|
||||
|
@ -106,7 +105,7 @@ def main():
|
|||
print(" %s" % t)
|
||||
print("...aborting.")
|
||||
return
|
||||
|
||||
|
||||
# execute
|
||||
cmd = "make %s %s blender/fast" % (" ".join(args), " ".join(targets_new))
|
||||
print("cmake building with targets: %s" % " ".join(targets_new))
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
Blender License (the "BL", see http://www.blender.org/BL/ ).
|
||||
|
||||
Copyright (C) 2002-2005 Blender Foundation. All Rights Reserved.
|
||||
|
||||
This text supersedes the previous BL description, called Blender License 1.0.
|
||||
|
||||
When the Blender source code was released in 2002, the Blender Foundation reserved
|
||||
the right to offer licenses outside of the GNU GPL. This so-called "dual license"
|
||||
model was chosen to provide potential revenues for the Blender Foundation.
|
||||
|
||||
The BL has not been activated yet. Partially because;
|
||||
|
||||
- there has to be a clear benefit for Blender itself and its community of
|
||||
developers and users.
|
||||
- the developers who have copyrighted additions to the source code need to approve
|
||||
the decision.
|
||||
- the (c) holder NaN Holding has to approve on a standard License Contract
|
||||
|
||||
But most important;
|
||||
|
||||
- the Blender Foundation is financially healthy, based on community support
|
||||
(e-shop sales), sponsoring and subsidy grants
|
||||
- current focus for the Blender Foundation is to not set up any commercial
|
||||
activity related to Blender development.
|
||||
- the GNU GPL provides sufficient freedom for third parties to conduct business
|
||||
with Blender
|
||||
|
||||
For these reasons we've decided to cancel the BL offering for an indefinite period.
|
||||
|
||||
Third parties interested to discuss usage or exploitation of Blender can email
|
||||
license@blender.org for further information.
|
||||
|
||||
Ton Roosendaal
|
||||
Chairman Blender Foundation.
|
||||
June 2005
|
1393
doc/bf-members.txt
1393
doc/bf-members.txt
File diff suppressed because it is too large
Load Diff
338
doc/blender.1
338
doc/blender.1
|
@ -1,338 +0,0 @@
|
|||
.TH "BLENDER" "1" "June 27, 2010" "Blender Blender 2\&.52 (sub 5) "
|
||||
|
||||
.SH NAME
|
||||
blender \- a 3D modelling and rendering package
|
||||
.SH SYNOPSIS
|
||||
.B blender [args ...] [file] [args ...]
|
||||
.br
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
.B blender
|
||||
is a 3D modelling and rendering package. It is the in-house software of a high quality animation studio, Blender has proven to be an extremely fast and versatile design instrument. The software has a personal touch, offering a unique approach to the world of Three Dimensions.
|
||||
|
||||
Use Blender to create TV commercials, to make technical visualizations, business graphics, to do some morphing, or design user interfaces. You can easy build and manage complex environments. The renderer is versatile and extremely fast. All basic animation principles (curves & keys) are well implemented.
|
||||
|
||||
http://www.blender.org
|
||||
.SH OPTIONS
|
||||
|
||||
Blender 2.52 (sub 5) Build
|
||||
Usage: blender [args ...] [file] [args ...]
|
||||
.br
|
||||
.SS "Render Options:"
|
||||
|
||||
.TP
|
||||
.B \-b or \-\-background <file>
|
||||
.br
|
||||
Load <file> in background (often used for UI\-less rendering)
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B \-a or \-\-render\-anim
|
||||
.br
|
||||
Render frames from start to end (inclusive)
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B \-S or \-\-scene <name>
|
||||
.br
|
||||
Set the active scene <name> for rendering
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B \-f or \-\-render\-frame <frame>
|
||||
.br
|
||||
Render frame <frame> and save it.
|
||||
.br
|
||||
+<frame> start frame relative, \-<frame> end frame relative.
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B \-s or \-\-frame\-start <frame>
|
||||
.br
|
||||
Set start to frame <frame> (use before the \-a argument)
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B \-e or \-\-frame\-end <frame>
|
||||
.br
|
||||
Set end to frame <frame> (use before the \-a argument)
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B \-j or \-\-frame\-jump <frames>
|
||||
.br
|
||||
Set number of frames to step forward after each rendered frame
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B \-o or \-\-render\-output <path>
|
||||
.br
|
||||
Set the render path and file name.
|
||||
.br
|
||||
Use // at the start of the path to
|
||||
.br
|
||||
render relative to the blend file.
|
||||
.br
|
||||
The # characters are replaced by the frame number, and used to define zero padding.
|
||||
.br
|
||||
ani_##_test.png becomes ani_01_test.png
|
||||
.br
|
||||
test\-######.png becomes test\-000001.png
|
||||
.br
|
||||
When the filename does not contain #, The suffix #### is added to the filename
|
||||
.br
|
||||
The frame number will be added at the end of the filename.
|
||||
.br
|
||||
eg: blender \-b foobar.blend \-o //render_ \-F PNG \-x 1 \-a
|
||||
.br
|
||||
//render_ becomes //render_####, writing frames as //render_0001.png//
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B \-E or \-\-engine <engine>
|
||||
.br
|
||||
Specify the render engine
|
||||
.br
|
||||
use \-E help to list available engines
|
||||
.br
|
||||
|
||||
.IP
|
||||
|
||||
.SS "Format Options:"
|
||||
|
||||
.TP
|
||||
.B \-F or \-\-render\-format <format>
|
||||
.br
|
||||
Set the render format, Valid options are...
|
||||
.br
|
||||
TGA IRIS JPEG MOVIE IRIZ RAWTGA
|
||||
.br
|
||||
AVIRAW AVIJPEG PNG BMP FRAMESERVER
|
||||
.br
|
||||
(formats that can be compiled into blender, not available on all systems)
|
||||
.br
|
||||
HDR TIFF EXR MULTILAYER MPEG AVICODEC QUICKTIME CINEON DPX DDS
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B \-x or \-\-use\-extension <bool>
|
||||
.br
|
||||
Set option to add the file extension to the end of the file
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B \-t or \-\-threads <threads>
|
||||
.br
|
||||
Use amount of <threads> for rendering in background
|
||||
.br
|
||||
[1\-BLENDER_MAX_THREADS], 0 for systems processor count.
|
||||
.br
|
||||
|
||||
.IP
|
||||
|
||||
.SS "Animation Playback Options:"
|
||||
|
||||
.TP
|
||||
.B \-a <options> <file(s)>
|
||||
.br
|
||||
Playback <file(s)>, only operates this way when not running in background.
|
||||
.br
|
||||
\-p <sx> <sy> Open with lower left corner at <sx>, <sy>
|
||||
.br
|
||||
\-m Read from disk (Don't buffer)
|
||||
.br
|
||||
\-f <fps> <fps\-base> Specify FPS to start with
|
||||
.br
|
||||
\-j <frame> Set frame step to <frame>
|
||||
.br
|
||||
|
||||
.IP
|
||||
|
||||
.SS "Window Options:"
|
||||
|
||||
.TP
|
||||
.B \-w or \-\-window\-border
|
||||
.br
|
||||
Force opening with borders (default)
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B \-W or \-\-window\-borderless
|
||||
.br
|
||||
Force opening with without borders
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B \-p or \-\-window\-geometry <sx> <sy> <w> <h>
|
||||
.br
|
||||
Open with lower left corner at <sx>, <sy> and width and height as <w>, <h>
|
||||
.br
|
||||
|
||||
.IP
|
||||
|
||||
.SS "Game Engine Specific Options:"
|
||||
|
||||
.TP
|
||||
.B \-g Game Engine specific options
|
||||
.br
|
||||
\-g fixedtime Run on 50 hertz without dropping frames
|
||||
.br
|
||||
\-g vertexarrays Use Vertex Arrays for rendering (usually faster)
|
||||
.br
|
||||
\-g nomipmap No Texture Mipmapping
|
||||
.br
|
||||
\-g linearmipmap Linear Texture Mipmapping instead of Nearest (default)
|
||||
.br
|
||||
|
||||
.IP
|
||||
|
||||
.SS "Misc Options:"
|
||||
|
||||
.TP
|
||||
.B \-d or \-\-debug
|
||||
.br
|
||||
Turn debugging on
|
||||
.br
|
||||
|
||||
.IP
|
||||
* Prints every operator call and their arguments
|
||||
.br
|
||||
* Disables mouse grab (to interact with a debugger in some cases)
|
||||
.br
|
||||
* Keeps python sys.stdin rather then setting it to None
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B \-\-debug\-fpe
|
||||
.br
|
||||
Enable floating point exceptions
|
||||
.br
|
||||
|
||||
.IP
|
||||
|
||||
.TP
|
||||
.B \-nojoystick
|
||||
.br
|
||||
Disable joystick support
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B \-noglsl
|
||||
.br
|
||||
Disable GLSL shading
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B \-noaudio
|
||||
.br
|
||||
Force sound system to None
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B \-setaudio
|
||||
.br
|
||||
Force sound system to a specific device
|
||||
.br
|
||||
NULL SDL OPENAL JACK
|
||||
.br
|
||||
|
||||
.IP
|
||||
|
||||
.TP
|
||||
.B \-h or \-\-help
|
||||
.br
|
||||
Print this help text and exit
|
||||
.br
|
||||
|
||||
.IP
|
||||
|
||||
.TP
|
||||
.B \-y or \-\-enable\-autoexec
|
||||
.br
|
||||
Enable automatic python script execution (default)
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B \-Y or \-\-disable\-autoexec
|
||||
.br
|
||||
Disable automatic python script execution (pydrivers, pyconstraints, pynodes)
|
||||
.br
|
||||
|
||||
.IP
|
||||
|
||||
.TP
|
||||
.B \-P or \-\-python <filename>
|
||||
.br
|
||||
Run the given Python script (filename or Blender Text)
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B \-\-python\-console
|
||||
.br
|
||||
Run blender with an interactive console
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B \-v or \-\-version
|
||||
.br
|
||||
Print Blender version and exit
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B \-\-
|
||||
.br
|
||||
Ends option processing, following arguments passed unchanged. Access via python's sys.argv
|
||||
.br
|
||||
|
||||
.SS "Other Options:"
|
||||
|
||||
.TP
|
||||
.B /?
|
||||
.br
|
||||
Print this help text and exit (windows only)
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B \-R
|
||||
.br
|
||||
Register .blend extension (windows only)
|
||||
.br
|
||||
|
||||
.SS "Argument Parsing:"
|
||||
|
||||
arguments must be separated by white space. eg
|
||||
"blender \-ba test.blend"
|
||||
...will ignore the 'a'
|
||||
"blender \-b test.blend \-f8"
|
||||
...will ignore 8 because there is no space between the \-f and the frame value
|
||||
.br
|
||||
.SS "Argument Order:"
|
||||
|
||||
Arguments are executed in the order they are given. eg
|
||||
"blender \-\-background test.blend \-\-render\-frame 1 \-\-render\-output /tmp"
|
||||
...will not render to /tmp because '\-\-render\-frame 1' renders before the output path is set
|
||||
"blender \-\-background \-\-render\-output /tmp test.blend \-\-render\-frame 1"
|
||||
...will not render to /tmp because loading the blend file overwrites the render output that was set
|
||||
"blender \-\-background test.blend \-\-render\-output /tmp \-\-render\-frame 1" works as expected.
|
||||
.br
|
||||
.br
|
||||
.SH "ENVIRONMENT VARIABLES"
|
||||
\fIHOME\fR Store files such as .blender/ .B.blend .Bfs .Blog here.
|
||||
\fIBLENDERPATH\fR System directory to use for data files and scripts.
|
||||
For this build of blender the default \fIBLENDERPATH\fR is...
|
||||
"/usr/local/share/blender/2.5"
|
||||
setting the \fIBLENDERPATH\fR will override this
|
||||
\fITMP\fR or \fITMPDIR\fR Store temporary files here.
|
||||
\fIPYTHONHOME\fR Path to the python directory, eg. /usr/lib/python.
|
||||
.br
|
||||
.br
|
||||
|
||||
.br
|
||||
.SH SEE ALSO
|
||||
.B yafaray(1)
|
||||
|
||||
.br
|
||||
.SH AUTHORS
|
||||
This manpage was written for a Debian GNU/Linux system by Daniel Mester
|
||||
<mester@uni-bremen.de> and updated by Cyril Brulebois
|
||||
<cyril.brulebois@enst-bretagne.fr> and Dan Eicher <dan@trollwerks.org>.
|
|
@ -74,4 +74,3 @@ set(SRC
|
|||
)
|
||||
|
||||
blender_add_lib(extern_openjpeg "${SRC}" "${INC}")
|
||||
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
# $Id$
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2006, Blender Foundation
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): Jacques Beaurain.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
SET(INC . intern ../moto/include ../string dummy openal sdl)
|
||||
|
||||
IF(WITH_OPENAL)
|
||||
FILE(GLOB SRC dummy/*.cpp intern/*.cpp openal/*.cpp sdl/*.cpp)
|
||||
INCLUDE_DIRECTORIES(${OPENAL_INC} ${SDL_INC})
|
||||
STRING(REGEX MATCH ".*ramework.*" FRAMEWORK ${OPENAL_INC})
|
||||
IF(FRAMEWORK)
|
||||
ADD_DEFINITIONS(-DAPPLE_FRAMEWORK_FIX)
|
||||
ENDIF(FRAMEWORK)
|
||||
ELSE(WITH_OPENAL)
|
||||
FILE(GLOB SRC dummy/*.cpp intern/*.cpp)
|
||||
ADD_DEFINITIONS(-DNO_SOUND)
|
||||
ENDIF(WITH_OPENAL)
|
||||
|
||||
BLENDERLIB(bf_soundsystem "${SRC}" "${INC}")
|
||||
#, libtype=['core','player'], priority = [20,140] )
|
|
@ -1,70 +0,0 @@
|
|||
# -*- mode: gnumakefile; tab-width: 8; indent-tabs-mode: t; -*-
|
||||
# vim: tabstop=8
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): GSR
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
#
|
||||
#
|
||||
|
||||
include nan_definitions.mk
|
||||
|
||||
LIBNAME = SoundSystem
|
||||
SOURCEDIR = intern/SoundSystem
|
||||
DIR = $(OCGDIR)/$(SOURCEDIR)
|
||||
DIRS = intern
|
||||
DIRS += dummy
|
||||
|
||||
ifneq ($(NAN_NO_OPENAL),true)
|
||||
ifeq ($(OS),windows)
|
||||
DIRS += openal sdl
|
||||
endif
|
||||
ifeq ($(OS),darwin)
|
||||
DIRS += openal
|
||||
endif
|
||||
ifeq ($(OS),$(findstring $(OS), "linux freebsd solaris"))
|
||||
DIRS += openal sdl
|
||||
endif
|
||||
ifeq ($(OS), irix)
|
||||
DIRS += sdl
|
||||
endif
|
||||
else
|
||||
export CPPFLAGS += -DNO_SOUND
|
||||
endif
|
||||
|
||||
include nan_subdirs.mk
|
||||
|
||||
install: $(ALL_OR_DEBUG)
|
||||
@[ -d $(NAN_SOUNDSYSTEM) ] || mkdir $(NAN_SOUNDSYSTEM)
|
||||
@[ -d $(NAN_SOUNDSYSTEM)/include ] || mkdir $(NAN_SOUNDSYSTEM)/include
|
||||
@[ -d $(NAN_SOUNDSYSTEM)/lib/$(DEBUG_DIR) ] || mkdir $(NAN_SOUNDSYSTEM)/lib/$(DEBUG_DIR)
|
||||
@../tools/cpifdiff.sh $(DIR)/$(DEBUG_DIR)libSoundSystem.a $(NAN_SOUNDSYSTEM)/lib/$(DEBUG_DIR)
|
||||
ifeq ($(OS),darwin)
|
||||
ranlib $(NAN_SOUNDSYSTEM)/lib/$(DEBUG_DIR)libSoundSystem.a
|
||||
endif
|
||||
@../tools/cpifdiff.sh *.h $(NAN_SOUNDSYSTEM)/include/
|
||||
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
Import ('env')
|
||||
|
||||
sources = env.Glob('dummy/*.cpp') + env.Glob('intern/*.cpp')
|
||||
|
||||
incs = '. intern ../moto/include ../string dummy openal sdl'
|
||||
defs = ''
|
||||
if env['WITH_BF_OPENAL']:
|
||||
sources += env.Glob('openal/*.cpp') + env.Glob('sdl/*.cpp')
|
||||
incs += ' ' + env['BF_OPENAL_INC']
|
||||
incs += ' ' + env['BF_SDL_INC']
|
||||
defs = 'USE_OPENAL'
|
||||
else:
|
||||
defs = 'NO_SOUND'
|
||||
|
||||
if not env['WITH_BF_SDL']:
|
||||
defs += ' DISABLE_SDL'
|
||||
|
||||
env.BlenderLib ('bf_soundsystem', sources, Split(incs), Split(defs), libtype=['intern','player'], priority = [25,135] )
|
|
@ -1,354 +0,0 @@
|
|||
/**
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
#ifndef SND_BLENDER_H
|
||||
#define SND_BLENDER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "SoundDefines.h"
|
||||
|
||||
#define SND_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name
|
||||
|
||||
SND_DECLARE_HANDLE(SND_AudioDeviceInterfaceHandle);
|
||||
SND_DECLARE_HANDLE(SND_SceneHandle);
|
||||
SND_DECLARE_HANDLE(SND_ObjectHandle);
|
||||
SND_DECLARE_HANDLE(SND_ListenerHandle);
|
||||
|
||||
/**
|
||||
* set the specified type
|
||||
*/
|
||||
extern void SND_SetDeviceType(int device_type);
|
||||
|
||||
/**
|
||||
* get an audiodevice
|
||||
*/
|
||||
extern SND_AudioDeviceInterfaceHandle SND_GetAudioDevice(void);
|
||||
|
||||
/**
|
||||
* and let go of it
|
||||
*/
|
||||
extern void SND_ReleaseDevice(void);
|
||||
|
||||
/**
|
||||
* check if playback is desired
|
||||
*/
|
||||
extern int SND_IsPlaybackWanted(SND_SceneHandle scene);
|
||||
|
||||
/**
|
||||
* add memlocation to cache
|
||||
*/
|
||||
extern int SND_AddSample(SND_SceneHandle scene,
|
||||
const char* filename,
|
||||
void* memlocation,
|
||||
int size);
|
||||
|
||||
/**
|
||||
* remove all samples
|
||||
*/
|
||||
extern void SND_RemoveAllSamples(SND_SceneHandle scene);
|
||||
|
||||
/**
|
||||
* forces the object to check its buffer, and fix it if it's wrong
|
||||
*/
|
||||
extern int SND_CheckBuffer(SND_SceneHandle scene, SND_ObjectHandle object);
|
||||
|
||||
/**
|
||||
* Creates a scene, initializes it and returns a handle to that scene.
|
||||
*
|
||||
* @param audiodevice: handle to the audiodevice.
|
||||
*/
|
||||
extern SND_SceneHandle SND_CreateScene(SND_AudioDeviceInterfaceHandle audiodevice);
|
||||
|
||||
/**
|
||||
* Stops all sounds, suspends the scene (so all resources will be freed) and deletes the scene.
|
||||
*
|
||||
* @param scene: handle to the soundscene.
|
||||
*/
|
||||
extern void SND_DeleteScene(SND_SceneHandle scene);
|
||||
|
||||
/**
|
||||
* Adds a soundobject to the scene, gets the buffer the sample is loaded into.
|
||||
*
|
||||
* @param scene: handle to the soundscene.
|
||||
* @param object: handle to soundobject.
|
||||
*/
|
||||
extern void SND_AddSound(SND_SceneHandle scene, SND_ObjectHandle object);
|
||||
|
||||
/**
|
||||
* Removes a soundobject from the scene.
|
||||
*
|
||||
* @param scene: handle to the soundscene.
|
||||
* @param object: handle to soundobject.
|
||||
*/
|
||||
extern void SND_RemoveSound(SND_SceneHandle scene, SND_ObjectHandle object);
|
||||
|
||||
/**
|
||||
* Removes all soundobjects from the scene.
|
||||
*
|
||||
* @param scene: handle to the soundscene.
|
||||
*/
|
||||
extern void SND_RemoveAllSounds(SND_SceneHandle scene);
|
||||
|
||||
/**
|
||||
* Stopss all soundobjects in the scene.
|
||||
*
|
||||
* @param scene: handle to the soundscene.
|
||||
*/
|
||||
extern void SND_StopAllSounds(SND_SceneHandle scene);
|
||||
|
||||
/**
|
||||
* Updates the listener, checks the status of all soundobjects, builds a list of all active
|
||||
* objects, updates the active objects.
|
||||
*
|
||||
* @param audiodevice: handle to the audiodevice.
|
||||
* @param scene: handle to the soundscene.
|
||||
*/
|
||||
extern void SND_Proceed(SND_AudioDeviceInterfaceHandle audiodevice, SND_SceneHandle scene);
|
||||
|
||||
/**
|
||||
* Returns a handle to the listener.
|
||||
*
|
||||
* @param scene: handle to the soundscene.
|
||||
*/
|
||||
extern SND_ListenerHandle SND_GetListener(SND_SceneHandle scene);
|
||||
|
||||
/**
|
||||
* Sets the gain of the listener.
|
||||
*
|
||||
* @param scene: handle to the soundscene.
|
||||
* @param gain: factor the gain gets multiplied with.
|
||||
*/
|
||||
extern void SND_SetListenerGain(SND_SceneHandle scene, double gain);
|
||||
|
||||
/**
|
||||
* Sets a scaling to exaggerate or deemphasize the Doppler (pitch) shift resulting from the
|
||||
* calculation.
|
||||
* @attention $f' = dopplerfactor * f * frac{dopplervelocity - listener_velocity}{dopplervelocity + object_velocity}$
|
||||
* @attention f: frequency in sample (soundobject)
|
||||
* @attention f': effective Doppler shifted frequency
|
||||
*
|
||||
* @param object: handle to soundobject.
|
||||
* @param dopplerfactor: the dopplerfactor.
|
||||
*/
|
||||
extern void SND_SetDopplerFactor(SND_SceneHandle scene, double dopplerfactor);
|
||||
|
||||
/**
|
||||
* Sets the value of the propagation speed relative to which the source velocities are interpreted.
|
||||
* @attention $f' = dopplerfactor * f * frac{dopplervelocity - listener_velocity}{dopplervelocity + object_velocity}$
|
||||
* @attention f: frequency in sample (soundobject)
|
||||
* @attention f': effective Doppler shifted frequency
|
||||
*
|
||||
* @param object: handle to soundobject.
|
||||
* @param dopplervelocity: the dopplervelocity.
|
||||
*/
|
||||
extern void SND_SetDopplerVelocity(SND_SceneHandle scene, double dopplervelocity);
|
||||
|
||||
/**
|
||||
* Creates a new soundobject and returns a handle to it.
|
||||
*/
|
||||
extern SND_ObjectHandle SND_CreateSound(void);
|
||||
|
||||
/**
|
||||
* Deletes a soundobject.
|
||||
*
|
||||
* @param object: handle to soundobject.
|
||||
*/
|
||||
extern void SND_DeleteSound(SND_ObjectHandle object);
|
||||
|
||||
/**
|
||||
* Sets a soundobject to SND_MUST_PLAY, so with the next proceed it will be updated and played.
|
||||
*
|
||||
* @param object: handle to soundobject.
|
||||
*/
|
||||
extern void SND_StartSound(SND_SceneHandle scene, SND_ObjectHandle object);
|
||||
|
||||
/**
|
||||
* Sets a soundobject to SND_MUST_STOP, so with the next proceed it will be stopped.
|
||||
*
|
||||
* @param object: handle to soundobject.
|
||||
*/
|
||||
extern void SND_StopSound(SND_SceneHandle scene, SND_ObjectHandle object);
|
||||
|
||||
/**
|
||||
* Sets a soundobject to SND_MUST_PAUSE, so with the next proceed it will be paused.
|
||||
*
|
||||
* @param object: handle to soundobject.
|
||||
*/
|
||||
extern void SND_PauseSound(SND_SceneHandle scene, SND_ObjectHandle object);
|
||||
|
||||
/**
|
||||
* Sets the name of the sample to reference the soundobject to it.
|
||||
*
|
||||
* @param object: handle to soundobject.
|
||||
* @param samplename: the name of the sample
|
||||
*/
|
||||
extern void SND_SetSampleName(SND_ObjectHandle object, char* samplename);
|
||||
|
||||
/**
|
||||
* Sets the gain of a soundobject.
|
||||
*
|
||||
* @param object: handle to soundobject.
|
||||
* @param gain: factor the gain gets multiplied with.
|
||||
*/
|
||||
extern void SND_SetGain(SND_ObjectHandle object, double gain);
|
||||
|
||||
/**
|
||||
* Sets the minimum gain of a soundobject.
|
||||
*
|
||||
* @param object: handle to soundobject.
|
||||
* @param minimumgain: lower threshold for the gain.
|
||||
*/
|
||||
extern void SND_SetMinimumGain(SND_ObjectHandle object, double minimumgain);
|
||||
|
||||
/**
|
||||
* Sets the maximum gain of a soundobject.
|
||||
*
|
||||
* @param object: handle to soundobject.
|
||||
* @param maximumgain: upper threshold for the gain.
|
||||
*/
|
||||
extern void SND_SetMaximumGain(SND_ObjectHandle object, double maximumgain);
|
||||
|
||||
/**
|
||||
* Sets the rollofffactor. The rollofffactor is a per-Source parameter the application
|
||||
* can use to increase or decrease the range of a source by decreasing or increasing the
|
||||
* attenuation, respectively. The default value is 1. The implementation is free to optimize
|
||||
* for a rollofffactor value of 0, which indicates that the application does not wish any
|
||||
* distance attenuation on the respective Source.
|
||||
*
|
||||
* @param object: handle to soundobject.
|
||||
* @param rollofffactor: the rollofffactor.
|
||||
*/
|
||||
extern void SND_SetRollOffFactor(SND_ObjectHandle object, double rollofffactor);
|
||||
|
||||
/**
|
||||
* Sets the referencedistance at which the listener will experience gain.
|
||||
* @attention G_dB = gain - 20 * log10(1 + rollofffactor * (dist - referencedistance)/referencedistance);
|
||||
*
|
||||
* @param object: handle to soundobject.
|
||||
* @param distance: the reference distance.
|
||||
*/
|
||||
extern void SND_SetReferenceDistance(SND_ObjectHandle object, double referencedistance);
|
||||
|
||||
/**
|
||||
* Sets the pitch of a soundobject.
|
||||
*
|
||||
* @param object: handle to soundobject.
|
||||
* @param pitch: pitchingfactor: 2.0 for doubling the frequency, 0.5 for half the frequency.
|
||||
*/
|
||||
extern void SND_SetPitch(SND_ObjectHandle object, double pitch);
|
||||
|
||||
/**
|
||||
* Sets the position a soundobject.
|
||||
*
|
||||
* @param object: handle to soundobject.
|
||||
* @param position: position[3].
|
||||
*/
|
||||
extern void SND_SetPosition(SND_ObjectHandle object, double* position);
|
||||
|
||||
/**
|
||||
* Sets the velocity of a soundobject.
|
||||
*
|
||||
* @param object: handle to soundobject.
|
||||
* @param velocity: velocity[3].
|
||||
*/
|
||||
extern void SND_SetVelocity(SND_ObjectHandle object, double* velocity);
|
||||
|
||||
/**
|
||||
* Sets the orientation of a soundobject.
|
||||
*
|
||||
* @param object: handle to soundobject.
|
||||
* @param orientation: orientation[9].
|
||||
*/
|
||||
extern void SND_SetOrientation(SND_ObjectHandle object, double* orientation);
|
||||
|
||||
/**
|
||||
* Sets the loopmode of a soundobject.
|
||||
*
|
||||
* @param object: handle to soundobject.
|
||||
* @param loopmode type of the loop (SND_LOOP_OFF, SND_LOOP_NORMAL, SND_LOOP_BIDIRECTIONAL);
|
||||
*/
|
||||
extern void SND_SetLoopMode(SND_ObjectHandle object, int loopmode);
|
||||
|
||||
/**
|
||||
* Sets the looppoints of a soundobject.
|
||||
*
|
||||
* @param object: handle to soundobject.
|
||||
* @param loopstart startpoint of the loop
|
||||
* @param loopend endpoint of the loop
|
||||
*/
|
||||
extern void SND_SetLoopPoints(SND_ObjectHandle object, unsigned int loopstart, unsigned int loopend);
|
||||
|
||||
/**
|
||||
* Gets the gain of a soundobject.
|
||||
*
|
||||
* @param object: handle to soundobject.
|
||||
*/
|
||||
extern float SND_GetGain(SND_ObjectHandle object);
|
||||
|
||||
/**
|
||||
* Gets the pitch of a soundobject.
|
||||
*
|
||||
* @param object: handle to soundobject.
|
||||
*/
|
||||
extern float SND_GetPitch(SND_ObjectHandle object);
|
||||
|
||||
/**
|
||||
* Gets the looping of a soundobject.
|
||||
* 0: SND_LOOP_OFF
|
||||
* 1: SND_LOOP_NORMAL
|
||||
* 2: SND_LOOP_BIDIRECTIONAL
|
||||
*
|
||||
* @param object: handle to soundobject.
|
||||
*/
|
||||
extern int SND_GetLoopMode(SND_ObjectHandle object);
|
||||
|
||||
/**
|
||||
* Gets the playstate of a soundobject.
|
||||
* SND_UNKNOWN = -1
|
||||
* SND_INITIAL
|
||||
* SND_MUST_PLAY
|
||||
* SND_PLAYING
|
||||
* SND_MUST_STOP
|
||||
* SND_STOPPED
|
||||
* SND_MUST_PAUSE
|
||||
* SND_PAUSED
|
||||
* SND_MUST_BE_DELETED
|
||||
*
|
||||
* @param object: handle to soundobject.
|
||||
*/
|
||||
extern int SND_GetPlaystate(SND_ObjectHandle object);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
/*
|
||||
* SND_CDObject.h
|
||||
*
|
||||
* Implementation for CD playback
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef __SND_CDOBJECT_H
|
||||
#define __SND_CDOBJECT_H
|
||||
|
||||
#include "SND_Object.h"
|
||||
|
||||
class SND_CDObject : public SND_Object
|
||||
{
|
||||
private:
|
||||
|
||||
/**
|
||||
* Private to enforce singleton
|
||||
*/
|
||||
SND_CDObject();
|
||||
SND_CDObject(const SND_CDObject&);
|
||||
|
||||
static SND_CDObject* m_instance;
|
||||
MT_Scalar m_gain; /* the gain of the object */
|
||||
int m_playmode; /* the way CD is played back (all, random, track, trackloop) */
|
||||
int m_track; /* the track for 'track' and 'trackloop' */
|
||||
int m_playstate; /* flag for current state of object */
|
||||
bool m_modified;
|
||||
bool m_used; /* flag for checking if we used the cd, if not don't
|
||||
call the stop cd at the end */
|
||||
|
||||
public:
|
||||
static bool CreateSystem();
|
||||
static bool DisposeSystem();
|
||||
static SND_CDObject* Instance();
|
||||
|
||||
~SND_CDObject();
|
||||
|
||||
void SetGain(MT_Scalar gain);
|
||||
void SetPlaymode(int playmode);
|
||||
void SetTrack(int track);
|
||||
void SetPlaystate(int playstate);
|
||||
void SetModified(bool modified);
|
||||
void SetUsed();
|
||||
bool GetUsed();
|
||||
|
||||
bool IsModified() const;
|
||||
|
||||
int GetTrack() const;
|
||||
MT_Scalar GetGain() const;
|
||||
int GetPlaymode() const;
|
||||
int GetPlaystate() const;
|
||||
|
||||
};
|
||||
|
||||
#endif //__SND_CDOBJECT_H
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* SND_DependKludge.h
|
||||
*
|
||||
* who needs what?
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef HAVE_CONFIG_H
|
||||
|
||||
#ifndef NO_SOUND
|
||||
|
||||
#if defined (_WIN32) && !defined(FREE_WINDOWS)
|
||||
# define USE_OPENAL
|
||||
#elif defined (__linux__) || (__FreeBSD__) || defined(__APPLE__) || defined(__sun)
|
||||
# define USE_OPENAL
|
||||
#else
|
||||
# ifdef USE_OPENAL
|
||||
# undef USE_OPENAL
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* NO_SOUND */
|
||||
|
||||
#endif /* HAVE_CONFIG_H */
|
|
@ -1,79 +0,0 @@
|
|||
/*
|
||||
* SND_DeviceManager.h
|
||||
*
|
||||
* singleton for creating, switching and deleting audiodevices
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef __SND_DEVICEMANAGER_H
|
||||
#define __SND_DEVICEMANAGER_H
|
||||
|
||||
#include "SND_IAudioDevice.h"
|
||||
|
||||
class SND_DeviceManager
|
||||
{
|
||||
public :
|
||||
|
||||
/**
|
||||
* a subscription is needed before instances are given away
|
||||
* applications must call subscribe first, get an instance, and
|
||||
* when they are finished with sound, unsubscribe
|
||||
*/
|
||||
static void Subscribe();
|
||||
static void Unsubscribe();
|
||||
|
||||
static SND_IAudioDevice* Instance();
|
||||
static void SetDeviceType(int device_type);
|
||||
|
||||
private :
|
||||
|
||||
/**
|
||||
* Private to enforce singleton
|
||||
*/
|
||||
SND_DeviceManager();
|
||||
SND_DeviceManager(const SND_DeviceManager&);
|
||||
~SND_DeviceManager();
|
||||
|
||||
static SND_IAudioDevice* m_instance;
|
||||
|
||||
/**
|
||||
* The type of device to be created on a call
|
||||
* to Instance().
|
||||
*/
|
||||
static int m_device_type;
|
||||
|
||||
/**
|
||||
* Remember the number of subscriptions.
|
||||
* if 0, delete the device
|
||||
*/
|
||||
static int m_subscriptions;
|
||||
};
|
||||
|
||||
#endif //__SND_DEVICEMANAGER_H
|
||||
|
|
@ -1,343 +0,0 @@
|
|||
/**
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
#ifndef SND_IAUDIODEVICE
|
||||
#define SND_IAUDIODEVICE
|
||||
|
||||
#include "SND_SoundObject.h"
|
||||
#include "SND_CDObject.h"
|
||||
#include "SND_WaveCache.h"
|
||||
#include "SND_WaveSlot.h"
|
||||
#include "MT_Matrix3x3.h"
|
||||
|
||||
class SND_IAudioDevice
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*/
|
||||
SND_IAudioDevice() {};
|
||||
|
||||
/**
|
||||
* destructor
|
||||
*/
|
||||
virtual ~SND_IAudioDevice() {};
|
||||
|
||||
/**
|
||||
* check to see if initialization was successfull
|
||||
*
|
||||
* @return indication of succes
|
||||
*/
|
||||
virtual bool IsInitialized()=0;
|
||||
|
||||
/**
|
||||
* get the wavecache (which does sample (un)loading)
|
||||
*
|
||||
* @return pointer to the wavecache
|
||||
*/
|
||||
virtual SND_WaveCache* GetWaveCache() const =0;
|
||||
|
||||
/**
|
||||
* loads a sample into the device
|
||||
*
|
||||
* @param samplename the name of the sample
|
||||
* @param memlocation pointer where the sample is stored
|
||||
* @param size size of the sample in memory
|
||||
*
|
||||
* @return pointer to the slot with sample data
|
||||
*/
|
||||
virtual SND_WaveSlot* LoadSample(const STR_String& samplename,
|
||||
void* memlocation,
|
||||
int size)=0;
|
||||
|
||||
/**
|
||||
* remove a sample from the wavecache
|
||||
*
|
||||
* @param filename pointer to filename
|
||||
*/
|
||||
// virtual void RemoveSample(const char* filename)=0;
|
||||
|
||||
/**
|
||||
* remove all samples from the wavecache
|
||||
*/
|
||||
virtual void RemoveAllSamples()=0;
|
||||
|
||||
/**
|
||||
* get a new id from the device
|
||||
*
|
||||
* @param pObject pointer to soundobject
|
||||
*
|
||||
* @return indication of success
|
||||
*/
|
||||
virtual bool GetNewId(SND_SoundObject* pObject)=0;
|
||||
|
||||
/**
|
||||
* clear an id
|
||||
*
|
||||
* @param pObject pointer to soundobject
|
||||
*/
|
||||
virtual void ClearId(SND_SoundObject* pObject)=0;
|
||||
|
||||
/**
|
||||
* initialize the listener
|
||||
*/
|
||||
virtual void InitListener()=0;
|
||||
|
||||
/**
|
||||
* set the value of the propagation speed relative to which the
|
||||
* source velocities are interpreted.
|
||||
* f' = DOPPLER_FACTOR * f * (DOPPLER_VELOCITY - Vl) / (DOPPLER_VELOCITY + Vo)
|
||||
* f: frequency in sample (soundobject)
|
||||
* f': effective Doppler shifted frequency
|
||||
* Vl: velocity listener
|
||||
* Vo: velocity soundobject
|
||||
*
|
||||
* @param dopplervelocity scaling factor for doppler effect
|
||||
*/
|
||||
virtual void SetDopplerVelocity(MT_Scalar dopplervelocity) const =0;
|
||||
|
||||
/**
|
||||
* set a scaling to exaggerate or deemphasize the Doppler (pitch)
|
||||
* shift resulting from the calculation.
|
||||
* f' = DOPPLER_FACTOR * f * (DOPPLER_VELOCITY - Listener_velocity )/(DOPPLER_VELOCITY + object_velocity )
|
||||
*
|
||||
* @param dopplerfactor scaling factor for doppler effect
|
||||
*/
|
||||
virtual void SetDopplerFactor(MT_Scalar dopplerfactor) const =0;
|
||||
|
||||
/**
|
||||
* set the roll-off factor
|
||||
*
|
||||
* @param rollofffactor a global volume scaling factor
|
||||
*/
|
||||
virtual void SetListenerRollOffFactor(MT_Scalar rollofffactor) const =0;
|
||||
|
||||
/**
|
||||
* make the context the current one
|
||||
*/
|
||||
virtual void MakeCurrent() const =0;
|
||||
|
||||
/**
|
||||
* update the device
|
||||
*/
|
||||
virtual void NextFrame() const =0;
|
||||
|
||||
/**
|
||||
* set the volume of the listener.
|
||||
*
|
||||
* @param gain the mastergain
|
||||
*/
|
||||
virtual void SetListenerGain(float gain) const =0;
|
||||
|
||||
/**
|
||||
* connect the buffer with the source
|
||||
*
|
||||
* @param id the id of the object
|
||||
* @param buffer the buffer the sample is stored in
|
||||
*/
|
||||
virtual void SetObjectBuffer(int id, unsigned int buffer)=0;
|
||||
|
||||
/**
|
||||
* pause playback of the cd
|
||||
* @param id the id of the object
|
||||
*
|
||||
* @return the state the object is in
|
||||
*/
|
||||
virtual int GetPlayState(int id) =0;
|
||||
|
||||
/**
|
||||
* play a sound belonging to an object.
|
||||
*
|
||||
* @param id the id of the object
|
||||
*/
|
||||
virtual void PlayObject(int id) =0;
|
||||
|
||||
/**
|
||||
* stop a sound belonging to an object.
|
||||
*
|
||||
* @param id the id of the object
|
||||
*/
|
||||
virtual void StopObject(int id) const =0;
|
||||
|
||||
/**
|
||||
* stop all sounds.
|
||||
*/
|
||||
virtual void StopAllObjects()=0;
|
||||
|
||||
/**
|
||||
* pause the sound belonging to an object.
|
||||
*
|
||||
* @param id the id of the object
|
||||
*/
|
||||
virtual void PauseObject(int id) const =0;
|
||||
|
||||
/**
|
||||
* set the sound to looping or non-looping.
|
||||
*
|
||||
* @param id the id of the object
|
||||
* @param loopmode type of looping (no loop, normal, bidirectional)
|
||||
*/
|
||||
virtual void SetObjectLoop(int id, unsigned int loopmode) const =0;
|
||||
|
||||
/**
|
||||
* set the looppoints of a sound
|
||||
*
|
||||
* @param id the id of the object
|
||||
* @param loopstart the startpoint of the loop (in samples)
|
||||
* @param loopend the endpoint of the loop (in samples)
|
||||
*/
|
||||
virtual void SetObjectLoopPoints(int id, unsigned int loopstart, unsigned int loopend) const =0;
|
||||
|
||||
/**
|
||||
* set the pitch of the sound.
|
||||
*
|
||||
* @param id the id of the object
|
||||
* @param pitch the pitch
|
||||
*/
|
||||
virtual void SetObjectPitch(int id, MT_Scalar pitch) const =0;
|
||||
|
||||
/**
|
||||
* set the gain of the sound.
|
||||
*
|
||||
* @param id the id of the object
|
||||
* @param gain the gain
|
||||
*/
|
||||
virtual void SetObjectGain(int id, MT_Scalar gain) const =0;
|
||||
|
||||
/**
|
||||
* ROLLOFF_FACTOR is per-Source parameter the application can use to increase or decrease
|
||||
* the range of a source by decreasing or increasing the attenuation, respectively. The
|
||||
* default value is 1. The implementation is free to optimize for a ROLLOFF_FACTOR value
|
||||
* of 0, which indicates that the application does not wish any distance attenuation on
|
||||
* the respective Source.
|
||||
*
|
||||
* @param id the id of the object
|
||||
* @param rolloff a per-source volume scaling factor
|
||||
*/
|
||||
virtual void SetObjectRollOffFactor(int id, MT_Scalar rolloff) const =0;
|
||||
|
||||
/**
|
||||
* min_gain indicates the minimal gain which is always guaranteed for this sound
|
||||
*
|
||||
* @param id the id of the object
|
||||
* @param mingain the minimum gain of the object
|
||||
*/
|
||||
virtual void SetObjectMinGain(int id, MT_Scalar mingain) const =0;
|
||||
|
||||
/**
|
||||
* max_gain indicates the maximal gain which is always guaranteed for this sound
|
||||
*
|
||||
* @param id the id of the object
|
||||
* @param maxgain the maximum gain of the object
|
||||
*/
|
||||
virtual void SetObjectMaxGain(int id, MT_Scalar maxgain) const =0;
|
||||
/**
|
||||
* set the distance at which the Listener will experience gain.
|
||||
* G_dB = GAIN - 20*log10(1 + ROLLOFF_FACTOR*(dist-REFERENCE_DISTANCE)/REFERENCE_DISTANCE );
|
||||
*
|
||||
* @param id the id of the object
|
||||
* @param referencedistance the distance at which the listener will start hearing
|
||||
*/
|
||||
virtual void SetObjectReferenceDistance(int id, MT_Scalar referencedistance) const =0;
|
||||
|
||||
/**
|
||||
* set the position, velocity and orientation of a sound.
|
||||
*
|
||||
* @param id the id of the object
|
||||
* @param position the position of the object
|
||||
* @param velocity the velocity of the object
|
||||
* @param orientation the orientation of the object
|
||||
* @param lisposition the position of the listener
|
||||
* @param rollofffactor the rollofffactor of the object
|
||||
*/
|
||||
virtual void SetObjectTransform(int id,
|
||||
const MT_Vector3& position,
|
||||
const MT_Vector3& velocity,
|
||||
const MT_Matrix3x3& orientation,
|
||||
const MT_Vector3& lisposition,
|
||||
const MT_Scalar& rollofffactor) const =0;
|
||||
|
||||
/**
|
||||
* make a sound 2D
|
||||
*
|
||||
* @param id the id of the object
|
||||
*/
|
||||
virtual void ObjectIs2D(int id) const =0;
|
||||
|
||||
/**
|
||||
* tell the device we want cd suppport
|
||||
*/
|
||||
virtual void UseCD() const =0;
|
||||
|
||||
/**
|
||||
* start playback of the cd
|
||||
*
|
||||
* @param track the tracknumber to start playback from
|
||||
*/
|
||||
virtual void PlayCD(int track) const =0;
|
||||
|
||||
/**
|
||||
* pause playback of the cd (true == pause, false == resume)
|
||||
*/
|
||||
virtual void PauseCD(bool pause) const =0;
|
||||
|
||||
/**
|
||||
* stop playback of the cd
|
||||
*/
|
||||
virtual void StopCD() const =0;
|
||||
|
||||
/**
|
||||
* set the playbackmode of the cd
|
||||
* SND_CD_ALL play all tracks
|
||||
* SND_CD_TRACK play one track
|
||||
* SND_CD_TRACKLOOP play one track looped
|
||||
* SND_CD_RANDOM play all tracks in random order
|
||||
*
|
||||
* @param playmode playmode
|
||||
*/
|
||||
virtual void SetCDPlaymode(int playmode) const =0;
|
||||
|
||||
/**
|
||||
* set the volume playback of the cd
|
||||
*
|
||||
* @param gain the gain
|
||||
*/
|
||||
virtual void SetCDGain(MT_Scalar gain) const =0;
|
||||
|
||||
virtual void StartUsingDSP() =0;
|
||||
virtual float* GetSpectrum() =0;
|
||||
virtual void StopUsingDSP() =0;
|
||||
|
||||
protected:
|
||||
|
||||
virtual void RevokeSoundObject(SND_SoundObject* pObject)=0;
|
||||
};
|
||||
|
||||
#endif //SND_IAUDIODEVICE
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
/*
|
||||
* SND_Scene.h
|
||||
*
|
||||
* The scene for sounds.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
|
||||
#endif //WIN32
|
||||
|
||||
#ifndef __SND_SCENE_H
|
||||
#define __SND_SCENE_H
|
||||
|
||||
#include "SoundDefines.h"
|
||||
#include "SND_SoundObject.h"
|
||||
#include "SND_CDObject.h"
|
||||
#include "SND_SoundListener.h"
|
||||
#include "SND_WaveSlot.h"
|
||||
|
||||
#include "MT_Vector3.h"
|
||||
#include "MT_Matrix3x3.h"
|
||||
#include "STR_String.h"
|
||||
|
||||
#include <set>
|
||||
|
||||
|
||||
class SND_Scene
|
||||
{
|
||||
std::set<class SND_SoundObject*> m_soundobjects;
|
||||
|
||||
GEN_List m_activeobjects;
|
||||
class SND_IAudioDevice* m_audiodevice;
|
||||
class SND_WaveCache* m_wavecache;
|
||||
class SND_SoundListener m_listener;
|
||||
bool m_audio; // to check if audio works
|
||||
bool m_audioplayback; // to check if audioplayback is wanted
|
||||
|
||||
void UpdateListener();
|
||||
void BuildActiveList(MT_Scalar curtime);
|
||||
void UpdateActiveObects();
|
||||
void UpdateCD();
|
||||
|
||||
public:
|
||||
SND_Scene(SND_IAudioDevice* adi);
|
||||
~SND_Scene();
|
||||
|
||||
bool IsPlaybackWanted();
|
||||
|
||||
void AddActiveObject(SND_SoundObject* pObject, MT_Scalar curtime);
|
||||
void RemoveActiveObject(SND_SoundObject* pObject);
|
||||
void DeleteObjectWhenFinished(SND_SoundObject* pObject);
|
||||
|
||||
void Proceed();
|
||||
|
||||
int LoadSample(const STR_String& samplename,
|
||||
void* memlocation,
|
||||
int size);
|
||||
void RemoveAllSamples();
|
||||
bool CheckBuffer(SND_SoundObject* pObject);
|
||||
bool IsSampleLoaded(STR_String& samplename);
|
||||
|
||||
void AddObject(SND_SoundObject* pObject);
|
||||
bool SetCDObject(SND_CDObject* cdobject);
|
||||
void DeleteObject(SND_SoundObject* pObject);
|
||||
void RemoveAllObjects();
|
||||
void StopAllObjects();
|
||||
int GetObjectStatus(SND_SoundObject* pObject) const;
|
||||
|
||||
void SetListenerTransform(const MT_Vector3& pos,
|
||||
const MT_Vector3& vel,
|
||||
const MT_Matrix3x3& mat);
|
||||
|
||||
SND_SoundListener* GetListener();
|
||||
};
|
||||
|
||||
#endif //__SND_SCENE_H
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
/*
|
||||
* SND_SoundListener.h
|
||||
*
|
||||
* A SoundListener is for sound what a camera is for vision.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef __SND_SOUNDLISTENER_H
|
||||
#define __SND_SOUNDLISTENER_H
|
||||
|
||||
#include "SND_Object.h"
|
||||
|
||||
class SND_SoundListener : public SND_Object
|
||||
{
|
||||
public:
|
||||
SND_SoundListener();
|
||||
virtual ~SND_SoundListener();
|
||||
|
||||
void SetStateFlag(unsigned int stateflags);
|
||||
void SetGain(MT_Scalar gain);
|
||||
void SetPosition(const MT_Vector3& pos);
|
||||
void SetVelocity(const MT_Vector3& vel);
|
||||
void SetOrientation(const MT_Matrix3x3& ori);
|
||||
void SetDopplerFactor(MT_Scalar dopplerfactor);
|
||||
void SetDopplerVelocity(MT_Scalar dopplervelocity);
|
||||
void SetScale(MT_Scalar scale);
|
||||
|
||||
void SetModified(bool modified);
|
||||
bool IsModified() const;
|
||||
|
||||
unsigned int GetStateFlags() const;
|
||||
MT_Scalar GetGain() const;
|
||||
MT_Vector3 GetPosition() const;
|
||||
MT_Vector3 GetVelocity() const;
|
||||
MT_Matrix3x3 GetOrientation();
|
||||
|
||||
MT_Scalar GetDopplerFactor() const;
|
||||
MT_Scalar GetDopplerVelocity() const;
|
||||
MT_Scalar GetScale() const;
|
||||
|
||||
private:
|
||||
void* m_listener;
|
||||
bool m_modified;
|
||||
|
||||
MT_Scalar m_gain; /* overall gain */
|
||||
MT_Vector3 m_position; /* position; left/right, up/down, in/out */
|
||||
MT_Vector3 m_velocity; /* velocity of the listener */
|
||||
MT_Matrix3x3 m_orientation; /* orientation of the listener */
|
||||
|
||||
MT_Scalar m_dopplerfactor; /* scaling factor for the Doppler (pitch) shift */
|
||||
MT_Scalar m_dopplervelocity; /* factor for the reference velocity (for Dopplereffect) */
|
||||
MT_Scalar m_scale;
|
||||
};
|
||||
|
||||
#endif //__SND_SOUNDLISTENER_H
|
||||
|
|
@ -1,159 +0,0 @@
|
|||
/*
|
||||
* SND_SoundObject.h
|
||||
*
|
||||
* Implementation of the abstract sound object
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef __SND_SOUNDOBJECT_H
|
||||
#define __SND_SOUNDOBJECT_H
|
||||
|
||||
#include "SND_Object.h"
|
||||
#include "STR_String.h"
|
||||
|
||||
/**
|
||||
* SND_SoundObject is a class for api independent sounddata storage conected to an actuator
|
||||
*/
|
||||
|
||||
class SND_SoundObject : public SND_Object
|
||||
{
|
||||
private:
|
||||
STR_String m_samplename; /* name of the sample */
|
||||
STR_String m_objectname; /* name of the object */
|
||||
unsigned int m_buffer;
|
||||
|
||||
bool m_active; /* is the object active or not? */
|
||||
int m_id;
|
||||
MT_Scalar m_lifespan; /* the lifespan of the sound seconds */
|
||||
MT_Scalar m_timestamp;
|
||||
|
||||
MT_Scalar m_length; /* length of the sample in seconds */
|
||||
|
||||
MT_Scalar m_gain; /* the gain of the object */
|
||||
MT_Scalar m_rollofffactor; /* the scaling factor to increase or decrease the range
|
||||
of a source by decreasing or increasing the
|
||||
attenuation, respectively */
|
||||
MT_Scalar m_referencedistance;/* the distance at which the listener will experience
|
||||
gain */
|
||||
MT_Scalar m_mingain; /* indicates the minimal gain which is always guaranteed
|
||||
for this source */
|
||||
MT_Scalar m_maxgain; /* indicates the maximal gain which is always guaranteed
|
||||
for this source */
|
||||
|
||||
MT_Scalar m_pitch; /* the pitch of the object */
|
||||
MT_Vector3 m_position; /* position; left/right, up/down, in/out */
|
||||
MT_Vector3 m_velocity; /* velocity of the object */
|
||||
MT_Matrix3x3 m_orientation; /* orientation of the object */
|
||||
unsigned int m_loopmode; /* loop normal or bidirectional? */
|
||||
unsigned int m_loopstart; /* start of looppoint in samples! */
|
||||
unsigned int m_loopend; /* end of looppoint in samples! */
|
||||
bool m_is3d; /* is the object 3D or 2D? */
|
||||
int m_playstate; /* flag for current state of object */
|
||||
bool m_modified;
|
||||
unsigned int m_running;
|
||||
bool m_highpriority; /* may the sound be ditched when we run out of voices? */
|
||||
|
||||
public:
|
||||
|
||||
SND_SoundObject();
|
||||
~SND_SoundObject();
|
||||
|
||||
void SetBuffer(unsigned int buffer);
|
||||
void SetActive(bool active);
|
||||
|
||||
void StartSound();
|
||||
void StopSound();
|
||||
void PauseSound();
|
||||
void DeleteWhenFinished();
|
||||
|
||||
void SetObjectName(STR_String objectname);
|
||||
void SetSampleName(STR_String samplename);
|
||||
void SetLength(MT_Scalar length);
|
||||
|
||||
void SetPitch(MT_Scalar pitch);
|
||||
void SetGain(MT_Scalar gain);
|
||||
void SetMinGain(MT_Scalar mingain);
|
||||
void SetMaxGain(MT_Scalar maxgain);
|
||||
void SetRollOffFactor(MT_Scalar rollofffactor);
|
||||
void SetReferenceDistance(MT_Scalar distance);
|
||||
void SetPosition(const MT_Vector3& pos);
|
||||
void SetVelocity(const MT_Vector3& vel);
|
||||
void SetOrientation(const MT_Matrix3x3& orient);
|
||||
void SetLoopMode(unsigned int loopmode);
|
||||
void SetLoopStart(unsigned int loopstart);
|
||||
void SetLoopEnd(unsigned int loopend);
|
||||
void Set3D(bool threedee);
|
||||
void SetPlaystate(int playstate);
|
||||
void SetHighPriority(bool priority);
|
||||
|
||||
void SetId(int id);
|
||||
void SetLifeSpan();
|
||||
void SetTimeStamp(MT_Scalar timestamp);
|
||||
|
||||
void SetModified(bool modified);
|
||||
|
||||
bool IsLifeSpanOver(MT_Scalar curtime) const;
|
||||
bool IsActive() const;
|
||||
bool IsModified() const;
|
||||
bool IsHighPriority() const;
|
||||
|
||||
void InitRunning();
|
||||
bool IsRunning() const;
|
||||
void AddRunning();
|
||||
|
||||
int GetId() const;
|
||||
MT_Scalar GetLifeSpan() const;
|
||||
MT_Scalar GetTimestamp() const;
|
||||
|
||||
unsigned int GetBuffer();
|
||||
const STR_String& GetSampleName();
|
||||
const STR_String& GetObjectName();
|
||||
|
||||
MT_Scalar GetLength() const;
|
||||
MT_Scalar GetGain() const;
|
||||
MT_Scalar GetPitch() const;
|
||||
|
||||
MT_Scalar GetMinGain() const;
|
||||
MT_Scalar GetMaxGain() const;
|
||||
MT_Scalar GetRollOffFactor() const;
|
||||
MT_Scalar GetReferenceDistance() const;
|
||||
|
||||
MT_Vector3 GetPosition() const;
|
||||
MT_Vector3 GetVelocity() const;
|
||||
MT_Matrix3x3 GetOrientation() const;
|
||||
unsigned int GetLoopMode() const;
|
||||
unsigned int GetLoopStart() const;
|
||||
unsigned int GetLoopEnd() const;
|
||||
bool Is3D() const;
|
||||
int GetPlaystate() const;
|
||||
|
||||
};
|
||||
|
||||
#endif //__SND_SOUNDOBJECT_H
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
/**
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
#ifndef SND_UTILS_H
|
||||
#define SND_UTILS_H
|
||||
|
||||
#include "SND_WaveSlot.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char riff[4];
|
||||
signed int size;
|
||||
unsigned char type[4];
|
||||
} WavFileHeader;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short format;
|
||||
unsigned short numberofchannels;
|
||||
unsigned int samplerate;
|
||||
unsigned int bytespersec;
|
||||
unsigned short blockalignment;
|
||||
unsigned short bitrate;
|
||||
} WavFmtHeader;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short size;
|
||||
unsigned short samplesperblock;
|
||||
} WavFmtExHeader;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int Manufacturer;
|
||||
unsigned int Product;
|
||||
unsigned int SamplePeriod;
|
||||
unsigned int Note;
|
||||
unsigned int FineTune;
|
||||
unsigned int SMPTEFormat;
|
||||
unsigned int SMPTEOffest;
|
||||
unsigned int loops;
|
||||
unsigned int SamplerData;
|
||||
struct
|
||||
{
|
||||
unsigned int Identifier;
|
||||
unsigned int Type;
|
||||
unsigned int Start;
|
||||
unsigned int End;
|
||||
unsigned int Fraction;
|
||||
unsigned int Count;
|
||||
} Loop[1];
|
||||
} WavSampleHeader;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char id[4];
|
||||
unsigned int size;
|
||||
} WavChunkHeader;
|
||||
|
||||
/**
|
||||
* loads a sample and returns a pointer
|
||||
*/
|
||||
extern void* SND_LoadSample(char *filename);
|
||||
|
||||
extern bool SND_IsSampleValid(const STR_String& name, void* memlocation);
|
||||
extern unsigned int SND_GetSampleFormat(void* sample);
|
||||
extern unsigned int SND_GetNumberOfChannels(void* sample);
|
||||
extern unsigned int SND_GetSampleRate(void* sample);
|
||||
extern unsigned int SND_GetBitRate(void* sample);
|
||||
extern unsigned int SND_GetNumberOfSamples(void* sample, unsigned int sample_length);
|
||||
extern unsigned int SND_GetHeaderSize(void* sample, unsigned int sample_length);
|
||||
extern unsigned int SND_GetExtraChunk(void* sample);
|
||||
|
||||
extern void SND_GetSampleInfo(signed char* sample, SND_WaveSlot* waveslot);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
* SND_WaveCache.h
|
||||
*
|
||||
* abstract wavecache, a way to organize samples
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
|
||||
#endif //WIN32
|
||||
|
||||
#ifndef __SND_WAVECACHE_H
|
||||
#define __SND_WAVECACHE_H
|
||||
|
||||
#include "SND_WaveSlot.h"
|
||||
#include "SoundDefines.h"
|
||||
#include "SND_SoundObject.h"
|
||||
#include <map>
|
||||
|
||||
class SND_WaveCache
|
||||
{
|
||||
public:
|
||||
SND_WaveCache();
|
||||
virtual ~SND_WaveCache();
|
||||
|
||||
SND_WaveSlot* GetWaveSlot(const STR_String& samplename);
|
||||
|
||||
void RemoveAllSamples();
|
||||
void RemoveSample(const STR_String& samplename, int buffer);
|
||||
|
||||
private:
|
||||
std::map<STR_String, SND_WaveSlot*> m_samplecache;
|
||||
|
||||
SND_WaveSlot* m_bufferList[NUM_BUFFERS];
|
||||
|
||||
void FreeSamples();
|
||||
};
|
||||
|
||||
#endif //__SND_WAVECACHE_H
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
/*
|
||||
* SND_WaveSlot.cpp
|
||||
*
|
||||
* class for storing sample related information
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef __SND_WAVESLOT_H
|
||||
#define __SND_WAVESLOT_H
|
||||
|
||||
#include "STR_String.h"
|
||||
|
||||
class SND_WaveSlot
|
||||
{
|
||||
STR_String m_samplename;
|
||||
bool m_loaded;
|
||||
void* m_data;
|
||||
unsigned int m_buffer;
|
||||
unsigned int m_sampleformat;
|
||||
unsigned int m_numberofchannels;
|
||||
unsigned int m_samplerate;
|
||||
unsigned int m_bitrate;
|
||||
unsigned int m_numberofsamples;
|
||||
unsigned int m_filesize;
|
||||
|
||||
public:
|
||||
|
||||
SND_WaveSlot(): m_loaded(false),
|
||||
m_data(NULL),
|
||||
m_buffer(0),
|
||||
m_sampleformat(0),
|
||||
m_numberofchannels(0),
|
||||
m_samplerate(0),
|
||||
m_bitrate(0),
|
||||
m_numberofsamples(0),
|
||||
m_filesize(0)
|
||||
{};
|
||||
~SND_WaveSlot();
|
||||
|
||||
void SetSampleName(STR_String samplename);
|
||||
void SetLoaded(bool loaded);
|
||||
void SetData(void* data);
|
||||
void SetBuffer(unsigned int buffer);
|
||||
void SetSampleFormat(unsigned int sampleformat);
|
||||
void SetNumberOfChannels(unsigned int numberofchannels);
|
||||
void SetSampleRate(unsigned int samplerate);
|
||||
void SetBitRate(unsigned int bitrate);
|
||||
void SetNumberOfSamples(unsigned int numberofsamples);
|
||||
void SetFileSize(unsigned int filesize);
|
||||
|
||||
|
||||
const STR_String& GetSampleName();
|
||||
bool IsLoaded() const;
|
||||
void* GetData();
|
||||
unsigned int GetBuffer() const;
|
||||
unsigned int GetSampleFormat() const;
|
||||
unsigned int GetNumberOfChannels() const;
|
||||
unsigned int GetSampleRate() const;
|
||||
unsigned int GetBitRate() const;
|
||||
unsigned int GetNumberOfSamples() const;
|
||||
unsigned int GetFileSize() const;
|
||||
|
||||
};
|
||||
|
||||
#endif //__SND_WAVESLOT_H
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
#
|
||||
# $Id$
|
||||
#
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): none yet.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
#
|
||||
#
|
||||
|
||||
LIBNAME = soundsystem
|
||||
DIR = $(OCGDIR)/intern/SoundSystem
|
||||
ALLTARGETS = $(OBJS) $(DIR)/$(DEBUG_DIR)SoundSystem
|
||||
|
||||
include nan_compile.mk
|
||||
|
||||
CPPFLAGS += $(NAN_LEVEL_1_WARNINGS)
|
||||
|
||||
CPPFLAGS += -I$(NAN_MOTO)/include
|
||||
CPPFLAGS += -I.. -I../SND_BlenderWaveCache -I../SND_OpenAL
|
||||
|
||||
TESTLIB = $(OCGDIR)/gameengine/OpenALSoundSystem/$(DEBUG_DIR)libOpenALSoundSystem.a
|
||||
TESTLIB += $(OCGDIR)/gameengine/BlenderWaveCache/$(DEBUG_DIR)libBlenderWaveCache.a
|
||||
TESTLIB += $(OCGDIR)/intern/SoundSystem/$(DEBUG_DIR)libsoundsystem.a
|
||||
TESTLIB += $(NAN_OPENAL)/lib/libopenal.a
|
||||
|
||||
$(DIR)/$(DEBUG_DIR)SoundSystem: $(OBJS) $(TESTLIB)
|
||||
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(TESTLIB) -lm -pthread -ldl -lstdc++
|
|
@ -1,154 +0,0 @@
|
|||
/* SND_test.c nov 2000
|
||||
*
|
||||
* testfile for the SND module
|
||||
*
|
||||
* janco verduin
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include "SND_C-api.h"
|
||||
#include "BlenderWaveCacheCApi.h"
|
||||
#include "OpenALC-Api.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#if defined(WIN32)
|
||||
#include <io.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
|
||||
static int buf[3];
|
||||
|
||||
float oPos[3]={3.0, 0.0,-1.0};
|
||||
float oVel[3]={0.0, 0.0, 1.0};
|
||||
float oOri[6]={0.0, 0.0, 1.0, 0.0, 1.0, 0.0};
|
||||
|
||||
void* ReadFile(char *filename)
|
||||
{
|
||||
int file, filelen;
|
||||
void *data = NULL;
|
||||
|
||||
#if defined(WIN32)
|
||||
file = open(filename, O_BINARY|O_RDONLY);
|
||||
#else
|
||||
file = open(filename, 0|O_RDONLY);
|
||||
#endif
|
||||
|
||||
if (file == -1) {
|
||||
printf("can't open file.\n");
|
||||
printf("press q for quit.\n");
|
||||
|
||||
}
|
||||
else {
|
||||
filelen = lseek(file, 0, SEEK_END);
|
||||
lseek(file, 0, SEEK_SET);
|
||||
|
||||
if (filelen != 0){
|
||||
data = malloc(filelen);
|
||||
if (read(file, data, filelen) != filelen) {
|
||||
free(data);
|
||||
data = NULL;
|
||||
}
|
||||
}
|
||||
close(file);
|
||||
|
||||
}
|
||||
return (data);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int ch;
|
||||
char* samplename = NULL;
|
||||
void* sampleinmemory = NULL;
|
||||
SND_CacheHandle wavecache = NULL;
|
||||
SND_SceneHandle scene = NULL;
|
||||
SND_ObjectHandle object = NULL;
|
||||
|
||||
wavecache = SND_GetWaveCache();
|
||||
scene = SND_CreateOpenALScene(wavecache);
|
||||
|
||||
samplename = "2.wav";
|
||||
sampleinmemory = ReadFile(samplename);
|
||||
|
||||
if (sampleinmemory) {
|
||||
|
||||
object = SND_CreateObject();
|
||||
SND_AddMemoryLocation(samplename, sampleinmemory);
|
||||
SND_SetSampleName(object, samplename);
|
||||
SND_AddObject(scene, object);
|
||||
printf("go your gang...\n");
|
||||
printf("1: play\n");
|
||||
printf("2: stop\n");
|
||||
printf("q: quit\n");
|
||||
}
|
||||
do
|
||||
{
|
||||
ch = getchar();
|
||||
ch = toupper(ch);
|
||||
switch (ch)
|
||||
{
|
||||
case '1':
|
||||
{
|
||||
SND_SetPitch(object, 1.0);
|
||||
SND_SetGain(object, 1.0);
|
||||
SND_StartSound(object);
|
||||
break;
|
||||
}
|
||||
case '2':
|
||||
{
|
||||
SND_StopSound(object);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
SND_Proceed(scene);
|
||||
|
||||
} while (ch != 'Q');
|
||||
|
||||
if (object) {
|
||||
|
||||
SND_RemoveObject(scene, object);
|
||||
SND_DeleteObject(object);
|
||||
}
|
||||
|
||||
SND_DeleteScene(scene);
|
||||
SND_DeleteCache();
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
/*
|
||||
* SoundDefines.h
|
||||
*
|
||||
* this is where all kinds of defines are stored
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef __SOUNDDEFINES_H
|
||||
#define __SOUNDDEFINES_H
|
||||
|
||||
/* the types of devices */
|
||||
enum
|
||||
{
|
||||
snd_e_dummydevice = 0,
|
||||
snd_e_openaldevice
|
||||
};
|
||||
|
||||
/* general stuff */
|
||||
#define NUM_BUFFERS 128
|
||||
#define NUM_SOURCES 24 /* 24 is the limit for openal on windows, was 16 in 2.47 and previous */
|
||||
|
||||
/* openal related stuff */
|
||||
#define AL_LOOPING 0x1007
|
||||
|
||||
/* activelist defines */
|
||||
enum
|
||||
{
|
||||
SND_REMOVE_ACTIVE_OBJECT = 0,
|
||||
SND_ADD_ACTIVE_OBJECT,
|
||||
SND_DO_NOTHING
|
||||
};
|
||||
|
||||
/* playstate flags */
|
||||
enum
|
||||
{
|
||||
SND_UNKNOWN = -1,
|
||||
SND_INITIAL,
|
||||
SND_MUST_PLAY,
|
||||
SND_PLAYING,
|
||||
SND_MUST_STOP,
|
||||
SND_STOPPED,
|
||||
SND_MUST_PAUSE,
|
||||
SND_PAUSED,
|
||||
SND_MUST_RESUME,
|
||||
SND_MUST_STOP_WHEN_FINISHED,
|
||||
SND_MUST_BE_DELETED
|
||||
};
|
||||
|
||||
/* loopmodes */
|
||||
enum
|
||||
{
|
||||
SND_LOOP_OFF = 0,
|
||||
SND_LOOP_NORMAL,
|
||||
SND_LOOP_BIDIRECTIONAL
|
||||
};
|
||||
|
||||
|
||||
/* cd playstate flags */
|
||||
enum
|
||||
{
|
||||
SND_CD_ALL = 0,
|
||||
SND_CD_TRACK,
|
||||
SND_CD_TRACKLOOP
|
||||
};
|
||||
|
||||
/* sample types */
|
||||
enum
|
||||
{
|
||||
SND_WAVE_FORMAT_UNKNOWN = 0,
|
||||
SND_WAVE_FORMAT_PCM,
|
||||
SND_WAVE_FORMAT_ADPCM,
|
||||
SND_WAVE_FORMAT_ALAW = 6,
|
||||
SND_WAVE_FORMAT_MULAW,
|
||||
SND_WAVE_FORMAT_DIALOGIC_OKI_ADPCM = 17,
|
||||
SND_WAVE_FORMAT_CONTROL_RES_VQLPC = 34,
|
||||
SND_WAVE_FORMAT_GSM_610 = 49,
|
||||
SND_WAVE_FORMAT_MPEG3 = 85
|
||||
};
|
||||
|
||||
#endif //__SOUNDDEFINES_H
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
#
|
||||
# $Id$
|
||||
#
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): none yet.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
#
|
||||
#
|
||||
|
||||
LIBNAME = DummySoundSystem
|
||||
DIR = $(OCGDIR)/intern/$(LIBNAME)
|
||||
|
||||
include nan_compile.mk
|
||||
|
||||
CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
|
||||
|
||||
CPPFLAGS += -I$(NAN_STRING)/include
|
||||
CPPFLAGS += -I$(NAN_MOTO)/include
|
||||
CPPFLAGS += -I../intern
|
||||
CPPFLAGS += -I..
|
||||
CPPFLAGS += -I.
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
* SND_DummyDevice derived from SND_IAudioDevice
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
|
||||
#endif //WIN32
|
||||
|
||||
#include "SND_DummyDevice.h"
|
||||
|
||||
SND_DummyDevice::SND_DummyDevice()
|
||||
{
|
||||
}
|
||||
|
||||
SND_DummyDevice::~SND_DummyDevice()
|
||||
{
|
||||
#ifdef ONTKEVER
|
||||
printf("SND_DummyDevice destructor");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
/**
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
#ifndef SND_DUMMYDEVICE
|
||||
#define SND_DUMMYDEVICE
|
||||
|
||||
#include "SND_AudioDevice.h"
|
||||
|
||||
class SND_DummyDevice : public SND_AudioDevice
|
||||
{
|
||||
public:
|
||||
SND_DummyDevice();
|
||||
~SND_DummyDevice();
|
||||
|
||||
bool Init() { return false; }
|
||||
|
||||
SND_WaveSlot* LoadSample(const STR_String& samplename,
|
||||
void* memlocation,
|
||||
int size) { return NULL; }
|
||||
|
||||
void InitListener() {};
|
||||
void SetListenerGain(float gain) const {};
|
||||
void SetDopplerVelocity(MT_Scalar dopplervelocity) const {};
|
||||
void SetDopplerFactor(MT_Scalar dopplerfactor) const {};
|
||||
void SetListenerRollOffFactor(MT_Scalar rollofffactor) const {};
|
||||
|
||||
void MakeCurrent() const {};
|
||||
|
||||
void NextFrame() const {};
|
||||
|
||||
void SetObjectBuffer(int id, unsigned int buffer) {};
|
||||
|
||||
int GetPlayState(int id) { return SND_UNKNOWN; }
|
||||
void PlayObject(int id) {};
|
||||
void StopObject(int id) const {};
|
||||
void StopAllObjects() {};
|
||||
void PauseObject(int id) const {};
|
||||
|
||||
void SetObjectLoop(int id, unsigned int loopmode) const {};
|
||||
void SetObjectLoopPoints(int id, unsigned int loopstart, unsigned int loopend) const {};
|
||||
void SetObjectPitch(int id, MT_Scalar pitch) const {};
|
||||
void SetObjectGain(int id, MT_Scalar gain) const {};
|
||||
void SetObjectMinGain(int id, MT_Scalar mingain) const {};
|
||||
void SetObjectMaxGain(int id, MT_Scalar maxgain) const {};
|
||||
void SetObjectRollOffFactor(int id, MT_Scalar rolloff) const {};
|
||||
void SetObjectReferenceDistance(int id, MT_Scalar distance) const {};
|
||||
|
||||
void SetObjectTransform(int id,
|
||||
const MT_Vector3& position,
|
||||
const MT_Vector3& velocity,
|
||||
const MT_Matrix3x3& orientation,
|
||||
const MT_Vector3& lisposition,
|
||||
const MT_Scalar& rollofffactor) const {};
|
||||
void ObjectIs2D(int id) const {};
|
||||
|
||||
void PlayCD(int track) const {};
|
||||
void PauseCD(bool pause) const {};
|
||||
void StopCD() const {};
|
||||
void SetCDPlaymode(int playmode) const {};
|
||||
void SetCDGain(MT_Scalar gain) const {};
|
||||
|
||||
void StartUsingDSP() {};
|
||||
float* GetSpectrum() { return NULL; }
|
||||
void StopUsingDSP() {};
|
||||
};
|
||||
|
||||
#endif //SND_DUMMYDEVICE
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
#
|
||||
# $Id$
|
||||
#
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): none yet.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
#
|
||||
#
|
||||
|
||||
LIBNAME = SoundSystem
|
||||
DIR = $(OCGDIR)/intern/SoundSystem
|
||||
|
||||
include nan_compile.mk
|
||||
|
||||
CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
|
||||
|
||||
CPPFLAGS += -I$(NAN_STRING)/include
|
||||
CPPFLAGS += -I$(NAN_MOTO)/include
|
||||
CPPFLAGS += -I../../../source/blender/include
|
||||
CPPFLAGS += -I../dummy
|
||||
CPPFLAGS += -I../openal
|
||||
CPPFLAGS += -I..
|
||||
CPPFLAGS += -I.
|
|
@ -1,242 +0,0 @@
|
|||
/**
|
||||
* $Id$
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include "SND_AudioDevice.h"
|
||||
#include "SND_SoundObject.h"
|
||||
|
||||
#ifdef WIN32
|
||||
// This warning tells us about truncation of __long__ stl-generated names.
|
||||
// It can occasionally cause DevStudio to have internal compiler warnings.
|
||||
#pragma warning( disable : 4786 )
|
||||
#endif
|
||||
|
||||
|
||||
SND_AudioDevice::SND_AudioDevice()
|
||||
{
|
||||
m_wavecache = NULL;
|
||||
m_audio = false;
|
||||
|
||||
for (int i = 0; i < NUM_SOURCES; i++)
|
||||
{
|
||||
m_idObjectArray[i] = new SND_IdObject();
|
||||
m_idObjectArray[i]->SetId(i);
|
||||
m_idObjectArray[i]->SetSoundObject(NULL);
|
||||
m_idObjectList.addTail(m_idObjectArray[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
SND_AudioDevice::~SND_AudioDevice()
|
||||
{
|
||||
for (int i = 0; i < NUM_SOURCES; i++)
|
||||
{
|
||||
delete m_idObjectArray[i];
|
||||
m_idObjectArray[i] = NULL;
|
||||
}
|
||||
|
||||
if (m_wavecache)
|
||||
{
|
||||
delete m_wavecache;
|
||||
m_wavecache = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool SND_AudioDevice::IsInitialized()
|
||||
{
|
||||
return m_audio;
|
||||
}
|
||||
|
||||
|
||||
|
||||
SND_WaveCache* SND_AudioDevice::GetWaveCache() const
|
||||
{
|
||||
return m_wavecache;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* seeks an unused id and returns it */
|
||||
bool SND_AudioDevice::GetNewId(SND_SoundObject* pObject)
|
||||
{
|
||||
#ifdef ONTKEVER
|
||||
printf("SND_AudioDevice::GetNewId\n");
|
||||
#endif
|
||||
|
||||
bool result = false;
|
||||
|
||||
// first, get the oldest (the first) idobject
|
||||
SND_IdObject* pIdObject = (SND_IdObject*)m_idObjectList.getHead();
|
||||
|
||||
if (pIdObject->isTail())
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
// find the first id object which doesn't have a high priority soundobject
|
||||
bool ThisSoundMustStay = false;
|
||||
bool OutOfIds = false;
|
||||
|
||||
do
|
||||
{
|
||||
// if no soundobject present, it's seat may be taken
|
||||
if (pIdObject->GetSoundObject())
|
||||
{
|
||||
// and also if it ain't highprio
|
||||
if (pIdObject->GetSoundObject()->IsHighPriority())
|
||||
{
|
||||
ThisSoundMustStay = true;
|
||||
pIdObject = (SND_IdObject*)pIdObject->getNext();
|
||||
|
||||
// if the last one is a priority sound too, then there are no id's left
|
||||
// and we won't add any new sounds
|
||||
if (pIdObject->isTail())
|
||||
OutOfIds = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ThisSoundMustStay = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ThisSoundMustStay = false;
|
||||
}
|
||||
|
||||
} while (ThisSoundMustStay && !OutOfIds);
|
||||
|
||||
if (!OutOfIds)
|
||||
{
|
||||
SND_SoundObject* oldobject = pIdObject->GetSoundObject();
|
||||
|
||||
// revoke the old object if present
|
||||
if (oldobject)
|
||||
{
|
||||
#ifdef ONTKEVER
|
||||
printf("oldobject: %x\n", oldobject);
|
||||
#endif
|
||||
RevokeSoundObject(oldobject);
|
||||
}
|
||||
|
||||
// set the new soundobject into the idobject
|
||||
pIdObject->SetSoundObject(pObject);
|
||||
|
||||
// set the id into the soundobject
|
||||
int id = pIdObject->GetId();
|
||||
pObject->SetId(id);
|
||||
|
||||
// connect the new id to the buffer the sample is stored in
|
||||
SetObjectBuffer(id, pObject->GetBuffer());
|
||||
|
||||
// remove the idobject from the list and add it in the back again
|
||||
pIdObject->remove();
|
||||
m_idObjectList.addTail(pIdObject);
|
||||
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_AudioDevice::ClearId(SND_SoundObject* pObject)
|
||||
{
|
||||
#ifdef ONTKEVER
|
||||
printf("SND_AudioDevice::ClearId\n");
|
||||
#endif
|
||||
|
||||
if (pObject)
|
||||
{
|
||||
int id = pObject->GetId();
|
||||
|
||||
if (id != -1)
|
||||
{
|
||||
// lets get the idobject belonging to the soundobject
|
||||
SND_IdObject* pIdObject = m_idObjectArray[id];
|
||||
SND_SoundObject* oldobject = pIdObject->GetSoundObject();
|
||||
|
||||
if (oldobject)
|
||||
{
|
||||
RevokeSoundObject(oldobject);
|
||||
|
||||
// clear the idobject from the soundobject
|
||||
pIdObject->SetSoundObject(NULL);
|
||||
}
|
||||
|
||||
// remove the idobject and place it in front
|
||||
pIdObject->remove();
|
||||
m_idObjectList.addHead(pIdObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_AudioDevice::RevokeSoundObject(SND_SoundObject* pObject)
|
||||
{
|
||||
#ifdef ONTKEVER
|
||||
printf("SND_AudioDevice::RevokeSoundObject\n");
|
||||
#endif
|
||||
|
||||
// stop the soundobject
|
||||
int id = pObject->GetId();
|
||||
|
||||
if (id >= 0 && id < NUM_SOURCES)
|
||||
{
|
||||
StopObject(id);
|
||||
|
||||
// remove the object from the 'activelist'
|
||||
pObject->SetActive(false);
|
||||
|
||||
#ifdef ONTKEVER
|
||||
printf("pObject->remove();\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
// make sure its id is invalid
|
||||
pObject->SetId(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
void SND_AudioDevice::RemoveSample(const char* filename)
|
||||
{
|
||||
if (m_wavecache)
|
||||
m_wavecache->RemoveSample(filename);
|
||||
}
|
||||
*/
|
||||
|
||||
void SND_AudioDevice::RemoveAllSamples()
|
||||
{
|
||||
if (m_wavecache)
|
||||
m_wavecache->RemoveAllSamples();
|
||||
}
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
/**
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
#ifndef SND_AUDIODEVICE
|
||||
#define SND_AUDIODEVICE
|
||||
|
||||
#include "SND_IAudioDevice.h"
|
||||
#include "SoundDefines.h"
|
||||
#include "SND_IdObject.h"
|
||||
|
||||
class SND_AudioDevice : public SND_IAudioDevice
|
||||
{
|
||||
public:
|
||||
SND_AudioDevice();
|
||||
virtual ~SND_AudioDevice();
|
||||
|
||||
virtual bool IsInitialized();
|
||||
|
||||
SND_WaveCache* GetWaveCache() const;
|
||||
|
||||
bool GetNewId(SND_SoundObject* pObject);
|
||||
void ClearId(SND_SoundObject* pObject);
|
||||
|
||||
void UseCD() const {};
|
||||
|
||||
/* to be implemented in derived class
|
||||
|
||||
virtual SND_WaveSlot* LoadSample(const STR_String& samplename,
|
||||
void* memlocation,
|
||||
int size) =0;
|
||||
*/
|
||||
// void RemoveSample(const char* filename);
|
||||
void RemoveAllSamples();
|
||||
|
||||
/* to be implemented in derived class
|
||||
|
||||
virtual void InitListener()=0;
|
||||
virtual void SetListenerGain(float gain) const =0;
|
||||
virtual void SetDopplerVelocity(MT_Scalar dopplervelocity) const =0;
|
||||
virtual void SetDopplerFactor(MT_Scalar dopplerfactor) const =0;
|
||||
virtual void SetListenerRollOffFactor(MT_Scalar rollofffactor) const =0;
|
||||
|
||||
virtual void MakeCurrent() const =0;
|
||||
|
||||
virtual void UpdateDevice() const =0;
|
||||
|
||||
virtual void SetObjectBuffer(int id, unsigned int buffer)=0;
|
||||
virtual int GetPlayState(int id)=0;
|
||||
virtual void PlayObject(int id)=0;
|
||||
virtual void StopObject(int id) const =0;
|
||||
virtual void StopAllObjects()=0;
|
||||
virtual void PauseObject(int id) const =0;
|
||||
|
||||
virtual void SetObjectLoop(int id, bool loop) const =0;
|
||||
virtual void SetObjectLoopPoints(int id, unsigned int loopstart, unsigned int loopend) const =0;
|
||||
virtual void SetObjectPitch(int id, MT_Scalar pitch) const =0;
|
||||
virtual void SetObjectGain(int id, MT_Scalar gain) const =0;
|
||||
virtual void SetObjectRollOffFactor(int id, MT_Scalar rolloff) const =0;
|
||||
virtual void SetObjectMinGain(int id, MT_Scalar mingain) const =0;
|
||||
virtual void SetObjectMaxGain(int id, MT_Scalar maxgain) const =0;
|
||||
virtual void SetObjectReferenceDistance(int id, MT_Scalar referencedistance) const =0;
|
||||
|
||||
virtual void SetObjectTransform(int id,
|
||||
const MT_Vector3& position,
|
||||
const MT_Vector3& velocity,
|
||||
const MT_Matrix3x3& orientation,
|
||||
const MT_Vector3& lisposition,
|
||||
const MT_Scalar& rollofffactor) const =0;
|
||||
virtual void ObjectIs2D(int id) const =0;
|
||||
|
||||
virtual void PlayCD(int track) const =0;
|
||||
virtual void PauseCD(bool pause) const =0;
|
||||
virtual void StopCD() const =0;
|
||||
virtual void SetCDPlaymode(int playmode) const =0;
|
||||
virtual void SetCDGain(MT_Scalar gain) const =0;
|
||||
virtual float* GetSpectrum() =0;
|
||||
*/
|
||||
|
||||
protected:
|
||||
bool m_audio;
|
||||
GEN_List m_idObjectList;
|
||||
SND_IdObject* m_idObjectArray[NUM_SOURCES];
|
||||
SND_WaveCache* m_wavecache;
|
||||
|
||||
private:
|
||||
void RevokeSoundObject(SND_SoundObject* pObject);
|
||||
};
|
||||
|
||||
#endif //SND_AUDIODEVICE
|
||||
|
|
@ -1,392 +0,0 @@
|
|||
/*
|
||||
* SND_C-Api.cpp
|
||||
*
|
||||
* C Api for soundmodule
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "SND_C-api.h"
|
||||
#include "SND_DeviceManager.h"
|
||||
#include "SND_Scene.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
|
||||
#endif //WIN32
|
||||
|
||||
|
||||
|
||||
void SND_SetDeviceType(int device_type)
|
||||
{
|
||||
SND_DeviceManager::SetDeviceType(device_type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
SND_AudioDeviceInterfaceHandle SND_GetAudioDevice()
|
||||
{
|
||||
SND_IAudioDevice* audiodevice = NULL;
|
||||
|
||||
SND_DeviceManager::Subscribe();
|
||||
audiodevice = SND_DeviceManager::Instance();
|
||||
|
||||
if (!audiodevice->IsInitialized())
|
||||
{
|
||||
SND_DeviceManager::SetDeviceType(snd_e_dummydevice);
|
||||
audiodevice = SND_DeviceManager::Instance();
|
||||
}
|
||||
|
||||
return (SND_AudioDeviceInterfaceHandle)audiodevice;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_ReleaseDevice()
|
||||
{
|
||||
SND_DeviceManager::Unsubscribe();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int SND_IsPlaybackWanted(SND_SceneHandle scene)
|
||||
{
|
||||
assert(scene);
|
||||
bool result = ((SND_Scene*)scene)->IsPlaybackWanted();
|
||||
|
||||
return (int)result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// create a scene
|
||||
SND_SceneHandle SND_CreateScene(SND_AudioDeviceInterfaceHandle audiodevice)
|
||||
{
|
||||
// initialize sound scene and object
|
||||
SND_Scene* scene = new SND_Scene((SND_IAudioDevice*)audiodevice);
|
||||
|
||||
return (SND_SceneHandle)scene;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_DeleteScene(SND_SceneHandle scene)
|
||||
{
|
||||
assert(scene);
|
||||
delete (SND_Scene*)scene;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int SND_AddSample(SND_SceneHandle scene,
|
||||
const char* filename,
|
||||
void* memlocation,
|
||||
int size)
|
||||
{
|
||||
assert(scene);
|
||||
assert(memlocation);
|
||||
int buffer = ((SND_Scene*)scene)->LoadSample(filename, memlocation, size);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_RemoveAllSamples(SND_SceneHandle scene)
|
||||
{
|
||||
assert(scene);
|
||||
((SND_Scene*)scene)->RemoveAllSamples();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int SND_CheckBuffer(SND_SceneHandle scene, SND_ObjectHandle object)
|
||||
{
|
||||
assert(scene);
|
||||
assert(object);
|
||||
int result = (int)((SND_Scene*)scene)->CheckBuffer((SND_SoundObject*)object);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_AddSound(SND_SceneHandle scene, SND_ObjectHandle object)
|
||||
{
|
||||
assert(scene);
|
||||
assert(object);
|
||||
((SND_Scene*)scene)->AddObject((SND_SoundObject *)object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_RemoveSound(SND_SceneHandle scene, SND_ObjectHandle object)
|
||||
{
|
||||
assert(scene);
|
||||
assert(object);
|
||||
((SND_Scene*)scene)->DeleteObject((SND_SoundObject *)object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_RemoveAllSounds(SND_SceneHandle scene)
|
||||
{
|
||||
assert(scene);
|
||||
((SND_Scene*)scene)->RemoveAllObjects();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_StopAllSounds(SND_SceneHandle scene)
|
||||
{
|
||||
assert(scene);
|
||||
((SND_Scene*)scene)->StopAllObjects();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_Proceed(SND_AudioDeviceInterfaceHandle audiodevice, SND_SceneHandle scene)
|
||||
{
|
||||
assert(scene);
|
||||
((SND_Scene*)scene)->Proceed();
|
||||
((SND_IAudioDevice*)audiodevice)->NextFrame();
|
||||
}
|
||||
|
||||
|
||||
|
||||
SND_ListenerHandle SND_GetListener(SND_SceneHandle scene)
|
||||
{
|
||||
assert(scene);
|
||||
return (SND_ListenerHandle)((SND_Scene*)scene)->GetListener();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SetListenerGain(SND_SceneHandle scene, double gain)
|
||||
{
|
||||
assert(scene);
|
||||
SND_SoundListener* listener = ((SND_Scene*)scene)->GetListener();
|
||||
listener->SetGain((MT_Scalar)gain);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SetDopplerFactor(SND_SceneHandle scene, double dopplerfactor)
|
||||
{
|
||||
assert(scene);
|
||||
SND_SoundListener* listener = ((SND_Scene*)scene)->GetListener();
|
||||
listener->SetDopplerFactor(dopplerfactor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SetDopplerVelocity(SND_SceneHandle scene, double dopplervelocity)
|
||||
{
|
||||
assert(scene);
|
||||
SND_SoundListener* listener = ((SND_Scene*)scene)->GetListener();
|
||||
listener->SetDopplerVelocity(dopplervelocity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Object instantiation
|
||||
SND_ObjectHandle SND_CreateSound()
|
||||
{
|
||||
return (SND_ObjectHandle)new SND_SoundObject();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_DeleteSound(SND_ObjectHandle object)
|
||||
{
|
||||
assert(object);
|
||||
delete (SND_SoundObject*)object;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Object control
|
||||
void SND_StartSound(SND_SceneHandle scene, SND_ObjectHandle object)
|
||||
{
|
||||
assert(scene);
|
||||
assert(object);
|
||||
((SND_Scene*)scene)->AddActiveObject((SND_SoundObject*)object, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_StopSound(SND_SceneHandle scene, SND_ObjectHandle object)
|
||||
{
|
||||
assert(scene);
|
||||
assert(object);
|
||||
((SND_Scene*)scene)->RemoveActiveObject((SND_SoundObject*)object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_PauseSound(SND_SceneHandle scene, SND_ObjectHandle object)
|
||||
{
|
||||
assert(scene);
|
||||
assert(object);
|
||||
((SND_Scene*)scene)->RemoveActiveObject((SND_SoundObject*)object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SetSampleName(SND_ObjectHandle object, char* samplename)
|
||||
{
|
||||
assert(object);
|
||||
STR_String name = samplename;
|
||||
((SND_SoundObject*)object)->SetSampleName(name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SetGain(SND_ObjectHandle object, double gain)
|
||||
{
|
||||
assert(object);
|
||||
((SND_SoundObject*)object)->SetGain(gain);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SetMinimumGain(SND_ObjectHandle object, double minimumgain)
|
||||
{
|
||||
assert(object);
|
||||
((SND_SoundObject*)object)->SetMinGain(minimumgain);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SetMaximumGain(SND_ObjectHandle object, double maximumgain)
|
||||
{
|
||||
assert(object);
|
||||
((SND_SoundObject*)object)->SetMaxGain(maximumgain);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SetRollOffFactor(SND_ObjectHandle object, double rollofffactor)
|
||||
{
|
||||
assert(object);
|
||||
((SND_SoundObject*)object)->SetRollOffFactor(rollofffactor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SetReferenceDistance(SND_ObjectHandle object, double referencedistance)
|
||||
{
|
||||
assert(object);
|
||||
((SND_SoundObject*)object)->SetReferenceDistance(referencedistance);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SetPitch(SND_ObjectHandle object, double pitch)
|
||||
{
|
||||
assert(object);
|
||||
((SND_SoundObject*)object)->SetPitch(pitch);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SetPosition(SND_ObjectHandle object, double* position)
|
||||
{
|
||||
assert(object);
|
||||
((SND_SoundObject*)object)->SetPosition(position);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SetVelocity(SND_ObjectHandle object, double* velocity)
|
||||
{
|
||||
assert(object);
|
||||
((SND_SoundObject*)object)->SetVelocity(velocity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SetOrientation(SND_ObjectHandle object, double* orientation)
|
||||
{
|
||||
assert(object);
|
||||
((SND_SoundObject*)object)->SetOrientation(orientation);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SetLoopMode(SND_ObjectHandle object, int loopmode)
|
||||
{
|
||||
assert(object);
|
||||
((SND_SoundObject*)object)->SetLoopMode(loopmode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SetLoopPoints(SND_ObjectHandle object, unsigned int loopstart, unsigned int loopend)
|
||||
{
|
||||
assert(object);
|
||||
((SND_SoundObject*)object)->SetLoopStart(loopstart);
|
||||
((SND_SoundObject*)object)->SetLoopEnd(loopend);
|
||||
}
|
||||
|
||||
|
||||
|
||||
float SND_GetGain(SND_ObjectHandle object)
|
||||
{
|
||||
assert(object);
|
||||
MT_Scalar gain = ((SND_SoundObject*)object)->GetGain();
|
||||
return (float) gain;
|
||||
}
|
||||
|
||||
|
||||
|
||||
float SND_GetPitch(SND_ObjectHandle object)
|
||||
{
|
||||
assert(object);
|
||||
MT_Scalar pitch = ((SND_SoundObject*)object)->GetPitch();
|
||||
return (float) pitch;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int SND_GetLoopMode(SND_ObjectHandle object)
|
||||
{
|
||||
assert(object);
|
||||
return ((SND_SoundObject*)object)->GetLoopMode();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int SND_GetPlaystate(SND_ObjectHandle object)
|
||||
{
|
||||
assert(object);
|
||||
return ((SND_SoundObject*)object)->GetPlaystate();
|
||||
}
|
|
@ -1,182 +0,0 @@
|
|||
/*
|
||||
* SND_CDObject.cpp
|
||||
*
|
||||
* Implementation for CD playback
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include "SND_CDObject.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
SND_CDObject* SND_CDObject::m_instance = NULL;
|
||||
|
||||
bool SND_CDObject::CreateSystem()
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
if (!m_instance)
|
||||
{
|
||||
m_instance = new SND_CDObject();
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool SND_CDObject::DisposeSystem()
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
if (m_instance)
|
||||
{
|
||||
delete m_instance;
|
||||
m_instance = NULL;
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
SND_CDObject* SND_CDObject::Instance()
|
||||
{
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
SND_CDObject::SND_CDObject()
|
||||
{
|
||||
m_gain = 1;
|
||||
m_playmode = SND_CD_ALL;
|
||||
m_track = 1;
|
||||
m_playstate = SND_STOPPED;
|
||||
m_used = false;
|
||||
|
||||
// don't set the cd standard on modified:
|
||||
// if not used, we don't wanna touch it (performance)
|
||||
m_modified = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
SND_CDObject::~SND_CDObject()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_CDObject::SetGain(MT_Scalar gain)
|
||||
{
|
||||
m_gain = gain;
|
||||
m_modified = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_CDObject::SetPlaymode(int playmode)
|
||||
{
|
||||
m_playmode = playmode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_CDObject::SetPlaystate(int playstate)
|
||||
{
|
||||
m_playstate = playstate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_CDObject::SetTrack(int track)
|
||||
{
|
||||
m_track = track;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int SND_CDObject::GetTrack() const
|
||||
{
|
||||
return m_track;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MT_Scalar SND_CDObject::GetGain() const
|
||||
{
|
||||
return m_gain;
|
||||
}
|
||||
|
||||
|
||||
int SND_CDObject::GetPlaystate() const
|
||||
{
|
||||
return m_playstate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool SND_CDObject::IsModified() const
|
||||
{
|
||||
return m_modified;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_CDObject::SetModified(bool modified)
|
||||
{
|
||||
m_modified = modified;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int SND_CDObject::GetPlaymode() const
|
||||
{
|
||||
return m_playmode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_CDObject::SetUsed()
|
||||
{
|
||||
m_used = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool SND_CDObject::GetUsed()
|
||||
{
|
||||
return m_used;
|
||||
}
|
||||
|
|
@ -1,126 +0,0 @@
|
|||
/*
|
||||
* SND_DeviceManager.h
|
||||
*
|
||||
* singleton for creating, switching and deleting audiodevices
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "SND_DeviceManager.h"
|
||||
#include "SND_DependKludge.h"
|
||||
#include "SND_DummyDevice.h"
|
||||
#ifdef USE_OPENAL
|
||||
#include "SND_OpenALDevice.h"
|
||||
#endif
|
||||
|
||||
SND_IAudioDevice* SND_DeviceManager::m_instance = NULL;
|
||||
int SND_DeviceManager::m_subscriptions = 0;
|
||||
|
||||
#ifdef USE_OPENAL
|
||||
int SND_DeviceManager::m_device_type = snd_e_openaldevice;
|
||||
#else
|
||||
int SND_DeviceManager::m_device_type = snd_e_dummydevice;
|
||||
#endif
|
||||
|
||||
void SND_DeviceManager::Subscribe()
|
||||
{
|
||||
++m_subscriptions;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_DeviceManager::Unsubscribe()
|
||||
{
|
||||
--m_subscriptions;
|
||||
|
||||
// only release memory if there is a m_instance but no subscriptions left
|
||||
if (m_subscriptions == 0 && m_instance)
|
||||
{
|
||||
delete m_instance;
|
||||
m_instance = NULL;
|
||||
}
|
||||
|
||||
if (m_subscriptions < 0)
|
||||
m_subscriptions = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
SND_IAudioDevice* SND_DeviceManager::Instance()
|
||||
{
|
||||
// only give away an instance if there are subscriptions
|
||||
if (m_subscriptions)
|
||||
{
|
||||
// if there's no instance yet, set and create a new one
|
||||
if (m_instance == NULL)
|
||||
{
|
||||
SetDeviceType(m_device_type);
|
||||
}
|
||||
|
||||
return m_instance;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_DeviceManager::SetDeviceType(int device_type)
|
||||
{
|
||||
// if we want to change devicetype, first delete the old one
|
||||
if (m_instance)
|
||||
{
|
||||
delete m_instance;
|
||||
m_instance = NULL;
|
||||
}
|
||||
|
||||
// let's create the chosen device
|
||||
switch (device_type)
|
||||
{
|
||||
#ifdef USE_OPENAL
|
||||
case snd_e_openaldevice:
|
||||
{
|
||||
m_instance = new SND_OpenALDevice();
|
||||
m_device_type = device_type;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
m_instance = new SND_DummyDevice();
|
||||
m_device_type = device_type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
/*
|
||||
* SND_IdObject.cpp
|
||||
*
|
||||
* Object for storing runtime data, like id's, soundobjects etc
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include "SND_IdObject.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
SND_IdObject::SND_IdObject()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
SND_IdObject::~SND_IdObject()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
SND_SoundObject* SND_IdObject::GetSoundObject()
|
||||
{
|
||||
return m_soundObject;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_IdObject::SetSoundObject(SND_SoundObject* pObject)
|
||||
{
|
||||
m_soundObject = pObject;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int SND_IdObject::GetId()
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_IdObject::SetId(int id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
* SND_IdObject.h
|
||||
*
|
||||
* Object for storing runtime data, like id's, soundobjects etc
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef __SND_IDOBJECT_H
|
||||
#define __SND_IDOBJECT_H
|
||||
|
||||
#include "SND_SoundObject.h"
|
||||
#include "GEN_List.h"
|
||||
#include "SoundDefines.h"
|
||||
|
||||
class SND_IdObject : public GEN_Link
|
||||
{
|
||||
SND_SoundObject* m_soundObject;
|
||||
int m_id;
|
||||
|
||||
public:
|
||||
SND_IdObject();
|
||||
virtual ~SND_IdObject();
|
||||
|
||||
SND_SoundObject* GetSoundObject();
|
||||
void SetSoundObject(SND_SoundObject* pObject);
|
||||
|
||||
int GetId();
|
||||
void SetId(int id);
|
||||
};
|
||||
|
||||
#endif //__SND_OBJECT_H
|
||||
|
|
@ -1,544 +0,0 @@
|
|||
/*
|
||||
* SND_Scene.cpp
|
||||
*
|
||||
* The scene for sounds.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning (disable:4786) // Get rid of stupid stl-visual compiler debug warning
|
||||
#endif //WIN32
|
||||
|
||||
#include "SND_Scene.h"
|
||||
#include "SND_DependKludge.h"
|
||||
#include "SND_IAudioDevice.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
|
||||
//static unsigned int tijd = 0;
|
||||
|
||||
SND_Scene::SND_Scene(SND_IAudioDevice* audiodevice)
|
||||
: m_audiodevice(audiodevice)
|
||||
{
|
||||
if (m_audiodevice)
|
||||
m_wavecache = m_audiodevice->GetWaveCache();
|
||||
|
||||
if (!m_wavecache || !audiodevice)
|
||||
{
|
||||
m_audio = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//if so, go ahead!
|
||||
m_audio = true;
|
||||
#ifdef ONTKEVER
|
||||
printf("SND_Scene::SND_Scene() m_audio == true\n");
|
||||
#endif
|
||||
m_audiodevice->InitListener();
|
||||
}
|
||||
|
||||
IsPlaybackWanted();
|
||||
}
|
||||
|
||||
|
||||
|
||||
SND_Scene::~SND_Scene()
|
||||
{
|
||||
StopAllObjects();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// check if audioplayback is wanted
|
||||
bool SND_Scene::IsPlaybackWanted()
|
||||
{
|
||||
/* Removed the functionality for checking if noaudio was provided on */
|
||||
/* the commandline. */
|
||||
if (m_audiodevice && m_wavecache)
|
||||
{
|
||||
m_audioplayback = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
StopAllObjects();
|
||||
m_audioplayback = false;
|
||||
}
|
||||
|
||||
return m_audioplayback;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int SND_Scene::LoadSample(const STR_String& samplename,
|
||||
void* memlocation,
|
||||
int size)
|
||||
{
|
||||
int result = -1;
|
||||
|
||||
if (m_audiodevice)
|
||||
{
|
||||
SND_WaveSlot* waveslot = m_audiodevice->LoadSample(samplename, memlocation, size);
|
||||
|
||||
if (waveslot)
|
||||
result = waveslot->GetBuffer();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_Scene::RemoveAllSamples()
|
||||
{
|
||||
if (m_audio && m_audiodevice)
|
||||
m_audiodevice->RemoveAllSamples();
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool SND_Scene::CheckBuffer(SND_SoundObject* pObject)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
if (pObject && m_wavecache)
|
||||
{
|
||||
SND_WaveSlot* waveslot = m_wavecache->GetWaveSlot(pObject->GetSampleName());
|
||||
|
||||
if (waveslot)
|
||||
{
|
||||
pObject->SetBuffer(waveslot->GetBuffer());
|
||||
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool SND_Scene::IsSampleLoaded(STR_String& samplename)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
if (samplename && m_wavecache)
|
||||
{
|
||||
SND_WaveSlot* waveslot = m_wavecache->GetWaveSlot(samplename);
|
||||
|
||||
if (waveslot && waveslot->IsLoaded())
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_Scene::AddObject(SND_SoundObject* pObject)
|
||||
{
|
||||
if (m_audio)
|
||||
{
|
||||
STR_String samplename = pObject->GetSampleName();
|
||||
SND_WaveSlot* slot = NULL;
|
||||
|
||||
// don't add the object if no valid sample is referenced
|
||||
if (samplename != "")
|
||||
{
|
||||
// check if the sample is already loaded
|
||||
slot = m_wavecache->GetWaveSlot(samplename);
|
||||
}
|
||||
|
||||
if (slot)
|
||||
{
|
||||
pObject->SetBuffer(slot->GetBuffer());
|
||||
|
||||
// needed for expected lifespan of the sample, but ain't necesary anymore i think
|
||||
MT_Scalar samplelength = slot->GetNumberOfSamples();
|
||||
MT_Scalar samplerate = slot->GetSampleRate();
|
||||
MT_Scalar soundlength = samplelength/samplerate;
|
||||
pObject->SetLength(soundlength);
|
||||
|
||||
// add the object to the list
|
||||
m_soundobjects.insert((SND_SoundObject*)pObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_Scene::SetListenerTransform(const MT_Vector3& pos,
|
||||
const MT_Vector3& vel,
|
||||
const MT_Matrix3x3& ori)
|
||||
{
|
||||
if (m_audio)
|
||||
{
|
||||
GetListener()->SetPosition(pos);
|
||||
GetListener()->SetVelocity(vel);
|
||||
GetListener()->SetOrientation(ori);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_Scene::UpdateListener()
|
||||
{
|
||||
// process the listener if modified
|
||||
if (m_listener.IsModified())
|
||||
{
|
||||
m_audiodevice->SetListenerGain(m_listener.GetGain());
|
||||
m_audiodevice->SetDopplerVelocity(m_listener.GetDopplerVelocity());
|
||||
m_audiodevice->SetDopplerFactor(m_listener.GetDopplerFactor());
|
||||
m_listener.SetModified(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_Scene::AddActiveObject(SND_SoundObject* pObject, MT_Scalar curtime)
|
||||
{
|
||||
if (m_audio)
|
||||
{
|
||||
if (pObject)
|
||||
{
|
||||
#ifdef ONTKEVER
|
||||
printf("SND_Scene::AddActiveObject\n");
|
||||
#endif
|
||||
|
||||
// first check if the object is already on the list
|
||||
if (pObject->IsActive())
|
||||
{
|
||||
pObject->SetTimeStamp(curtime);
|
||||
pObject->StartSound();
|
||||
}
|
||||
else
|
||||
{
|
||||
pObject->SetTimeStamp(curtime);
|
||||
|
||||
// compute the expected lifespan
|
||||
pObject->SetLifeSpan();
|
||||
|
||||
// lets give the new active-to-be object an id
|
||||
if (m_audiodevice->GetNewId(pObject))
|
||||
{
|
||||
// and add the object
|
||||
m_activeobjects.addTail(pObject);
|
||||
pObject->StartSound();
|
||||
pObject->SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_Scene::RemoveActiveObject(SND_SoundObject* pObject)
|
||||
{
|
||||
if (m_audio)
|
||||
{
|
||||
if (pObject)
|
||||
{
|
||||
#ifdef ONTKEVER
|
||||
printf("SND_Scene::RemoveActiveObject\n");
|
||||
#endif
|
||||
// if inactive, remove it from the list
|
||||
if (pObject->IsActive())
|
||||
{
|
||||
// first make sure it is stopped
|
||||
m_audiodevice->ClearId(pObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_Scene::UpdateActiveObects()
|
||||
{
|
||||
// ++tijd;
|
||||
|
||||
SND_SoundObject* pObject;
|
||||
// update only the objects that need to be updated
|
||||
for (pObject = (SND_SoundObject*)m_activeobjects.getHead();
|
||||
!pObject->isTail();
|
||||
pObject = (SND_SoundObject*)pObject->getNext())
|
||||
{
|
||||
int id = pObject->GetId();
|
||||
|
||||
if (id >= 0)
|
||||
{
|
||||
if (pObject->Is3D())
|
||||
{
|
||||
// Get the global positions and velocity vectors
|
||||
// of the listener and soundobject
|
||||
MT_Vector3 op = pObject->GetPosition();
|
||||
MT_Vector3 lp = m_listener.GetPosition();
|
||||
MT_Vector3 position = op - lp;
|
||||
|
||||
// Calculate relative velocity in global coordinates
|
||||
// of the sound with respect to the listener.
|
||||
MT_Vector3 ov = pObject->GetVelocity();
|
||||
MT_Vector3 lv = m_listener.GetVelocity();
|
||||
MT_Vector3 velocity = ov - lv;
|
||||
|
||||
// Now map the object position and velocity into
|
||||
// the local coordinates of the listener.
|
||||
MT_Matrix3x3 lo = m_listener.GetOrientation();
|
||||
|
||||
MT_Vector3 local_sound_pos = position * lo;
|
||||
MT_Vector3 local_sound_vel = velocity * lo;
|
||||
|
||||
m_audiodevice->SetObjectTransform(
|
||||
id,
|
||||
local_sound_pos,
|
||||
local_sound_vel,
|
||||
pObject->GetOrientation(), // make relative to listener!
|
||||
lp,
|
||||
pObject->GetRollOffFactor());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_audiodevice->ObjectIs2D(id);
|
||||
}
|
||||
|
||||
// update the situation
|
||||
if (pObject->IsModified())
|
||||
{
|
||||
m_audiodevice->SetObjectPitch(id, pObject->GetPitch());
|
||||
m_audiodevice->SetObjectGain(id, pObject->GetGain());
|
||||
m_audiodevice->SetObjectMinGain(id, pObject->GetMinGain());
|
||||
m_audiodevice->SetObjectMaxGain(id, pObject->GetMaxGain());
|
||||
m_audiodevice->SetObjectReferenceDistance(id, pObject->GetReferenceDistance());
|
||||
m_audiodevice->SetObjectRollOffFactor(id, pObject->GetRollOffFactor());
|
||||
m_audiodevice->SetObjectLoop(id, pObject->GetLoopMode());
|
||||
m_audiodevice->SetObjectLoopPoints(id, pObject->GetLoopStart(), pObject->GetLoopEnd());
|
||||
pObject->SetModified(false);
|
||||
}
|
||||
|
||||
pObject->AddRunning();
|
||||
|
||||
#ifdef ONTKEVER
|
||||
STR_String naam = pObject->GetObjectName();
|
||||
STR_String sample = pObject->GetSampleName();
|
||||
|
||||
int id = pObject->GetId();
|
||||
int buffer = pObject->GetBuffer();
|
||||
|
||||
float gain = pObject->GetGain();
|
||||
float pitch = pObject->GetPitch();
|
||||
float timestamp = pObject->GetTimestamp();
|
||||
|
||||
printf("naam: %s, sample: %s \n", naam.Ptr(), sample.Ptr());
|
||||
printf("id: %d, buffer: %d \n", id, buffer);
|
||||
printf("gain: %f, pitch: %f, ts: %f \n\n", gain, pitch, timestamp);
|
||||
#endif
|
||||
#ifdef USE_OPENAL
|
||||
// ok, properties Set. now see if it must play
|
||||
switch (pObject->GetPlaystate()){
|
||||
case SND_MUST_PLAY:
|
||||
m_audiodevice->PlayObject(id);
|
||||
pObject->SetPlaystate(SND_PLAYING);
|
||||
break;
|
||||
case SND_MUST_STOP:
|
||||
RemoveActiveObject(pObject);
|
||||
break;
|
||||
case SND_MUST_PAUSE:
|
||||
m_audiodevice->PauseObject(id);
|
||||
pObject->SetPlaystate(SND_PAUSED);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
// check to see if the sound is still playing
|
||||
// if not: release its id
|
||||
int playstate = m_audiodevice->GetPlayState(id);
|
||||
#ifdef ONTKEVER
|
||||
if (playstate != 2)
|
||||
printf("%d - ",playstate);
|
||||
#endif
|
||||
|
||||
if ((playstate == SND_STOPPED) && !pObject->GetLoopMode())
|
||||
{
|
||||
RemoveActiveObject(pObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_Scene::UpdateCD()
|
||||
{
|
||||
if (m_audiodevice)
|
||||
{
|
||||
SND_CDObject* pCD = SND_CDObject::Instance();
|
||||
|
||||
if (pCD)
|
||||
{
|
||||
int playstate = pCD->GetPlaystate();
|
||||
|
||||
switch (playstate)
|
||||
{
|
||||
case SND_MUST_PLAY:
|
||||
{
|
||||
// initialize the cd only when you need it
|
||||
m_audiodevice->SetCDGain(pCD->GetGain());
|
||||
m_audiodevice->SetCDPlaymode(pCD->GetPlaymode());
|
||||
m_audiodevice->PlayCD(pCD->GetTrack());
|
||||
pCD->SetPlaystate(SND_PLAYING);
|
||||
pCD->SetUsed();
|
||||
break;
|
||||
}
|
||||
case SND_MUST_PAUSE:
|
||||
{
|
||||
m_audiodevice->PauseCD(true);
|
||||
pCD->SetPlaystate(SND_PAUSED);
|
||||
break;
|
||||
}
|
||||
case SND_MUST_RESUME:
|
||||
{
|
||||
m_audiodevice->PauseCD(false);
|
||||
pCD->SetPlaystate(SND_PLAYING);
|
||||
break;
|
||||
}
|
||||
case SND_MUST_STOP:
|
||||
{
|
||||
m_audiodevice->StopCD();
|
||||
pCD->SetPlaystate(SND_STOPPED);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// this one is only for realtime modifying settings
|
||||
if (pCD->IsModified())
|
||||
{
|
||||
m_audiodevice->SetCDGain(pCD->GetGain());
|
||||
pCD->SetModified(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_Scene::Proceed()
|
||||
{
|
||||
if (m_audio && m_audioplayback)
|
||||
{
|
||||
m_audiodevice->MakeCurrent();
|
||||
|
||||
UpdateListener();
|
||||
UpdateActiveObects();
|
||||
UpdateCD();
|
||||
|
||||
// m_audiodevice->UpdateDevice();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SND_Scene::DeleteObject(SND_SoundObject* pObject)
|
||||
{
|
||||
#ifdef ONTKEVER
|
||||
printf("SND_Scene::DeleteObject\n");
|
||||
#endif
|
||||
|
||||
if (pObject)
|
||||
{
|
||||
if (m_audiodevice)
|
||||
m_audiodevice->ClearId(pObject);
|
||||
|
||||
// must remove object from m_activeList
|
||||
std::set<SND_SoundObject*>::iterator set_it;
|
||||
set_it = m_soundobjects.find(pObject);
|
||||
|
||||
if (set_it != m_soundobjects.end())
|
||||
m_soundobjects.erase(set_it);
|
||||
|
||||
// release the memory
|
||||
delete pObject;
|
||||
pObject = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_Scene::RemoveAllObjects()
|
||||
{
|
||||
#ifdef ONTKEVER
|
||||
printf("SND_Scene::RemoveAllObjects\n");
|
||||
#endif
|
||||
|
||||
StopAllObjects();
|
||||
|
||||
std::set<SND_SoundObject*>::iterator it = m_soundobjects.begin();
|
||||
|
||||
while (it != m_soundobjects.end())
|
||||
{
|
||||
delete (*it);
|
||||
it++;
|
||||
}
|
||||
|
||||
m_soundobjects.clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_Scene::StopAllObjects()
|
||||
{
|
||||
if (m_audio)
|
||||
{
|
||||
#ifdef ONTKEVER
|
||||
printf("SND_Scene::StopAllObjects\n");
|
||||
#endif
|
||||
|
||||
SND_SoundObject* pObject;
|
||||
|
||||
for (pObject = (SND_SoundObject*)m_activeobjects.getHead();
|
||||
!pObject->isTail();
|
||||
pObject = (SND_SoundObject*)pObject->getNext())
|
||||
{
|
||||
m_audiodevice->ClearId(pObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
SND_SoundListener* SND_Scene::GetListener()
|
||||
{
|
||||
return &m_listener;
|
||||
}
|
|
@ -1,185 +0,0 @@
|
|||
/*
|
||||
* SND_SoundListener.cpp
|
||||
*
|
||||
* A SoundListener is for sound what a camera is for vision.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include "SND_SoundListener.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
SND_SoundListener::SND_SoundListener()
|
||||
{
|
||||
m_modified = true;
|
||||
m_gain = 1.0;
|
||||
m_dopplerfactor = 1.0;
|
||||
m_dopplervelocity = 1.0;
|
||||
m_scale = 1.0;
|
||||
m_position[0] = 0.0;
|
||||
m_position[1] = 0.0;
|
||||
m_position[2] = 0.0;
|
||||
m_velocity[0] = 0.0;
|
||||
m_velocity[1] = 0.0;
|
||||
m_velocity[2] = 0.0;
|
||||
m_orientation[0][0] = 1.0;
|
||||
m_orientation[0][1] = 0.0;
|
||||
m_orientation[0][2] = 0.0;
|
||||
m_orientation[1][0] = 0.0;
|
||||
m_orientation[1][1] = 1.0;
|
||||
m_orientation[1][2] = 0.0;
|
||||
m_orientation[2][0] = 0.0;
|
||||
m_orientation[2][1] = 0.0;
|
||||
m_orientation[2][2] = 1.0;
|
||||
}
|
||||
|
||||
|
||||
SND_SoundListener::~SND_SoundListener()
|
||||
{
|
||||
; /* intentionally empty */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundListener::SetGain(MT_Scalar gain)
|
||||
{
|
||||
m_gain = gain;
|
||||
m_modified = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundListener::SetPosition (const MT_Vector3& pos)
|
||||
{
|
||||
m_position = pos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundListener::SetVelocity(const MT_Vector3& vel)
|
||||
{
|
||||
m_velocity = vel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundListener::SetOrientation(const MT_Matrix3x3& ori)
|
||||
{
|
||||
m_orientation = ori;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundListener::SetDopplerFactor(MT_Scalar dopplerfactor)
|
||||
{
|
||||
m_dopplerfactor = dopplerfactor;
|
||||
m_modified = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundListener::SetDopplerVelocity(MT_Scalar dopplervelocity)
|
||||
{
|
||||
m_dopplervelocity = dopplervelocity;
|
||||
m_modified = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundListener::SetScale(MT_Scalar scale)
|
||||
{
|
||||
m_scale = scale;
|
||||
m_modified = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MT_Scalar SND_SoundListener::GetGain() const
|
||||
{
|
||||
return m_gain;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MT_Vector3 SND_SoundListener::GetPosition() const
|
||||
{
|
||||
return m_position;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MT_Vector3 SND_SoundListener::GetVelocity() const
|
||||
{
|
||||
return m_velocity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MT_Matrix3x3 SND_SoundListener::GetOrientation()
|
||||
{
|
||||
return m_orientation;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MT_Scalar SND_SoundListener::GetDopplerFactor() const
|
||||
{
|
||||
return m_dopplerfactor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MT_Scalar SND_SoundListener::GetDopplerVelocity() const
|
||||
{
|
||||
return m_dopplervelocity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MT_Scalar SND_SoundListener::GetScale() const
|
||||
{
|
||||
return m_scale;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool SND_SoundListener::IsModified() const
|
||||
{
|
||||
return m_modified;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundListener::SetModified(bool modified)
|
||||
{
|
||||
m_modified = modified;
|
||||
}
|
|
@ -1,508 +0,0 @@
|
|||
/*
|
||||
* SND_SoundObject.cpp
|
||||
*
|
||||
* Implementation of the abstract sound object
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include "SND_SoundObject.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
SND_SoundObject::SND_SoundObject()// : m_modified(true)
|
||||
{
|
||||
m_samplename = "";
|
||||
m_length = 0;
|
||||
m_buffer = 0;
|
||||
|
||||
m_gain = 0.0;
|
||||
m_pitch = 1.0;
|
||||
|
||||
m_mingain = 0.0;
|
||||
m_maxgain = 1.0;
|
||||
m_rollofffactor = 1.0;
|
||||
m_referencedistance = 1.0;
|
||||
|
||||
m_position[0] = 0.0;
|
||||
m_position[1] = 0.0;
|
||||
m_position[2] = 0.0;
|
||||
m_velocity[0] = 0.0;
|
||||
m_velocity[1] = 0.0;
|
||||
m_velocity[2] = 0.0;
|
||||
m_orientation[0][0] = 1.0;
|
||||
m_orientation[0][1] = 0.0;
|
||||
m_orientation[0][2] = 0.0;
|
||||
m_orientation[1][0] = 0.0;
|
||||
m_orientation[1][1] = 1.0;
|
||||
m_orientation[1][2] = 0.0;
|
||||
m_orientation[2][0] = 0.0;
|
||||
m_orientation[2][1] = 0.0;
|
||||
m_orientation[2][2] = 1.0;
|
||||
|
||||
m_loopstart = 0;
|
||||
m_loopend = 0;
|
||||
m_loopmode = SND_LOOP_NORMAL;
|
||||
m_is3d = true;
|
||||
m_playstate = SND_INITIAL;
|
||||
m_active = false;
|
||||
m_id = -1;
|
||||
m_lifespan = 0;
|
||||
m_timestamp = 0;
|
||||
m_modified = true;
|
||||
m_running = 0;
|
||||
m_highpriority = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
SND_SoundObject::~SND_SoundObject()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::StartSound()
|
||||
{
|
||||
if (m_id >= 0)
|
||||
m_playstate = SND_MUST_PLAY;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::StopSound()
|
||||
{
|
||||
if (m_id >= 0)
|
||||
m_playstate = SND_MUST_STOP;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::PauseSound()
|
||||
{
|
||||
if (m_id >= 0)
|
||||
m_playstate = SND_MUST_PAUSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::DeleteWhenFinished()
|
||||
{
|
||||
m_playstate = SND_MUST_BE_DELETED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetGain(MT_Scalar gain)
|
||||
{
|
||||
m_gain = gain;
|
||||
m_modified = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetMinGain(MT_Scalar mingain)
|
||||
{
|
||||
m_mingain = mingain;
|
||||
m_modified = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetMaxGain(MT_Scalar maxgain)
|
||||
{
|
||||
m_maxgain = maxgain;
|
||||
m_modified = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetRollOffFactor(MT_Scalar rollofffactor)
|
||||
{
|
||||
m_rollofffactor = rollofffactor;
|
||||
m_modified = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetReferenceDistance(MT_Scalar referencedistance)
|
||||
{
|
||||
m_referencedistance = referencedistance;
|
||||
m_modified = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetPitch(MT_Scalar pitch)
|
||||
{
|
||||
m_pitch = pitch;
|
||||
m_modified = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetLoopMode(unsigned int loopmode)
|
||||
{
|
||||
m_loopmode = loopmode;
|
||||
m_modified = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetLoopStart(unsigned int loopstart)
|
||||
{
|
||||
m_loopstart = loopstart;
|
||||
m_modified = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetLoopEnd(unsigned int loopend)
|
||||
{
|
||||
m_loopend = loopend;
|
||||
m_modified = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::Set3D(bool threedee)
|
||||
{
|
||||
m_is3d = threedee;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetLifeSpan()
|
||||
{
|
||||
m_lifespan = m_length / m_pitch;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool SND_SoundObject::IsLifeSpanOver(MT_Scalar curtime) const
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
if ((curtime - m_timestamp) > m_lifespan)
|
||||
result = true;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetActive(bool active)
|
||||
{
|
||||
m_active = active;
|
||||
|
||||
if (!active)
|
||||
{
|
||||
m_playstate = SND_STOPPED;
|
||||
(this)->remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetBuffer(unsigned int buffer)
|
||||
{
|
||||
m_buffer = buffer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetObjectName(STR_String objectname)
|
||||
{
|
||||
m_objectname = objectname;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetSampleName(STR_String samplename)
|
||||
{
|
||||
m_samplename = samplename;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetLength(MT_Scalar length)
|
||||
{
|
||||
m_length = length;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetPosition(const MT_Vector3& pos)
|
||||
{
|
||||
m_position = pos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetVelocity(const MT_Vector3& vel)
|
||||
{
|
||||
m_velocity = vel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetOrientation(const MT_Matrix3x3& orient)
|
||||
{
|
||||
m_orientation = orient;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetPlaystate(int playstate)
|
||||
{
|
||||
m_playstate = playstate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetId(int id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetTimeStamp(MT_Scalar timestamp)
|
||||
{
|
||||
m_timestamp = timestamp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetHighPriority(bool priority)
|
||||
{
|
||||
m_highpriority = priority;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool SND_SoundObject::IsHighPriority() const
|
||||
{
|
||||
return m_highpriority;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool SND_SoundObject::IsActive()const
|
||||
{
|
||||
return m_active;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int SND_SoundObject::GetId()const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MT_Scalar SND_SoundObject::GetLifeSpan()const
|
||||
{
|
||||
return m_lifespan;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MT_Scalar SND_SoundObject::GetTimestamp()const
|
||||
{
|
||||
return m_timestamp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned int SND_SoundObject::GetBuffer()
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const STR_String& SND_SoundObject::GetSampleName()
|
||||
{
|
||||
return m_samplename;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const STR_String& SND_SoundObject::GetObjectName()
|
||||
{
|
||||
return m_objectname;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MT_Scalar SND_SoundObject::GetLength() const
|
||||
{
|
||||
return m_length;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MT_Scalar SND_SoundObject::GetGain() const
|
||||
{
|
||||
return m_gain;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MT_Scalar SND_SoundObject::GetPitch() const
|
||||
{
|
||||
return m_pitch;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MT_Scalar SND_SoundObject::GetMinGain() const
|
||||
{
|
||||
return m_mingain;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MT_Scalar SND_SoundObject::GetMaxGain() const
|
||||
{
|
||||
return m_maxgain;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MT_Scalar SND_SoundObject::GetRollOffFactor() const
|
||||
{
|
||||
return m_rollofffactor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MT_Scalar SND_SoundObject::GetReferenceDistance() const
|
||||
{
|
||||
return m_referencedistance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MT_Vector3 SND_SoundObject::GetPosition() const
|
||||
{
|
||||
return m_position;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MT_Vector3 SND_SoundObject::GetVelocity() const
|
||||
{
|
||||
return m_velocity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MT_Matrix3x3 SND_SoundObject::GetOrientation() const
|
||||
{
|
||||
return m_orientation;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned int SND_SoundObject::GetLoopMode() const
|
||||
{
|
||||
return m_loopmode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned int SND_SoundObject::GetLoopStart() const
|
||||
{
|
||||
return m_loopstart;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned int SND_SoundObject::GetLoopEnd() const
|
||||
{
|
||||
return m_loopend;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool SND_SoundObject::Is3D() const
|
||||
{
|
||||
return m_is3d;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int SND_SoundObject::GetPlaystate() const
|
||||
{
|
||||
return m_playstate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool SND_SoundObject::IsModified() const
|
||||
{
|
||||
return m_modified;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::SetModified(bool modified)
|
||||
{
|
||||
m_modified = modified;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::InitRunning()
|
||||
{
|
||||
m_running = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool SND_SoundObject::IsRunning() const
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
if (m_running > 100)
|
||||
result = true;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_SoundObject::AddRunning()
|
||||
{
|
||||
++m_running;
|
||||
}
|
|
@ -1,424 +0,0 @@
|
|||
/*
|
||||
* SND_Utils.cpp
|
||||
*
|
||||
* Util functions for soundthingies
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include "SND_Utils.h"
|
||||
#include "SoundDefines.h"
|
||||
#include "SND_DependKludge.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <io.h>
|
||||
#define open _open
|
||||
#define read _read
|
||||
#define close _close
|
||||
#define write _write
|
||||
#define lseek _lseek
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#define BUFFERSIZE 32
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Begin of temporary Endian stuff.
|
||||
* I think there should be a central place to handle endian conversion but for
|
||||
* the time being it suffices. Note that the defines come from the Blender
|
||||
* source.
|
||||
*****************************************************************************/
|
||||
typedef enum
|
||||
{
|
||||
SND_endianBig = 0,
|
||||
SND_endianLittle
|
||||
} SND_TEndian;
|
||||
|
||||
#if defined(__BIG_ENDIAN__) || defined(__sparc) || defined(__sparc__)
|
||||
const SND_TEndian SND_fEndian = SND_endianBig;
|
||||
#else
|
||||
const SND_TEndian SND_fEndian = SND_endianLittle;
|
||||
#endif
|
||||
|
||||
/* This one swaps the bytes in a short */
|
||||
#define SWITCH_SHORT(a) { \
|
||||
char s_i, *p_i; \
|
||||
p_i= (char *)&(a); \
|
||||
s_i=p_i[0]; \
|
||||
p_i[0] = p_i[1]; \
|
||||
p_i[1] = s_i; }
|
||||
|
||||
/* This one rotates the bytes in an int */
|
||||
#define SWITCH_INT(a) { \
|
||||
char s_i, *p_i; \
|
||||
p_i= (char *)&(a); \
|
||||
s_i=p_i[0]; p_i[0]=p_i[3]; p_i[3]=s_i; \
|
||||
s_i=p_i[1]; p_i[1]=p_i[2]; p_i[2]=s_i; }
|
||||
/*****************************************************************************
|
||||
* End of temporary Endian stuff.
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/* loads a file */
|
||||
void* SND_LoadSample(char *filename)
|
||||
{
|
||||
int file, filelen, buffersize = BUFFERSIZE;
|
||||
void* data = NULL;
|
||||
|
||||
#if defined(WIN32)
|
||||
file = open(filename, O_BINARY|O_RDONLY);
|
||||
#else
|
||||
file = open(filename, 0|O_RDONLY);
|
||||
#endif
|
||||
|
||||
if (file == -1)
|
||||
{
|
||||
//printf("can't open file.\n");
|
||||
//printf("press q for quit.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
filelen = lseek(file, 0, SEEK_END);
|
||||
lseek(file, 0, SEEK_SET);
|
||||
|
||||
if (filelen != 0)
|
||||
{
|
||||
data = malloc(buffersize);
|
||||
|
||||
if (read(file, data, buffersize) != buffersize)
|
||||
{
|
||||
free(data);
|
||||
data = NULL;
|
||||
}
|
||||
}
|
||||
close(file);
|
||||
|
||||
}
|
||||
return (data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool SND_IsSampleValid(const STR_String& name, void* memlocation)
|
||||
{
|
||||
bool result = false;
|
||||
bool loadedsample = false;
|
||||
char buffer[BUFFERSIZE];
|
||||
|
||||
if (!memlocation)
|
||||
{
|
||||
STR_String samplename = name;
|
||||
memlocation = SND_LoadSample(samplename.Ptr());
|
||||
|
||||
if (memlocation)
|
||||
loadedsample = true;
|
||||
}
|
||||
|
||||
if (memlocation)
|
||||
{
|
||||
memcpy(&buffer, memlocation, BUFFERSIZE);
|
||||
|
||||
if(!(memcmp(buffer, "RIFF", 4) && memcmp(&(buffer[8]), "WAVEfmt ", 8)))
|
||||
{
|
||||
/* This was endian unsafe. See top of the file for the define. */
|
||||
short shortbuf = *((short *) &buffer[20]);
|
||||
if (SND_fEndian == SND_endianBig) SWITCH_SHORT(shortbuf);
|
||||
|
||||
if (shortbuf == SND_WAVE_FORMAT_PCM)
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
if (loadedsample)
|
||||
{
|
||||
free(memlocation);
|
||||
memlocation = NULL;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* checks if the passed pointer is a valid sample */
|
||||
static bool CheckSample(void* sample)
|
||||
{
|
||||
bool valid = false;
|
||||
char buffer[32];
|
||||
|
||||
memcpy(buffer, sample, 16);
|
||||
|
||||
if(!(memcmp(buffer, "RIFF", 4) && memcmp(&(buffer[8]), "WAVEfmt ", 8)))
|
||||
{
|
||||
valid = true;
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* gets the type of the sample (0 == unknown, 1 == PCM etc */
|
||||
unsigned int SND_GetSampleFormat(void* sample)
|
||||
{
|
||||
short sampletype = 0;
|
||||
|
||||
if (CheckSample(sample))
|
||||
{
|
||||
memcpy(&sampletype, ((char*)sample) + 20, 2);
|
||||
}
|
||||
/* This was endian unsafe. See top of the file for the define. */
|
||||
if (SND_fEndian == SND_endianBig) SWITCH_SHORT(sampletype);
|
||||
|
||||
return (unsigned int)sampletype;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* gets the number of channels in a sample */
|
||||
unsigned int SND_GetNumberOfChannels(void* sample)
|
||||
{
|
||||
short numberofchannels = 0;
|
||||
|
||||
if (CheckSample(sample))
|
||||
{
|
||||
memcpy(&numberofchannels, ((char*)sample) + 22, 2);
|
||||
}
|
||||
/* This was endian unsafe. See top of the file for the define. */
|
||||
if (SND_fEndian == SND_endianBig) SWITCH_SHORT(numberofchannels);
|
||||
|
||||
return (unsigned int)numberofchannels;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* gets the samplerate of a sample */
|
||||
unsigned int SND_GetSampleRate(void* sample)
|
||||
{
|
||||
unsigned int samplerate = 0;
|
||||
|
||||
if (CheckSample(sample))
|
||||
{
|
||||
memcpy(&samplerate, ((char*)sample) + 24, 4);
|
||||
}
|
||||
/* This was endian unsafe. See top of the file for the define. */
|
||||
if (SND_fEndian == SND_endianBig) SWITCH_INT(samplerate);
|
||||
|
||||
return samplerate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* gets the bitrate of a sample */
|
||||
unsigned int SND_GetBitRate(void* sample)
|
||||
{
|
||||
short bitrate = 0;
|
||||
|
||||
if (CheckSample(sample))
|
||||
{
|
||||
memcpy(&bitrate, ((char*)sample) + 34, 2);
|
||||
}
|
||||
/* This was endian unsafe. See top of the file for the define. */
|
||||
if (SND_fEndian == SND_endianBig) SWITCH_SHORT(bitrate);
|
||||
|
||||
return (unsigned int)bitrate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* gets the length of the actual sample data (without the header) */
|
||||
unsigned int SND_GetNumberOfSamples(void* sample, unsigned int sample_length)
|
||||
{
|
||||
unsigned int chunklength, length = 0, offset;
|
||||
unsigned short block_align;
|
||||
if (CheckSample(sample))
|
||||
{
|
||||
memcpy(&chunklength, ((char*)sample) + 16, 4);
|
||||
memcpy(&block_align, ((char*)sample) + 32, 2); /* always 2 or 4 it seems */
|
||||
|
||||
/* This was endian unsafe. See top of the file for the define. */
|
||||
if (SND_fEndian == SND_endianBig)
|
||||
{
|
||||
SWITCH_INT(chunklength);
|
||||
SWITCH_SHORT(block_align);
|
||||
}
|
||||
|
||||
offset = 16 + chunklength + 4;
|
||||
|
||||
/* This seems very unsafe, what if data is never found (f.i. corrupt file)... */
|
||||
// lets find "data"
|
||||
while (memcmp(((char*)sample) + offset, "data", 4))
|
||||
{
|
||||
offset += block_align;
|
||||
|
||||
if (offset+block_align > sample_length) /* save us from crashing */
|
||||
return 0;
|
||||
}
|
||||
offset += 4;
|
||||
memcpy(&length, ((char*)sample) + offset, 4);
|
||||
|
||||
/* This was endian unsafe. See top of the file for the define. */
|
||||
if (SND_fEndian == SND_endianBig) SWITCH_INT(length);
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* gets the size of the entire header (file - sampledata) */
|
||||
unsigned int SND_GetHeaderSize(void* sample, unsigned int sample_length)
|
||||
{
|
||||
unsigned int chunklength, headersize = 0, offset = 16;
|
||||
unsigned short block_align;
|
||||
if (CheckSample(sample))
|
||||
{
|
||||
memcpy(&chunklength, ((char*)sample) + offset, 4);
|
||||
memcpy(&block_align, ((char*)sample) + 32, 2); /* always 2 or 4 it seems */
|
||||
|
||||
/* This was endian unsafe. See top of the file for the define. */
|
||||
if (SND_fEndian == SND_endianBig)
|
||||
{
|
||||
SWITCH_INT(chunklength);
|
||||
SWITCH_SHORT(block_align);
|
||||
}
|
||||
offset = offset + chunklength + 4;
|
||||
|
||||
// lets find "data"
|
||||
while (memcmp(((char*)sample) + offset, "data", 4))
|
||||
{
|
||||
offset += block_align;
|
||||
|
||||
if (offset+block_align > sample_length) /* save us from crashing */
|
||||
return 0;
|
||||
}
|
||||
headersize = offset + 8;
|
||||
}
|
||||
|
||||
return headersize;
|
||||
}
|
||||
|
||||
|
||||
unsigned int SND_GetExtraChunk(void* sample)
|
||||
{
|
||||
unsigned int extrachunk = 0, chunklength, offset = 16;
|
||||
char data[4];
|
||||
|
||||
if (CheckSample(sample))
|
||||
{
|
||||
memcpy(&chunklength, ((char*)sample) + offset, 4);
|
||||
offset = offset + chunklength + 4;
|
||||
memcpy(data, ((char*)sample) + offset, 4);
|
||||
|
||||
// lets find "cue"
|
||||
while (memcmp(data, "cue", 3))
|
||||
{
|
||||
offset += 4;
|
||||
memcpy(data, ((char*)sample) + offset, 4);
|
||||
}
|
||||
}
|
||||
|
||||
return extrachunk;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_GetSampleInfo(signed char* sample, SND_WaveSlot* waveslot)
|
||||
{
|
||||
WavFileHeader fileheader;
|
||||
WavFmtHeader fmtheader;
|
||||
WavFmtExHeader fmtexheader;
|
||||
WavSampleHeader sampleheader;
|
||||
WavChunkHeader chunkheader;
|
||||
|
||||
if (CheckSample(sample))
|
||||
{
|
||||
memcpy(&fileheader, sample, sizeof(WavFileHeader));
|
||||
fileheader.size = SND_GetHeaderSize(sample, waveslot->GetFileSize());
|
||||
if (fileheader.size) { /* this may fail for corrupt files */
|
||||
sample += sizeof(WavFileHeader);
|
||||
fileheader.size = ((fileheader.size+1) & ~1) - 4;
|
||||
|
||||
while ((fileheader.size > 0) && (memcpy(&chunkheader, sample, sizeof(WavChunkHeader))))
|
||||
{
|
||||
sample += sizeof(WavChunkHeader);
|
||||
if (!memcmp(chunkheader.id, "fmt ", 4))
|
||||
{
|
||||
memcpy(&fmtheader, sample, sizeof(WavFmtHeader));
|
||||
waveslot->SetSampleFormat(fmtheader.format);
|
||||
|
||||
if (fmtheader.format == 0x0001)
|
||||
{
|
||||
waveslot->SetNumberOfChannels(fmtheader.numberofchannels);
|
||||
waveslot->SetBitRate(fmtheader.bitrate);
|
||||
waveslot->SetSampleRate(fmtheader.samplerate);
|
||||
sample += chunkheader.size;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(&fmtexheader, sample, sizeof(WavFmtExHeader));
|
||||
sample += chunkheader.size;
|
||||
}
|
||||
}
|
||||
else if (!memcmp(chunkheader.id, "data", 4))
|
||||
{
|
||||
if (fmtheader.format == 0x0001)
|
||||
{
|
||||
waveslot->SetNumberOfSamples(chunkheader.size);
|
||||
sample += chunkheader.size;
|
||||
}
|
||||
else if (fmtheader.format == 0x0011)
|
||||
{
|
||||
//IMA ADPCM
|
||||
}
|
||||
else if (fmtheader.format == 0x0055)
|
||||
{
|
||||
//MP3 WAVE
|
||||
}
|
||||
}
|
||||
else if (!memcmp(chunkheader.id, "smpl", 4))
|
||||
{
|
||||
memcpy(&sampleheader, sample, sizeof(WavSampleHeader));
|
||||
//loop = sampleheader.loops;
|
||||
sample += chunkheader.size;
|
||||
}
|
||||
else
|
||||
sample += chunkheader.size;
|
||||
|
||||
sample += chunkheader.size & 1;
|
||||
fileheader.size -= (((chunkheader.size + 1) & ~1) + 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
/*
|
||||
* SND_WaveCache.cpp
|
||||
*
|
||||
* abstract wavecache, a way to organize samples
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning (disable:4786) // Get rid of stupid stl-visual compiler debug warning
|
||||
#endif //WIN32
|
||||
|
||||
#include "SND_WaveCache.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
# include <sys/malloc.h>
|
||||
#else
|
||||
# ifdef __FreeBSD__
|
||||
# include <stdlib.h>
|
||||
# else
|
||||
# include <malloc.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
SND_WaveCache::SND_WaveCache()
|
||||
{
|
||||
// do the buffer administration
|
||||
for (int i = 0; i < NUM_BUFFERS; i++)
|
||||
m_bufferList[i] = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
SND_WaveCache::~SND_WaveCache()
|
||||
{
|
||||
// clean up the mess
|
||||
FreeSamples();
|
||||
RemoveAllSamples();
|
||||
}
|
||||
|
||||
|
||||
|
||||
SND_WaveSlot* SND_WaveCache::GetWaveSlot(const STR_String& samplename)
|
||||
{
|
||||
SND_WaveSlot* waveslot = NULL;
|
||||
|
||||
std::map<STR_String, SND_WaveSlot*>::iterator find_result = m_samplecache.find(samplename);
|
||||
|
||||
// let's see if we have already loaded this sample
|
||||
if (find_result != m_samplecache.end())
|
||||
{
|
||||
waveslot = (*find_result).second;
|
||||
}
|
||||
else
|
||||
{
|
||||
// so the sample wasn't loaded, so do it here
|
||||
for (int bufnum = 0; bufnum < NUM_BUFFERS; bufnum++)
|
||||
{
|
||||
// find an empty buffer
|
||||
if (m_bufferList[bufnum] == NULL)
|
||||
{
|
||||
waveslot = new SND_WaveSlot();
|
||||
waveslot->SetSampleName(samplename);
|
||||
waveslot->SetBuffer(bufnum);
|
||||
m_bufferList[bufnum] = waveslot;
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_samplecache.insert(std::pair<STR_String, SND_WaveSlot*>(samplename, waveslot));
|
||||
}
|
||||
|
||||
return waveslot;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_WaveCache::RemoveAllSamples()
|
||||
{
|
||||
// remove all samples
|
||||
m_samplecache.clear();
|
||||
|
||||
// reset the list of buffers
|
||||
for (int i = 0; i < NUM_BUFFERS; i++)
|
||||
m_bufferList[i] = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_WaveCache::RemoveSample(const STR_String& samplename, int buffer)
|
||||
{
|
||||
m_samplecache.erase(samplename);
|
||||
m_bufferList[buffer] = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_WaveCache::FreeSamples()
|
||||
{
|
||||
// iterate through the bufferlist and delete the waveslot if present
|
||||
for (int i = 0; i < NUM_BUFFERS; i++)
|
||||
{
|
||||
if (m_bufferList[i])
|
||||
{
|
||||
delete m_bufferList[i];
|
||||
m_bufferList[i] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,180 +0,0 @@
|
|||
/**
|
||||
* $Id$
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include "SND_WaveSlot.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
SND_WaveSlot::~SND_WaveSlot()
|
||||
{
|
||||
#ifdef ONTKEVER
|
||||
printf("neeeeeee...\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_WaveSlot::SetSampleName(STR_String samplename)
|
||||
{
|
||||
m_samplename = samplename;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_WaveSlot::SetLoaded(bool loaded)
|
||||
{
|
||||
m_loaded = loaded;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_WaveSlot::SetData(void* data)
|
||||
{
|
||||
m_data = data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_WaveSlot::SetBuffer(unsigned int buffer)
|
||||
{
|
||||
m_buffer = buffer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_WaveSlot::SetSampleFormat(unsigned int sampleformat)
|
||||
{
|
||||
m_sampleformat = sampleformat;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_WaveSlot::SetNumberOfChannels(unsigned int numberofchannels)
|
||||
{
|
||||
m_numberofchannels = numberofchannels;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_WaveSlot::SetSampleRate(unsigned int samplerate)
|
||||
{
|
||||
m_samplerate = samplerate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_WaveSlot::SetBitRate(unsigned int bitrate)
|
||||
{
|
||||
m_bitrate = bitrate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_WaveSlot::SetNumberOfSamples(unsigned int numberofsamples)
|
||||
{
|
||||
m_numberofsamples = numberofsamples;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_WaveSlot::SetFileSize(unsigned int filesize)
|
||||
{
|
||||
m_filesize = filesize;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const STR_String& SND_WaveSlot::GetSampleName()
|
||||
{
|
||||
return m_samplename;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool SND_WaveSlot::IsLoaded() const
|
||||
{
|
||||
return m_loaded;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void* SND_WaveSlot::GetData()
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned int SND_WaveSlot::GetBuffer() const
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned int SND_WaveSlot::GetSampleFormat() const
|
||||
{
|
||||
return m_sampleformat;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned int SND_WaveSlot::GetNumberOfChannels() const
|
||||
{
|
||||
return m_numberofchannels;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned int SND_WaveSlot::GetSampleRate() const
|
||||
{
|
||||
return m_samplerate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned int SND_WaveSlot::GetBitRate() const
|
||||
{
|
||||
return m_bitrate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned int SND_WaveSlot::GetNumberOfSamples() const
|
||||
{
|
||||
return m_numberofsamples;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned int SND_WaveSlot::GetFileSize() const
|
||||
{
|
||||
return m_filesize;
|
||||
}
|
|
@ -1,206 +0,0 @@
|
|||
# Microsoft Developer Studio Project File - Name="SoundSystem" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=SoundSystem - Win32 Release
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "SoundSystem.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "SoundSystem.mak" CFG="SoundSystem - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "SoundSystem - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "SoundSystem - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "SoundSystem - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\..\..\..\obj\windows\intern\soundsystem"
|
||||
# PROP Intermediate_Dir "..\..\..\..\obj\windows\intern\soundsystem"
|
||||
# PROP Target_Dir ""
|
||||
LINK32=link.exe -lib
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../" /I "../../../../../lib/windows/string/include" /I "../../../../../lib/windows/moto/include" /I "../../dummy" /I "../../openal" /I "..\..\..\string" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /J /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\..\..\..\obj\windows\intern\soundsystem\libSoundSystem.lib"
|
||||
# Begin Special Build Tool
|
||||
SOURCE="$(InputPath)"
|
||||
PostBuild_Cmds=ECHO Copying header files XCOPY /Y ..\..\*.h ..\..\..\..\..\lib\windows\SoundSystem\include\*.h ECHO Copying lib XCOPY /Y ..\..\..\..\obj\windows\intern\soundsystem\*.lib ..\..\..\..\..\lib\windows\SoundSystem\lib\*.a ECHO Done
|
||||
# End Special Build Tool
|
||||
|
||||
!ELSEIF "$(CFG)" == "SoundSystem - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "SoundSystem___Win32_Debug"
|
||||
# PROP BASE Intermediate_Dir "SoundSystem___Win32_Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\..\..\..\obj\windows\intern\soundsystem\debug"
|
||||
# PROP Intermediate_Dir "..\..\..\..\obj\windows\intern\soundsystem\debug"
|
||||
# PROP Target_Dir ""
|
||||
LINK32=link.exe -lib
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../" /I "../../../../../lib/windows/string/include" /I "../../../../../lib/windows/moto/include" /I "../../dummy" /I "../../openal" /I "..\..\..\string" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /J /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\..\..\..\obj\windows\intern\soundsystem\debug\libSoundSystem.lib"
|
||||
# Begin Special Build Tool
|
||||
SOURCE="$(InputPath)"
|
||||
PostBuild_Cmds=ECHO Copying header files XCOPY /Y ..\..\*.h ..\..\..\..\..\lib\windows\SoundSystem\include\*.h ECHO Copying lib XCOPY /Y ..\..\..\..\obj\windows\intern\soundsystem\debug\*.lib ..\..\..\..\..\lib\windows\SoundSystem\lib\debug\*.a ECHO Done
|
||||
# End Special Build Tool
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "SoundSystem - Win32 Release"
|
||||
# Name "SoundSystem - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\intern\SND_AudioDevice.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="..\..\intern\SND_C-api.cpp"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\intern\SND_CDObject.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\intern\SND_DeviceManager.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\intern\SND_IdObject.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\intern\SND_Scene.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\intern\SND_SoundListener.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\intern\SND_SoundObject.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\intern\SND_Utils.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\intern\SND_WaveCache.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\intern\SND_WaveSlot.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\intern\SND_AudioDevice.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="..\..\SND_C-api.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\SND_CDObject.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\SND_DependKludge.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\SND_DeviceManager.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\SND_IAudioDevice.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\intern\SND_IdObject.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\SND_Object.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\SND_Scene.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\SND_SoundListener.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\SND_SoundObject.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\SND_Utils.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\SND_WaveCache.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\SND_WaveSlot.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\SoundDefines.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
|
@ -1,103 +0,0 @@
|
|||
# Microsoft Developer Studio Project File - Name="DummySoundSystem" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=DummySoundSystem - Win32 Release
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "DummySoundSystem.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "DummySoundSystem.mak" CFG="DummySoundSystem - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "DummySoundSystem - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "DummySoundSystem - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "DummySoundSystem - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\..\..\..\..\obj\windows\intern\soundsystem\dummy"
|
||||
# PROP Intermediate_Dir "..\..\..\..\..\obj\windows\intern\soundsystem\dummy"
|
||||
# PROP Target_Dir ""
|
||||
LINK32=link.exe -lib
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\intern" /I "..\..\..\..\SoundSystem" /I "..\..\..\..\moto\include" /I "..\..\..\..\string" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /J /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\..\..\..\..\obj\windows\intern\soundsystem\dummy\libDummySoundSystem.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "DummySoundSystem - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\..\..\..\..\obj\windows\intern\soundsystem\dummy\debug"
|
||||
# PROP Intermediate_Dir "..\..\..\..\..\obj\windows\intern\soundsystem\dummy\debug"
|
||||
# PROP Target_Dir ""
|
||||
LINK32=link.exe -lib
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\intern" /I "..\..\..\..\SoundSystem" /I "..\..\..\..\moto\include" /I "..\..\..\..\string" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /J /FD /c
|
||||
# SUBTRACT CPP /Fr
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\..\..\..\..\obj\windows\intern\soundsystem\dummy\debug\libDummySoundSystem.lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "DummySoundSystem - Win32 Release"
|
||||
# Name "DummySoundSystem - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\dummy\SND_DummyDevice.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\dummy\SND_DummyDevice.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
|
@ -1,106 +0,0 @@
|
|||
# Microsoft Developer Studio Project File - Name="OpenALSoundSystem" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=OpenALSoundSystem - Win32 Release
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "OpenALSoundSystem.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "OpenALSoundSystem.mak" CFG="OpenALSoundSystem - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "OpenALSoundSystem - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "OpenALSoundSystem - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "OpenALSoundSystem - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\..\..\..\..\obj\windows\intern\soundsystem\openal"
|
||||
# PROP Intermediate_Dir "..\..\..\..\..\obj\windows\intern\soundsystem\openal"
|
||||
# PROP Target_Dir ""
|
||||
LINK32=link.exe -lib
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\intern" /I "..\..\..\..\SoundSystem" /I "..\..\..\..\SoundSystem\sdl" /I "..\..\..\..\moto\include" /I "..\..\..\..\string" /I "..\..\..\..\..\..\lib\windows\openal\include" /I "..\..\..\..\..\..\lib\windows\sdl\include" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /J /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\..\..\..\..\obj\windows\intern\soundsystem\openal\libOpenALSoundSystem.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "OpenALSoundSystem - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "OpenALSoundSystem___Win32_Debug"
|
||||
# PROP BASE Intermediate_Dir "OpenALSoundSystem___Win32_Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\..\..\..\..\obj\windows\intern\soundsystem\openal\debug"
|
||||
# PROP Intermediate_Dir "..\..\..\..\..\obj\windows\intern\soundsystem\openal\debug"
|
||||
# PROP Target_Dir ""
|
||||
LINK32=link.exe -lib
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\intern" /I "..\..\..\..\SoundSystem" /I "..\..\..\..\SoundSystem\sdl" /I "..\..\..\..\moto\include" /I "..\..\..\..\string" /I "..\..\..\..\..\..\lib\windows\sdl\include" /I "..\..\..\..\..\..\lib\windows\openal\include" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /J /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\..\..\..\..\obj\windows\intern\soundsystem\openal\debug\libOpenALSoundSystem.lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "OpenALSoundSystem - Win32 Release"
|
||||
# Name "OpenALSoundSystem - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\openal\SND_OpenALDevice.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\sdl\SND_SDLCDDevice.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\openal\SND_OpenALDevice.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
|
@ -1,339 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="SoundSystem"
|
||||
ProjectGUID="{98330220-47A6-42E0-9DE4-AD0FF5D204D6}"
|
||||
SccProjectName=""
|
||||
SccLocalPath="">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Blender Debug|Win32"
|
||||
OutputDirectory="..\..\..\..\..\build\msvc_7\intern\soundsystem\debug"
|
||||
IntermediateDirectory="..\..\..\..\..\build\msvc_7\intern\soundsystem\debug"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..;..\..\dummy;..\..\openal;..\..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\..\build\msvc_7\intern\moto\include"
|
||||
PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
DefaultCharIsUnsigned="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\build\msvc_7\intern\soundsystem\debug\SoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\build\msvc_7\intern\soundsystem\debug\"
|
||||
ObjectFile="..\..\..\..\..\build\msvc_7\intern\soundsystem\debug\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\build\msvc_7\intern\soundsystem\debug\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\build\msvc_7\libs\intern\debug\libSoundSystem.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description="Copying SND SoundSystem files library (debug target) to lib tree."
|
||||
CommandLine="ECHO Copying header files
|
||||
IF NOT EXIST ..\..\..\..\..\build\msvc_7\intern\SoundSystem\include MKDIR ..\..\..\..\..\build\msvc_7\intern\SoundSystem\include
|
||||
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_7\intern\SoundSystem\include
|
||||
ECHO Done
|
||||
"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Blender Release|Win32"
|
||||
OutputDirectory="..\..\..\..\..\build\msvc_7\intern\soundsystem"
|
||||
IntermediateDirectory="..\..\..\..\..\build\msvc_7\intern\soundsystem"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..;..\..\dummy;..\..\openal;..\..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\..\build\msvc_7\intern\moto\include"
|
||||
PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
DefaultCharIsUnsigned="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\build\msvc_7\intern\soundsystem\SoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\build\msvc_7\intern\soundsystem\"
|
||||
ObjectFile="..\..\..\..\..\build\msvc_7\intern\soundsystem\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\build\msvc_7\intern\soundsystem\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\build\msvc_7\libs\intern\libSoundSystem.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description="Copying SND SoundSystem files library to lib tree."
|
||||
CommandLine="ECHO Copying header files
|
||||
IF NOT EXIST ..\..\..\..\..\build\msvc_7\intern\SoundSystem\include MKDIR ..\..\..\..\..\build\msvc_7\intern\SoundSystem\include
|
||||
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_7\intern\SoundSystem\include
|
||||
ECHO Done
|
||||
"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="3DPlugin Release|Win32"
|
||||
OutputDirectory="..\..\..\..\..\build\msvc_7\intern\soundsystem\mtdll"
|
||||
IntermediateDirectory="..\..\..\..\..\build\msvc_7\intern\soundsystem\mtdll"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..;..\..\dummy;..\..\openal;..\..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\..\build\msvc_7\intern\moto\include"
|
||||
PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
DefaultCharIsUnsigned="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\build\msvc_7\intern\soundsystem\mtdll\SoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\build\msvc_7\intern\soundsystem\mtdll\"
|
||||
ObjectFile="..\..\..\..\..\build\msvc_7\intern\soundsystem\mtdll\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\build\msvc_7\intern\soundsystem\mtdll\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\build\msvc_7\libs\intern\mtdll\libSoundSystem.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description="Copying SND SoundSystem files library to lib tree."
|
||||
CommandLine="ECHO Copying header files
|
||||
IF NOT EXIST ..\..\..\..\..\build\msvc_7\intern\SoundSystem\include MKDIR ..\..\..\..\..\build\msvc_7\intern\SoundSystem\include
|
||||
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_7\intern\SoundSystem\include
|
||||
ECHO Done
|
||||
"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="3DPlugin Debug|Win32"
|
||||
OutputDirectory="..\..\..\..\..\build\msvc_7\intern\soundsystem\mtdll\debug"
|
||||
IntermediateDirectory="..\..\..\..\..\build\msvc_7\intern\soundsystem\mtdll\debug"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..;..\..\dummy;..\..\openal;..\..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\..\build\msvc_7\intern\moto\include"
|
||||
PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
DefaultCharIsUnsigned="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\build\msvc_7\intern\soundsystem\mtdll\debug\SoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\build\msvc_7\intern\soundsystem\mtdll\debug\"
|
||||
ObjectFile="..\..\..\..\..\build\msvc_7\intern\soundsystem\mtdll\debug\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\build\msvc_7\intern\soundsystem\mtdll\debug\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\build\msvc_7\libs\intern\mtdll\debug\libSoundSystem.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description="Copying SND SoundSystem files library (debug target) to lib tree."
|
||||
CommandLine="ECHO Copying header files
|
||||
IF NOT EXIST ..\..\..\..\..\build\msvc_7\intern\SoundSystem\include MKDIR ..\..\..\..\..\build\msvc_7\intern\SoundSystem\include
|
||||
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_7\intern\SoundSystem\include
|
||||
ECHO Done
|
||||
"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_AudioDevice.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_C-api.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_CDObject.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_DeviceManager.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_IdObject.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_Scene.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_SoundListener.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_SoundObject.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_Utils.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_WaveCache.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_WaveSlot.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl">
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_AudioDevice.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_C-api.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_CDObject.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_DependKludge.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_DeviceManager.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_IAudioDevice.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_IdObject.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_Object.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_Scene.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_SoundListener.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_SoundObject.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_Utils.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_WaveCache.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_WaveSlot.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SoundDefines.h">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -1,243 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="DummySoundSystem"
|
||||
ProjectGUID="{FAF46346-65CC-4DB2-85C4-B99826F79D0C}"
|
||||
SccProjectName=""
|
||||
SccLocalPath="">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Blender Release|Win32"
|
||||
OutputDirectory="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy"
|
||||
IntermediateDirectory="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\..\intern;..\..\..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_7\intern\moto\include"
|
||||
PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
DefaultCharIsUnsigned="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy\DummySoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy\"
|
||||
ObjectFile="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\..\build\msvc_7\libs\intern\libDummySoundSystem.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Blender Debug|Win32"
|
||||
OutputDirectory="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy\debug"
|
||||
IntermediateDirectory="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy\debug"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\intern;..\..\..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_7\intern\moto\include"
|
||||
PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
DefaultCharIsUnsigned="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy\debug\DummySoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy\debug\"
|
||||
ObjectFile="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy\debug\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy\debug\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\..\build\msvc_7\libs\intern\debug\libDummySoundSystem.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="3DPlugin Release|Win32"
|
||||
OutputDirectory="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy\mtdll"
|
||||
IntermediateDirectory="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy\mtdll"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\..\intern;..\..\..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_7\intern\moto\include"
|
||||
PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
DefaultCharIsUnsigned="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy\mtdll\DummySoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy\mtdll\"
|
||||
ObjectFile="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy\mtdll\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy\mtdll\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\..\build\msvc_7\libs\intern\mtdll\libDummySoundSystem.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="3DPlugin Debug|Win32"
|
||||
OutputDirectory="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy\mtdll\debug"
|
||||
IntermediateDirectory="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy\mtdll\debug"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\intern;..\..\..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_7\intern\moto\include"
|
||||
PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
DefaultCharIsUnsigned="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy\mtdll\debug\DummySoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy\mtdll\debug\"
|
||||
ObjectFile="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy\mtdll\debug\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\dummy\mtdll\debug\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\..\build\msvc_7\libs\intern\mtdll\debug\libDummySoundSystem.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||
<File
|
||||
RelativePath="..\..\..\dummy\SND_DummyDevice.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl">
|
||||
<File
|
||||
RelativePath="..\..\..\dummy\SND_DummyDevice.h">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -1,249 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="OpenALSoundSystem"
|
||||
ProjectGUID="{213356A9-3A1F-41DA-9819-1297BCD17DEE}"
|
||||
SccProjectName=""
|
||||
SccLocalPath="">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Blender Debug|Win32"
|
||||
OutputDirectory="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal\debug"
|
||||
IntermediateDirectory="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal\debug"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\sdl;..\..\..\intern;..\..\..\..\..\..\lib\windows\sdl\include;..\..\..\..\..\..\lib\windows\openal\include;..\..\..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\..\..\build\msvc_7\intern\string\include"
|
||||
PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
DefaultCharIsUnsigned="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal\debug\OpenALSoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal\debug\"
|
||||
ObjectFile="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal\debug\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal\debug\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\..\build\msvc_7\libs\intern\debug\libOpenALSoundSystem.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Blender Release|Win32"
|
||||
OutputDirectory="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal"
|
||||
IntermediateDirectory="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\..\sdl;..\..\..\intern;..\..\..\..\..\..\lib\windows\sdl\include;..\..\..\..\..\..\lib\windows\openal\include;..\..\..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\..\..\build\msvc_7\intern\string\include"
|
||||
PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
DefaultCharIsUnsigned="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal\OpenALSoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal\"
|
||||
ObjectFile="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\..\build\msvc_7\libs\intern\libOpenALSoundSystem.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="3DPlugin Release|Win32"
|
||||
OutputDirectory="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal\mtdll"
|
||||
IntermediateDirectory="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal\mtdll"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\..\sdl;..\..\..\intern;..\..\..\..\..\..\lib\windows\sdl\include;..\..\..\..\..\..\lib\windows\openal\include;..\..\..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\..\..\build\msvc_7\intern\string\include"
|
||||
PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
DefaultCharIsUnsigned="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal\mtdll\OpenALSoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal\mtdll\"
|
||||
ObjectFile="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal\mtdll\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal\mtdll\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\..\build\msvc_7\libs\intern\mtdll\libOpenALSoundSystem.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="3DPlugin Debug|Win32"
|
||||
OutputDirectory="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal\mtdll\debug"
|
||||
IntermediateDirectory="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal\mtdll\debug"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\sdl;..\..\..\intern;..\..\..\..\..\..\lib\windows\sdl\include;..\..\..\..\..\..\lib\windows\openal\include;..\..\..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\..\..\build\msvc_7\intern\string\include"
|
||||
PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
DefaultCharIsUnsigned="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal\mtdll\debug\OpenALSoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal\mtdll\debug\"
|
||||
ObjectFile="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal\mtdll\debug\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_7\intern\soundsystem\openal\mtdll\debug\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\..\build\msvc_7\libs\intern\mtdll\debug\libOpenALSoundSystem.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||
<File
|
||||
RelativePath="..\..\..\openal\SND_OpenALDevice.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\sdl\SND_SDLCDDevice.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl">
|
||||
<File
|
||||
RelativePath="..\..\..\openal\SND_OpenALDevice.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\sdl\SND_SDLCDDevice.h">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -1,447 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="INT_SoundSystem"
|
||||
ProjectGUID="{98330220-47A6-42E0-9DE4-AD0FF5D204D6}"
|
||||
RootNamespace="SoundSystem"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Blender Debug|Win32"
|
||||
OutputDirectory="..\..\..\..\..\build\msvc_9\intern\soundsystem\debug"
|
||||
IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\soundsystem\debug"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..;..\..\dummy;..\..\openal;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\intern\moto\include"
|
||||
PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
DefaultCharIsUnsigned="true"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\soundsystem\debug\SoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\soundsystem\debug\"
|
||||
ObjectFile="..\..\..\..\..\build\msvc_9\intern\soundsystem\debug\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\soundsystem\debug\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\debug\libSoundSystem.lib"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description="Copying SND SoundSystem files library (debug target) to lib tree."
|
||||
CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include MKDIR ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include
ECHO Done
"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Blender Release|Win32"
|
||||
OutputDirectory="..\..\..\..\..\build\msvc_9\intern\soundsystem"
|
||||
IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\soundsystem"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..;..\..\dummy;..\..\openal;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\intern\moto\include"
|
||||
PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
DefaultCharIsUnsigned="true"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\soundsystem\SoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\soundsystem\"
|
||||
ObjectFile="..\..\..\..\..\build\msvc_9\intern\soundsystem\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\soundsystem\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="true"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\libSoundSystem.lib"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description="Copying SND SoundSystem files library to lib tree."
|
||||
CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include MKDIR ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include
ECHO Done
"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="3DPlugin Release|Win32"
|
||||
OutputDirectory="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll"
|
||||
IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..;..\..\dummy;..\..\openal;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\intern\moto\include"
|
||||
PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
DefaultCharIsUnsigned="true"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll\SoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll\"
|
||||
ObjectFile="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="true"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\libSoundSystem.lib"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description="Copying SND SoundSystem files library to lib tree."
|
||||
CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include MKDIR ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include
ECHO Done
"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="3DPlugin Debug|Win32"
|
||||
OutputDirectory="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll\debug"
|
||||
IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll\debug"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..;..\..\dummy;..\..\openal;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\intern\moto\include"
|
||||
PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
DefaultCharIsUnsigned="true"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll\debug\SoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll\debug\"
|
||||
ObjectFile="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll\debug\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll\debug\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\debug\libSoundSystem.lib"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description="Copying SND SoundSystem files library (debug target) to lib tree."
|
||||
CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include MKDIR ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include
ECHO Done
"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_AudioDevice.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_C-api.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_CDObject.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_DeviceManager.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_IdObject.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_Scene.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_SoundListener.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_SoundObject.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_Utils.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_WaveCache.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_WaveSlot.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_AudioDevice.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_C-api.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_CDObject.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_DependKludge.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_DeviceManager.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_IAudioDevice.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\SND_IdObject.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_Object.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_Scene.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_SoundListener.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_SoundObject.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_Utils.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_WaveCache.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SND_WaveSlot.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\SoundDefines.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -1,343 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="INT_DummySoundSystem"
|
||||
ProjectGUID="{FAF46346-65CC-4DB2-85C4-B99826F79D0C}"
|
||||
RootNamespace="DummySoundSystem"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Blender Release|Win32"
|
||||
OutputDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy"
|
||||
IntermediateDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\..\intern;..\..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_9\intern\moto\include"
|
||||
PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
DefaultCharIsUnsigned="true"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\DummySoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\"
|
||||
ObjectFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="true"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\..\build\msvc_9\libs\intern\libDummySoundSystem.lib"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Blender Debug|Win32"
|
||||
OutputDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\debug"
|
||||
IntermediateDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\debug"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\intern;..\..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_9\intern\moto\include"
|
||||
PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
DefaultCharIsUnsigned="true"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\debug\DummySoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\debug\"
|
||||
ObjectFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\debug\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\debug\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\..\build\msvc_9\libs\intern\debug\libDummySoundSystem.lib"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="3DPlugin Release|Win32"
|
||||
OutputDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll"
|
||||
IntermediateDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\..\intern;..\..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_9\intern\moto\include"
|
||||
PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
DefaultCharIsUnsigned="true"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll\DummySoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll\"
|
||||
ObjectFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="true"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\..\build\msvc_9\libs\intern\mtdll\libDummySoundSystem.lib"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="3DPlugin Debug|Win32"
|
||||
OutputDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll\debug"
|
||||
IntermediateDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll\debug"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\intern;..\..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_9\intern\moto\include"
|
||||
PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
DefaultCharIsUnsigned="true"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll\debug\DummySoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll\debug\"
|
||||
ObjectFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll\debug\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll\debug\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\..\build\msvc_9\libs\intern\mtdll\debug\libDummySoundSystem.lib"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\dummy\SND_DummyDevice.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\dummy\SND_DummyDevice.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -1,351 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="INT_OpenALSoundSystem"
|
||||
ProjectGUID="{213356A9-3A1F-41DA-9819-1297BCD17DEE}"
|
||||
RootNamespace="OpenALSoundSystem"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Blender Debug|Win32"
|
||||
OutputDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\debug"
|
||||
IntermediateDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\debug"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\sdl;..\..\..\intern;..\..\..\..\..\..\lib\windows\sdl\include;..\..\..\..\..\..\lib\windows\openal\include;..\..\..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\..\build\msvc_9\intern\string\include"
|
||||
PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
DefaultCharIsUnsigned="true"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\debug\OpenALSoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\debug\"
|
||||
ObjectFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\debug\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\debug\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\..\build\msvc_9\libs\intern\debug\libOpenALSoundSystem.lib"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Blender Release|Win32"
|
||||
OutputDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal"
|
||||
IntermediateDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\..\sdl;..\..\..\intern;..\..\..\..\..\..\lib\windows\sdl\include;..\..\..\..\..\..\lib\windows\openal\include;..\..\..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\..\build\msvc_9\intern\string\include"
|
||||
PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
DefaultCharIsUnsigned="true"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\OpenALSoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\"
|
||||
ObjectFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="true"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\..\build\msvc_9\libs\intern\libOpenALSoundSystem.lib"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="3DPlugin Release|Win32"
|
||||
OutputDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll"
|
||||
IntermediateDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\..\sdl;..\..\..\intern;..\..\..\..\..\..\lib\windows\sdl\include;..\..\..\..\..\..\lib\windows\openal\include;..\..\..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\..\build\msvc_9\intern\string\include"
|
||||
PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
DefaultCharIsUnsigned="true"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll\OpenALSoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll\"
|
||||
ObjectFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="true"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\..\build\msvc_9\libs\intern\mtdll\libOpenALSoundSystem.lib"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="3DPlugin Debug|Win32"
|
||||
OutputDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll\debug"
|
||||
IntermediateDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll\debug"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\sdl;..\..\..\intern;..\..\..\..\..\..\lib\windows\sdl\include;..\..\..\..\..\..\lib\windows\openal\include;..\..\..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\..\build\msvc_9\intern\string\include"
|
||||
PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
DefaultCharIsUnsigned="true"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll\debug\OpenALSoundSystem.pch"
|
||||
AssemblerListingLocation="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll\debug\"
|
||||
ObjectFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll\debug\"
|
||||
ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll\debug\"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\..\..\..\..\build\msvc_9\libs\intern\mtdll\debug\libOpenALSoundSystem.lib"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\openal\SND_OpenALDevice.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\sdl\SND_SDLCDDevice.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\openal\SND_OpenALDevice.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\sdl\SND_SDLCDDevice.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -1,44 +0,0 @@
|
|||
#
|
||||
# $Id$
|
||||
#
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): none yet.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
#
|
||||
#
|
||||
|
||||
LIBNAME = OpenALSoundSystem
|
||||
DIR = $(OCGDIR)/intern/$(LIBNAME)
|
||||
|
||||
include nan_compile.mk
|
||||
|
||||
CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
|
||||
|
||||
CPPFLAGS += -I$(NAN_OPENAL)/include
|
||||
CPPFLAGS += -I$(NAN_STRING)/include
|
||||
CPPFLAGS += -I$(NAN_MOTO)/include
|
||||
CPPFLAGS += -I../intern
|
||||
CPPFLAGS += -I..
|
||||
CPPFLAGS += -I.
|
||||
CPPFLAGS += -I../sdl
|
|
@ -1,854 +0,0 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
* SND_OpenALDevice derived from SND_IAudioDevice
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
|
||||
#endif //WIN32
|
||||
|
||||
#include "SND_OpenALDevice.h"
|
||||
#ifndef __APPLE__
|
||||
#include "SND_SDLCDDevice.h"
|
||||
#endif
|
||||
#include "SoundDefines.h"
|
||||
|
||||
#include "SND_Utils.h"
|
||||
|
||||
#ifdef APPLE_FRAMEWORK_FIX
|
||||
#include <al.h>
|
||||
#include <alc.h>
|
||||
#else
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#if defined(WIN32)
|
||||
#include <io.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
/*************************** ALUT replacement *****************************/
|
||||
|
||||
/* instead of relying on alut, we just implement our own
|
||||
* WAV loading functions, hopefully more reliable */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct /* WAV File-header */
|
||||
{
|
||||
ALubyte Id[4];
|
||||
ALsizei Size;
|
||||
ALubyte Type[4];
|
||||
} WAVFileHdr_Struct;
|
||||
|
||||
typedef struct /* WAV Fmt-header */
|
||||
{
|
||||
ALushort Format;
|
||||
ALushort Channels;
|
||||
ALuint SamplesPerSec;
|
||||
ALuint BytesPerSec;
|
||||
ALushort BlockAlign;
|
||||
ALushort BitsPerSample;
|
||||
} WAVFmtHdr_Struct;
|
||||
|
||||
typedef struct /* WAV FmtEx-header */
|
||||
{
|
||||
ALushort Size;
|
||||
ALushort SamplesPerBlock;
|
||||
} WAVFmtExHdr_Struct;
|
||||
|
||||
typedef struct /* WAV Smpl-header */
|
||||
{
|
||||
ALuint Manufacturer;
|
||||
ALuint Product;
|
||||
ALuint SamplePeriod;
|
||||
ALuint Note;
|
||||
ALuint FineTune;
|
||||
ALuint SMPTEFormat;
|
||||
ALuint SMPTEOffest;
|
||||
ALuint Loops;
|
||||
ALuint SamplerData;
|
||||
struct
|
||||
{
|
||||
ALuint Identifier;
|
||||
ALuint Type;
|
||||
ALuint Start;
|
||||
ALuint End;
|
||||
ALuint Fraction;
|
||||
ALuint Count;
|
||||
} Loop[1];
|
||||
} WAVSmplHdr_Struct;
|
||||
|
||||
typedef struct /* WAV Chunk-header */
|
||||
{
|
||||
ALubyte Id[4];
|
||||
ALuint Size;
|
||||
} WAVChunkHdr_Struct;
|
||||
|
||||
static void *SND_loadFileIntoMemory(const char *filename, int *len_r)
|
||||
{
|
||||
FILE *fp= fopen(filename, "rb");
|
||||
void *data;
|
||||
|
||||
if (!fp) {
|
||||
*len_r= -1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fseek(fp, 0L, SEEK_END);
|
||||
*len_r= ftell(fp);
|
||||
fseek(fp, 0L, SEEK_SET);
|
||||
|
||||
data= malloc(*len_r);
|
||||
if (!data) {
|
||||
*len_r= -1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (fread(data, *len_r, 1, fp)!=1) {
|
||||
*len_r= -1;
|
||||
free(data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
#define TEST_SWITCH_INT(a) if(big_endian) { \
|
||||
char s_i, *p_i; \
|
||||
p_i= (char *)&(a); \
|
||||
s_i=p_i[0]; p_i[0]=p_i[3]; p_i[3]=s_i; \
|
||||
s_i=p_i[1]; p_i[1]=p_i[2]; p_i[2]=s_i; }
|
||||
|
||||
#define TEST_SWITCH_SHORT(a) if(big_endian) { \
|
||||
char s_i, *p_i; \
|
||||
p_i= (char *)&(a); \
|
||||
s_i=p_i[0]; p_i[0]=p_i[1]; p_i[1]=s_i; }
|
||||
|
||||
static int stream_read(void *out, ALbyte **stream, ALsizei size, ALsizei *memsize)
|
||||
{
|
||||
if(size <= *memsize) {
|
||||
memcpy(out, *stream, size);
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
memset(out, 0, size);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int stream_skip(ALbyte **stream, ALsizei size, ALsizei *memsize)
|
||||
{
|
||||
if(size <= *memsize) {
|
||||
*stream += size;
|
||||
*memsize -= size;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
ALvoid SND_alutLoadWAVMemory(ALbyte *memory,ALsizei memsize,ALenum *format,ALvoid **data,ALsizei *size,ALsizei *freq,ALboolean *loop)
|
||||
{
|
||||
WAVChunkHdr_Struct ChunkHdr;
|
||||
WAVFmtExHdr_Struct FmtExHdr;
|
||||
WAVFileHdr_Struct FileHdr;
|
||||
WAVSmplHdr_Struct SmplHdr;
|
||||
WAVFmtHdr_Struct FmtHdr;
|
||||
ALbyte *Stream= memory;
|
||||
int test_endian= 1;
|
||||
int big_endian= !((char*)&test_endian)[0];
|
||||
|
||||
*format=AL_FORMAT_MONO16;
|
||||
*data=NULL;
|
||||
*size=0;
|
||||
*freq=22050;
|
||||
*loop=AL_FALSE;
|
||||
|
||||
if(!Stream)
|
||||
return;
|
||||
|
||||
stream_read(&FileHdr,&Stream,sizeof(WAVFileHdr_Struct),&memsize);
|
||||
stream_skip(&Stream,sizeof(WAVFileHdr_Struct),&memsize);
|
||||
|
||||
TEST_SWITCH_INT(FileHdr.Size);
|
||||
FileHdr.Size=((FileHdr.Size+1)&~1)-4;
|
||||
|
||||
while((FileHdr.Size!=0) && stream_read(&ChunkHdr,&Stream,sizeof(WAVChunkHdr_Struct),&memsize))
|
||||
{
|
||||
TEST_SWITCH_INT(ChunkHdr.Size);
|
||||
stream_skip(&Stream,sizeof(WAVChunkHdr_Struct),&memsize);
|
||||
|
||||
if (!memcmp(ChunkHdr.Id,"fmt ",4))
|
||||
{
|
||||
stream_read(&FmtHdr,&Stream,sizeof(WAVFmtHdr_Struct),&memsize);
|
||||
|
||||
TEST_SWITCH_SHORT(FmtHdr.Format);
|
||||
TEST_SWITCH_SHORT(FmtHdr.Channels);
|
||||
TEST_SWITCH_INT(FmtHdr.SamplesPerSec);
|
||||
TEST_SWITCH_INT(FmtHdr.BytesPerSec);
|
||||
TEST_SWITCH_SHORT(FmtHdr.BlockAlign);
|
||||
TEST_SWITCH_SHORT(FmtHdr.BitsPerSample);
|
||||
|
||||
if (FmtHdr.Format==0x0001)
|
||||
{
|
||||
*format=(FmtHdr.Channels==1?
|
||||
(FmtHdr.BitsPerSample==8?AL_FORMAT_MONO8:AL_FORMAT_MONO16):
|
||||
(FmtHdr.BitsPerSample==8?AL_FORMAT_STEREO8:AL_FORMAT_STEREO16));
|
||||
*freq=FmtHdr.SamplesPerSec;
|
||||
}
|
||||
else
|
||||
{
|
||||
stream_read(&FmtExHdr,&Stream,sizeof(WAVFmtExHdr_Struct),&memsize);
|
||||
TEST_SWITCH_SHORT(FmtExHdr.Size);
|
||||
TEST_SWITCH_SHORT(FmtExHdr.SamplesPerBlock);
|
||||
}
|
||||
}
|
||||
else if (!memcmp(ChunkHdr.Id,"data",4))
|
||||
{
|
||||
if (FmtHdr.Format==0x0001)
|
||||
{
|
||||
if((ALsizei)ChunkHdr.Size <= memsize)
|
||||
{
|
||||
*size=ChunkHdr.Size;
|
||||
*data=malloc(ChunkHdr.Size+31);
|
||||
|
||||
if (*data) {
|
||||
stream_read(*data,&Stream,ChunkHdr.Size,&memsize);
|
||||
memset(((char *)*data)+ChunkHdr.Size,0,31);
|
||||
|
||||
if(FmtHdr.BitsPerSample == 16 && big_endian) {
|
||||
int a, len= *size/2;
|
||||
short *samples= (short*)*data;
|
||||
|
||||
for(a=0; a<len; a++) {
|
||||
TEST_SWITCH_SHORT(samples[a])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (FmtHdr.Format==0x0011)
|
||||
{
|
||||
//IMA ADPCM
|
||||
}
|
||||
else if (FmtHdr.Format==0x0055)
|
||||
{
|
||||
//MP3 WAVE
|
||||
}
|
||||
}
|
||||
else if (!memcmp(ChunkHdr.Id,"smpl",4))
|
||||
{
|
||||
stream_read(&SmplHdr,&Stream,sizeof(WAVSmplHdr_Struct),&memsize);
|
||||
|
||||
TEST_SWITCH_INT(SmplHdr.Manufacturer);
|
||||
TEST_SWITCH_INT(SmplHdr.Product);
|
||||
TEST_SWITCH_INT(SmplHdr.SamplePeriod);
|
||||
TEST_SWITCH_INT(SmplHdr.Note);
|
||||
TEST_SWITCH_INT(SmplHdr.FineTune);
|
||||
TEST_SWITCH_INT(SmplHdr.SMPTEFormat);
|
||||
TEST_SWITCH_INT(SmplHdr.SMPTEOffest);
|
||||
TEST_SWITCH_INT(SmplHdr.Loops);
|
||||
TEST_SWITCH_INT(SmplHdr.SamplerData);
|
||||
|
||||
*loop = (SmplHdr.Loops ? AL_TRUE : AL_FALSE);
|
||||
}
|
||||
|
||||
if(!stream_skip(&Stream, ChunkHdr.Size + (ChunkHdr.Size&1), &memsize))
|
||||
break;
|
||||
|
||||
FileHdr.Size-=(((ChunkHdr.Size+1)&~1)+8);
|
||||
}
|
||||
}
|
||||
|
||||
ALvoid SND_alutUnloadWAV(ALenum format,ALvoid *data,ALsizei size,ALsizei freq)
|
||||
{
|
||||
if (data)
|
||||
free(data);
|
||||
}
|
||||
|
||||
/************************ Device Implementation ****************************/
|
||||
|
||||
SND_OpenALDevice::SND_OpenALDevice()
|
||||
: SND_AudioDevice(),
|
||||
m_context(NULL),
|
||||
m_device(NULL)
|
||||
{
|
||||
/* Removed the functionality for checking if noaudio was provided on */
|
||||
/* the commandline. */
|
||||
m_audio = true;
|
||||
m_context = NULL;
|
||||
m_buffersinitialized = false;
|
||||
m_sourcesinitialized = false;
|
||||
|
||||
// let's check if we can get openal to initialize...
|
||||
if (m_audio)
|
||||
{
|
||||
m_audio = false;
|
||||
|
||||
ALCdevice *dev = alcOpenDevice(NULL);
|
||||
if (dev) {
|
||||
m_context = alcCreateContext(dev, NULL);
|
||||
|
||||
if (m_context) {
|
||||
#ifdef AL_VERSION_1_1
|
||||
alcMakeContextCurrent((ALCcontext*)m_context);
|
||||
#else
|
||||
alcMakeContextCurrent(m_context);
|
||||
#endif
|
||||
m_audio = true;
|
||||
m_device = dev;
|
||||
#ifdef __linux__
|
||||
/*
|
||||
* SIGHUP Hack:
|
||||
*
|
||||
* On Linux, alcDestroyContext generates a SIGHUP (Hangup) when killing the OpenAL
|
||||
* mixer thread, which kills Blender.
|
||||
*
|
||||
* So we set the signal to ignore....
|
||||
*
|
||||
* TODO: check if this applies to other platforms.
|
||||
*
|
||||
*/
|
||||
signal(SIGHUP, SIG_IGN);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// then try to generate some buffers
|
||||
if (m_audio)
|
||||
{
|
||||
// let openal generate its buffers
|
||||
alGenBuffers(NUM_BUFFERS, m_buffers);
|
||||
m_buffersinitialized = true;
|
||||
|
||||
for (int i = 0; i < NUM_BUFFERS; i++)
|
||||
{
|
||||
if (!alIsBuffer(m_buffers[i]))
|
||||
{
|
||||
//printf("\n\n WARNING: OpenAL returned with an error. Continuing without audio.\n\n");
|
||||
m_audio = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// next: the sources
|
||||
if (m_audio)
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
ALenum alc_error = ALC_NO_ERROR; // openal_2.12
|
||||
#else
|
||||
ALenum alc_error = alcGetError(NULL); // openal_2.14+
|
||||
#endif
|
||||
|
||||
// let openal generate its sources
|
||||
if (alc_error == ALC_NO_ERROR)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0;i<NUM_SOURCES;i++)
|
||||
m_sources[i] = 0;
|
||||
alGenSources(NUM_SOURCES, m_sources);
|
||||
m_sourcesinitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
// let's get us a wavecache
|
||||
if (m_audio)
|
||||
{
|
||||
m_wavecache = new SND_WaveCache();
|
||||
}
|
||||
#ifndef __APPLE__
|
||||
m_cdrom = new SND_SDLCDDevice();
|
||||
#endif
|
||||
}
|
||||
|
||||
void SND_OpenALDevice::UseCD(void) const
|
||||
{
|
||||
// we use SDL for CD, so we create the system
|
||||
SND_CDObject::CreateSystem();
|
||||
|
||||
}
|
||||
|
||||
void SND_OpenALDevice::MakeCurrent() const
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
SND_OpenALDevice::~SND_OpenALDevice()
|
||||
{
|
||||
MakeCurrent();
|
||||
|
||||
if (m_sourcesinitialized)
|
||||
{
|
||||
for (int i = 0; i < NUM_SOURCES; i++)
|
||||
alSourceStop(m_sources[i]);
|
||||
|
||||
alDeleteSources(NUM_SOURCES, m_sources);
|
||||
m_sourcesinitialized = false;
|
||||
}
|
||||
|
||||
if (m_buffersinitialized)
|
||||
{
|
||||
alDeleteBuffers(NUM_BUFFERS, m_buffers);
|
||||
m_buffersinitialized = false;
|
||||
}
|
||||
|
||||
if (m_context) {
|
||||
MakeCurrent();
|
||||
#ifdef AL_VERSION_1_1
|
||||
alcDestroyContext((ALCcontext*)m_context);
|
||||
#else
|
||||
alcDestroyContext(m_context);
|
||||
#endif
|
||||
m_context = NULL;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
// restore the signal state above.
|
||||
signal(SIGHUP, SIG_DFL);
|
||||
#endif
|
||||
// let's see if we used the cd. if not, just leave it alone
|
||||
SND_CDObject* pCD = SND_CDObject::Instance();
|
||||
|
||||
if (pCD)
|
||||
{
|
||||
this->StopCD();
|
||||
SND_CDObject::DisposeSystem();
|
||||
}
|
||||
#ifndef __APPLE__
|
||||
if (m_cdrom)
|
||||
delete m_cdrom;
|
||||
#endif
|
||||
if (m_device)
|
||||
alcCloseDevice((ALCdevice*) m_device);
|
||||
}
|
||||
|
||||
|
||||
SND_WaveSlot* SND_OpenALDevice::LoadSample(const STR_String& name,
|
||||
void* memlocation,
|
||||
int size)
|
||||
{
|
||||
SND_WaveSlot* waveslot = NULL;
|
||||
STR_String samplename = name;
|
||||
|
||||
if (m_audio)
|
||||
{
|
||||
/* create the waveslot */
|
||||
waveslot = m_wavecache->GetWaveSlot(samplename);
|
||||
|
||||
/* do we support this sample? */
|
||||
if (SND_IsSampleValid(name, memlocation))
|
||||
{
|
||||
if (waveslot)
|
||||
{
|
||||
bool freemem = false;
|
||||
int buffer = waveslot->GetBuffer();
|
||||
void* data = NULL;
|
||||
char loop = 'a';
|
||||
int sampleformat, bitrate, numberofchannels;
|
||||
ALenum al_error = alGetError();
|
||||
ALsizei samplerate, numberofsamples; // openal_2.14+
|
||||
|
||||
/* Give them some safe defaults just incase */
|
||||
bitrate = numberofchannels = 0;
|
||||
|
||||
if (!(size && memlocation)) {
|
||||
memlocation = SND_loadFileIntoMemory(samplename.Ptr(), &size);
|
||||
freemem = true;
|
||||
}
|
||||
|
||||
/* load the sample from memory? */
|
||||
if (size && memlocation)
|
||||
{
|
||||
waveslot->SetFileSize(size);
|
||||
|
||||
/* what was (our) buffer? */
|
||||
int buffer = waveslot->GetBuffer();
|
||||
|
||||
/* get some info out of the sample */
|
||||
SND_GetSampleInfo((signed char*)memlocation, waveslot);
|
||||
numberofchannels = SND_GetNumberOfChannels(memlocation);
|
||||
bitrate = SND_GetBitRate(memlocation);
|
||||
|
||||
/* load the sample into openal */
|
||||
SND_alutLoadWAVMemory((ALbyte*)memlocation, size, &sampleformat, &data, &numberofsamples, &samplerate, &loop);
|
||||
/* put it in the buffer */
|
||||
alBufferData(m_buffers[buffer], sampleformat, data, numberofsamples, samplerate);
|
||||
}
|
||||
|
||||
if(freemem)
|
||||
free(memlocation);
|
||||
|
||||
/* fill the waveslot with info */
|
||||
al_error = alGetError();
|
||||
if (al_error == AL_NO_ERROR && m_buffers[buffer])
|
||||
{
|
||||
waveslot->SetData(data);
|
||||
waveslot->SetSampleFormat(sampleformat);
|
||||
waveslot->SetNumberOfChannels(numberofchannels);
|
||||
waveslot->SetSampleRate(samplerate);
|
||||
waveslot->SetBitRate(bitrate);
|
||||
waveslot->SetNumberOfSamples(numberofsamples);
|
||||
|
||||
/* if the loading succeeded, mark the waveslot */
|
||||
waveslot->SetLoaded(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* or when it failed, free the waveslot */
|
||||
m_wavecache->RemoveSample(waveslot->GetSampleName(), waveslot->GetBuffer());
|
||||
waveslot = NULL;
|
||||
}
|
||||
|
||||
/* and free the original stuff (copy was made in openal) */
|
||||
SND_alutUnloadWAV(sampleformat, data, numberofsamples, samplerate);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* sample not supported, remove waveslot */
|
||||
m_wavecache->RemoveSample(waveslot->GetSampleName(), waveslot->GetBuffer());
|
||||
waveslot = NULL;
|
||||
}
|
||||
}
|
||||
return waveslot;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// listener's and general stuff //////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
/* sets the global dopplervelocity */
|
||||
void SND_OpenALDevice::SetDopplerVelocity(MT_Scalar dopplervelocity) const
|
||||
{
|
||||
alDopplerVelocity ((float)dopplervelocity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* sets the global dopplerfactor */
|
||||
void SND_OpenALDevice::SetDopplerFactor(MT_Scalar dopplerfactor) const
|
||||
{
|
||||
alDopplerFactor ((float)dopplerfactor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* sets the global rolloff factor */
|
||||
void SND_OpenALDevice::SetListenerRollOffFactor(MT_Scalar rollofffactor) const
|
||||
{
|
||||
// not implemented in openal
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_OpenALDevice::NextFrame() const
|
||||
{
|
||||
// CD
|
||||
#ifndef __APPLE__
|
||||
m_cdrom->NextFrame();
|
||||
#endif
|
||||
// not needed by openal
|
||||
}
|
||||
|
||||
|
||||
|
||||
// set the gain for the listener
|
||||
void SND_OpenALDevice::SetListenerGain(float gain) const
|
||||
{
|
||||
alListenerf (AL_GAIN, gain);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_OpenALDevice::InitListener()
|
||||
{
|
||||
// initialize the listener with these values that won't change
|
||||
// (as long as we can have only one listener)
|
||||
// now we can superimpose all listeners on each other (for they
|
||||
// have the same settings)
|
||||
float lispos[3] = {0,0,0};
|
||||
float lisvel[3] = {0,0,0};
|
||||
float lisori[6] = {0,0,1,0,-1,0};
|
||||
|
||||
alListenerfv(AL_POSITION, lispos);
|
||||
alListenerfv(AL_VELOCITY, lisvel);
|
||||
alListenerfv(AL_ORIENTATION, lisori);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// source playstate stuff ////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
/* sets the buffer */
|
||||
void SND_OpenALDevice::SetObjectBuffer(int id, unsigned int buffer)
|
||||
{
|
||||
alSourcei (m_sources[id], AL_BUFFER, m_buffers[buffer]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// check if the sound's still playing
|
||||
int SND_OpenALDevice::GetPlayState(int id)
|
||||
{
|
||||
int alstate = 0;
|
||||
int result = 0;
|
||||
|
||||
#ifdef __APPLE__
|
||||
alGetSourcei(m_sources[id], AL_SOURCE_STATE, &alstate);
|
||||
#else
|
||||
alGetSourceiv(m_sources[id], AL_SOURCE_STATE, &alstate);
|
||||
#endif
|
||||
|
||||
switch(alstate)
|
||||
{
|
||||
case AL_INITIAL:
|
||||
{
|
||||
result = SND_INITIAL;
|
||||
break;
|
||||
}
|
||||
case AL_PLAYING:
|
||||
{
|
||||
result = SND_PLAYING;
|
||||
break;
|
||||
}
|
||||
case AL_PAUSED:
|
||||
{
|
||||
result = SND_PAUSED;
|
||||
break;
|
||||
}
|
||||
case AL_STOPPED:
|
||||
{
|
||||
result = SND_STOPPED;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
result = SND_UNKNOWN;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// make the source play
|
||||
void SND_OpenALDevice::PlayObject(int id)
|
||||
{
|
||||
alSourcePlay(m_sources[id]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// make the source stop
|
||||
void SND_OpenALDevice::StopObject(int id) const
|
||||
{
|
||||
float obpos[3] = {0,0,0};
|
||||
float obvel[3] = {0,0,0};
|
||||
|
||||
alSourcefv(m_sources[id], AL_POSITION, obpos);
|
||||
alSourcefv(m_sources[id], AL_VELOCITY, obvel);
|
||||
|
||||
alSourcef(m_sources[id], AL_GAIN, 1.0);
|
||||
alSourcef(m_sources[id], AL_PITCH, 1.0);
|
||||
alSourcei(m_sources[id], AL_LOOPING, AL_FALSE);
|
||||
alSourceStop(m_sources[id]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// stop all sources
|
||||
void SND_OpenALDevice::StopAllObjects()
|
||||
{
|
||||
alSourceStopv(NUM_SOURCES, m_sources);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// pause the source
|
||||
void SND_OpenALDevice::PauseObject(int id) const
|
||||
{
|
||||
alSourcePause(m_sources[id]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// source properties stuff ////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
// give openal the object's pitch
|
||||
void SND_OpenALDevice::SetObjectPitch(int id, MT_Scalar pitch) const
|
||||
{
|
||||
alSourcef (m_sources[id], AL_PITCH, (float)pitch);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// give openal the object's gain
|
||||
void SND_OpenALDevice::SetObjectGain(int id, MT_Scalar gain) const
|
||||
{
|
||||
alSourcef (m_sources[id], AL_GAIN, (float)gain);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// give openal the object's looping
|
||||
void SND_OpenALDevice::SetObjectLoop(int id, unsigned int loopmode) const
|
||||
{
|
||||
if (loopmode == SND_LOOP_OFF)
|
||||
{
|
||||
//printf("%d - ", id);
|
||||
alSourcei (m_sources[id], AL_LOOPING, AL_FALSE);
|
||||
}
|
||||
else
|
||||
alSourcei (m_sources[id], AL_LOOPING, AL_TRUE);
|
||||
}
|
||||
|
||||
void SND_OpenALDevice::SetObjectLoopPoints(int id, unsigned int loopstart, unsigned int loopend) const
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SND_OpenALDevice::SetObjectMinGain(int id, MT_Scalar mingain) const
|
||||
{
|
||||
alSourcef (m_sources[id], AL_MIN_GAIN, (float)mingain);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_OpenALDevice::SetObjectMaxGain(int id, MT_Scalar maxgain) const
|
||||
{
|
||||
alSourcef (m_sources[id], AL_MAX_GAIN, (float)maxgain);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_OpenALDevice::SetObjectRollOffFactor(int id, MT_Scalar rollofffactor) const
|
||||
{
|
||||
alSourcef (m_sources[id], AL_ROLLOFF_FACTOR, (float)rollofffactor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_OpenALDevice::SetObjectReferenceDistance(int id, MT_Scalar referencedistance) const
|
||||
{
|
||||
alSourcef (m_sources[id], AL_REFERENCE_DISTANCE, (float)referencedistance);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// give openal the object's position
|
||||
void SND_OpenALDevice::ObjectIs2D(int id) const
|
||||
{
|
||||
float obpos[3] = {0,0,0};
|
||||
float obvel[3] = {0,0,0};
|
||||
|
||||
alSourcefv(m_sources[id], AL_POSITION, obpos);
|
||||
alSourcefv(m_sources[id], AL_VELOCITY, obvel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SND_OpenALDevice::SetObjectTransform(int id,
|
||||
const MT_Vector3& position,
|
||||
const MT_Vector3& velocity,
|
||||
const MT_Matrix3x3& orientation,
|
||||
const MT_Vector3& lisposition,
|
||||
const MT_Scalar& rollofffactor) const
|
||||
{
|
||||
float obpos[3];
|
||||
float obvel[3];
|
||||
|
||||
obpos[0] = (float)position[0] * (float)rollofffactor; //x (l/r)
|
||||
obpos[1] = (float)position[1] * (float)rollofffactor;
|
||||
obpos[2] = (float)position[2] * (float)rollofffactor;
|
||||
|
||||
alSourcefv(m_sources[id], AL_POSITION, obpos);
|
||||
|
||||
velocity.getValue(obvel);
|
||||
alSourcefv(m_sources[id], AL_VELOCITY, obvel);
|
||||
}
|
||||
|
||||
void SND_OpenALDevice::PlayCD(int track) const
|
||||
{
|
||||
#ifndef __APPLE__
|
||||
m_cdrom->PlayCD(track);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void SND_OpenALDevice::PauseCD(bool pause) const
|
||||
{
|
||||
#ifndef __APPLE__
|
||||
m_cdrom->PauseCD(pause);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SND_OpenALDevice::StopCD() const
|
||||
{
|
||||
#ifndef __APPLE__
|
||||
SND_CDObject* pCD = SND_CDObject::Instance();
|
||||
|
||||
if (pCD && pCD->GetUsed())
|
||||
{
|
||||
m_cdrom->StopCD();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SND_OpenALDevice::SetCDPlaymode(int playmode) const
|
||||
{
|
||||
#ifndef __APPLE__
|
||||
m_cdrom->SetCDPlaymode(playmode);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SND_OpenALDevice::SetCDGain(MT_Scalar gain) const
|
||||
{
|
||||
#ifndef __APPLE__
|
||||
m_cdrom->SetCDGain(gain);
|
||||
#endif
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
/**
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
#ifndef SND_OPENALDEVICE
|
||||
#define SND_OPENALDEVICE
|
||||
|
||||
#include "SND_AudioDevice.h"
|
||||
#include "SoundDefines.h"
|
||||
|
||||
struct SDL_CD;
|
||||
|
||||
class SND_OpenALDevice : public SND_AudioDevice
|
||||
{
|
||||
public:
|
||||
SND_OpenALDevice();
|
||||
virtual ~SND_OpenALDevice();
|
||||
|
||||
SND_WaveSlot* LoadSample(const STR_String& samplename,
|
||||
void* memlocation,
|
||||
int size);
|
||||
|
||||
void InitListener();
|
||||
void SetListenerGain(float gain) const;
|
||||
void SetDopplerVelocity(MT_Scalar dopplervelocity) const;
|
||||
void SetDopplerFactor(MT_Scalar dopplerfactor) const;
|
||||
void SetListenerRollOffFactor(MT_Scalar rollofffactor) const;
|
||||
|
||||
void MakeCurrent() const;
|
||||
|
||||
void NextFrame() const;
|
||||
void UseCD() const;
|
||||
|
||||
void SetObjectBuffer(int id, unsigned int buffer);
|
||||
|
||||
int GetPlayState(int id);
|
||||
void PlayObject(int id);
|
||||
void StopObject(int id) const;
|
||||
void StopAllObjects();
|
||||
void PauseObject(int id) const;
|
||||
|
||||
void SetObjectLoop(int id, unsigned int loopmode) const;
|
||||
void SetObjectLoopPoints(int id, unsigned int loopstart, unsigned int loopend) const;
|
||||
void SetObjectPitch(int id, MT_Scalar pitch) const;
|
||||
void SetObjectGain(int id, MT_Scalar gain) const;
|
||||
void SetObjectMinGain(int id, MT_Scalar mingain) const;
|
||||
void SetObjectMaxGain(int id, MT_Scalar maxgain) const;
|
||||
void SetObjectRollOffFactor(int id, MT_Scalar rolloff) const;
|
||||
void SetObjectReferenceDistance(int id, MT_Scalar distance) const;
|
||||
|
||||
void SetObjectTransform(int id,
|
||||
const MT_Vector3& position,
|
||||
const MT_Vector3& velocity,
|
||||
const MT_Matrix3x3& orientation,
|
||||
const MT_Vector3& lisposition,
|
||||
const MT_Scalar& rollofffactor) const;
|
||||
void ObjectIs2D(int id) const;
|
||||
|
||||
void PlayCD(int track) const;
|
||||
void PauseCD(bool pause) const;
|
||||
void StopCD() const;
|
||||
void SetCDPlaymode(int playmode) const;
|
||||
void SetCDGain(MT_Scalar gain) const;
|
||||
|
||||
void StartUsingDSP() {};
|
||||
float* GetSpectrum() { return NULL; }
|
||||
void StopUsingDSP() {};
|
||||
|
||||
private:
|
||||
void* m_context;
|
||||
void* m_device;
|
||||
|
||||
unsigned int m_buffers[NUM_BUFFERS];
|
||||
unsigned int m_sources[NUM_SOURCES];
|
||||
bool m_buffersinitialized;
|
||||
bool m_sourcesinitialized;
|
||||
#ifndef __APPLE__
|
||||
class SND_SDLCDDevice* m_cdrom;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif //SND_OPENALDEVICE
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
/* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
* FreeBSD 3.4 does not yet have pthread_cancel (3.5 and above do)
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
|
||||
#include <osreldate.h>
|
||||
|
||||
#if (__FreeBSD_version < 350000)
|
||||
#include <pthread.h>
|
||||
|
||||
#define FD_READ 0x1
|
||||
#define _FD_LOCK(_fd,_type,_ts) _thread_fd_lock(_fd, _type, _ts)
|
||||
#define _FD_UNLOCK(_fd,_type) _thread_fd_unlock(_fd, _type)
|
||||
|
||||
int pthread_cancel(pthread_t pthread) {
|
||||
pthread_exit(NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
long fpathconf(int fd, int name)
|
||||
{
|
||||
long ret;
|
||||
|
||||
if ((ret = _FD_LOCK(fd, FD_READ, NULL)) == 0) {
|
||||
ret = _thread_sys_fpathconf(fd, name);
|
||||
_FD_UNLOCK(fd, FD_READ);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int pthread_atfork(void *a, void *b, void *c) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,43 +0,0 @@
|
|||
#
|
||||
# $Id$
|
||||
#
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): none yet.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
#
|
||||
#
|
||||
|
||||
LIBNAME = SDLSoundSystem
|
||||
DIR = $(OCGDIR)/intern/$(LIBNAME)
|
||||
|
||||
include nan_compile.mk
|
||||
|
||||
CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
|
||||
|
||||
CPPFLAGS += $(NAN_SDLCFLAGS)
|
||||
CPPFLAGS += -I$(NAN_STRING)/include
|
||||
CPPFLAGS += -I$(NAN_MOTO)/include
|
||||
CPPFLAGS += -I../intern
|
||||
CPPFLAGS += -I..
|
||||
CPPFLAGS += -I.
|
|
@ -1,171 +0,0 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
* SND_SDLCDDevice
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
|
||||
#endif //WIN32
|
||||
|
||||
#include "MT_Scalar.h"
|
||||
|
||||
#include "SND_SDLCDDevice.h"
|
||||
#include "SoundDefines.h"
|
||||
|
||||
#ifndef DISABLE_SDL
|
||||
#include <SDL.h>
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
SND_SDLCDDevice::SND_SDLCDDevice() :
|
||||
m_cdrom(NULL),
|
||||
m_cdplaying(false),
|
||||
m_cdtrack(0),
|
||||
m_cdplaymode(SND_CD_TRACK),
|
||||
m_frame(0)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
void SND_SDLCDDevice::init()
|
||||
{
|
||||
#ifdef DISABLE_SDL
|
||||
fprintf(stderr, "Blender compiled without SDL, no CDROM support\n");
|
||||
return;
|
||||
#else
|
||||
if (SDL_InitSubSystem(SDL_INIT_CDROM))
|
||||
{
|
||||
fprintf(stderr, "Error initializing CDROM\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check for CD drives */
|
||||
if(!SDL_CDNumDrives())
|
||||
{
|
||||
/* None found */
|
||||
fprintf(stderr, "No CDROM devices available\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Open the default drive */
|
||||
m_cdrom = SDL_CDOpen(0);
|
||||
|
||||
/* Did if open? Check if cdrom is NULL */
|
||||
if(!m_cdrom)
|
||||
{
|
||||
fprintf(stderr, "Couldn't open drive: %s\n", SDL_GetError());
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
SND_SDLCDDevice::~SND_SDLCDDevice()
|
||||
{
|
||||
#ifndef DISABLE_SDL
|
||||
StopCD();
|
||||
SDL_CDClose(m_cdrom);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SND_SDLCDDevice::NextFrame()
|
||||
{
|
||||
#ifndef DISABLE_SDL
|
||||
m_frame++;
|
||||
m_frame &= 127;
|
||||
|
||||
if (!m_frame && m_cdrom && m_cdplaying && SDL_CDStatus(m_cdrom) == CD_STOPPED)
|
||||
{
|
||||
switch (m_cdplaymode)
|
||||
{
|
||||
case SND_CD_ALL:
|
||||
if (m_cdtrack < m_cdrom->numtracks)
|
||||
PlayCD(m_cdtrack + 1);
|
||||
else
|
||||
m_cdplaying = false;
|
||||
break;
|
||||
default:
|
||||
case SND_CD_TRACK:
|
||||
m_cdplaying = false;
|
||||
break;
|
||||
case SND_CD_TRACKLOOP:
|
||||
PlayCD(m_cdtrack);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SND_SDLCDDevice::PlayCD(int track)
|
||||
{
|
||||
#ifndef DISABLE_SDL
|
||||
if ( m_cdrom && CD_INDRIVE(SDL_CDStatus(m_cdrom)) ) {
|
||||
SDL_CDPlayTracks(m_cdrom, track-1, 0, track, 0);
|
||||
m_cdplaying = true;
|
||||
m_cdtrack = track;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void SND_SDLCDDevice::PauseCD(bool pause)
|
||||
{
|
||||
#ifndef DISABLE_SDL
|
||||
if (!m_cdrom)
|
||||
return;
|
||||
|
||||
if (pause)
|
||||
SDL_CDPause(m_cdrom);
|
||||
else
|
||||
SDL_CDResume(m_cdrom);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SND_SDLCDDevice::StopCD()
|
||||
{
|
||||
#ifndef DISABLE_SDL
|
||||
if (m_cdrom)
|
||||
SDL_CDStop(m_cdrom);
|
||||
m_cdplaying = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void SND_SDLCDDevice::SetCDPlaymode(int playmode)
|
||||
{
|
||||
m_cdplaymode = playmode;
|
||||
}
|
||||
|
||||
void SND_SDLCDDevice::SetCDGain(MT_Scalar gain)
|
||||
{
|
||||
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
/**
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
#ifndef SND_SDLCDDEVICE
|
||||
#define SND_SDLCDDEVICE
|
||||
|
||||
struct SDL_CD;
|
||||
|
||||
class SND_SDLCDDevice
|
||||
{
|
||||
public:
|
||||
SND_SDLCDDevice();
|
||||
~SND_SDLCDDevice();
|
||||
|
||||
void NextFrame();
|
||||
|
||||
void PlayCD(int track);
|
||||
void PauseCD(bool pause);
|
||||
void StopCD();
|
||||
void SetCDPlaymode(int playmode);
|
||||
void SetCDGain(MT_Scalar gain);
|
||||
|
||||
private:
|
||||
void init();
|
||||
/* CD Audio */
|
||||
SDL_CD* m_cdrom;
|
||||
bool m_cdplaying;
|
||||
int m_cdtrack;
|
||||
unsigned char m_cdplaymode;
|
||||
unsigned char m_frame;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,8 +1,4 @@
|
|||
/*
|
||||
* SND_Object.h
|
||||
*
|
||||
* Abstract sound object
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
|
@ -19,7 +15,7 @@
|
|||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
|
@ -29,26 +25,33 @@
|
|||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __SND_OBJECT_H
|
||||
#define __SND_OBJECT_H
|
||||
|
||||
#include "GEN_List.h"
|
||||
#include "MT_Matrix3x3.h"
|
||||
#include "SoundDefines.h"
|
||||
|
||||
/**
|
||||
* SND_Object is an interface class for soundobjects, listeners and other
|
||||
* kinds of sound related thingies.
|
||||
/** \file container/CTR_HashedPtr.h
|
||||
* \ingroup ctr
|
||||
*/
|
||||
|
||||
class SND_Object : public GEN_Link
|
||||
#ifndef CTR_HASHEDPTR_H
|
||||
#define CTR_HASHEDPTR_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
inline unsigned int CTR_Hash(void *inDWord)
|
||||
{
|
||||
size_t key = (size_t)inDWord;
|
||||
return (unsigned int)(key ^ (key>>4));
|
||||
}
|
||||
|
||||
class CTR_HashedPtr
|
||||
{
|
||||
void* m_valptr;
|
||||
public:
|
||||
SND_Object() {};
|
||||
virtual ~SND_Object() {};
|
||||
CTR_HashedPtr(void* val) : m_valptr(val) {};
|
||||
unsigned int hash() const { return CTR_Hash(m_valptr);};
|
||||
inline friend bool operator ==(const CTR_HashedPtr & rhs, const CTR_HashedPtr & lhs) { return rhs.m_valptr == lhs.m_valptr;};
|
||||
void *getValue() const { return m_valptr; }
|
||||
};
|
||||
|
||||
#endif //__SND_OBJECT_H
|
||||
#endif //CTR_HASHEDPTR_H
|
||||
|
|
@ -6,4 +6,3 @@ sources = env.Glob('intern/*.cpp')
|
|||
incs = '. ../moto/include ../container ../memutil'
|
||||
|
||||
env.BlenderLib ('bf_intern_decimate', sources, Split(incs) , [], libtype=['core', 'player'], priority = [200, 100] )
|
||||
|
||||
|
|
|
@ -1,262 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* El'Beem - Free Surface Fluid Simulation with the Lattice Boltzmann Method
|
||||
* All code distributed as part of El'Beem is covered by the version 2 of the
|
||||
* GNU General Public License. See the file COPYING for details.
|
||||
* Copyright 2003-2006 Nils Thuerey
|
||||
*
|
||||
* API header
|
||||
*/
|
||||
#ifndef ELBEEM_API_H
|
||||
#define ELBEEM_API_H
|
||||
|
||||
|
||||
// simulation run callback function type (elbeemSimulationSettings->runsimCallback)
|
||||
// best use with FLUIDSIM_CBxxx defines below.
|
||||
// >parameters
|
||||
// return values: 0=continue, 1=stop, 2=abort
|
||||
// data pointer: user data pointer from elbeemSimulationSettings->runsimUserData
|
||||
// status integer: 1=running simulation, 2=new frame saved
|
||||
// frame integer: if status is 1, contains current frame number
|
||||
typedef int (*elbeemRunSimulationCallback)(void *data, int status, int frame);
|
||||
#define FLUIDSIM_CBRET_CONTINUE 0
|
||||
#define FLUIDSIM_CBRET_STOP 1
|
||||
#define FLUIDSIM_CBRET_ABORT 2
|
||||
#define FLUIDSIM_CBSTATUS_STEP 1
|
||||
#define FLUIDSIM_CBSTATUS_NEWFRAME 2
|
||||
|
||||
|
||||
// global settings for the simulation
|
||||
typedef struct elbeemSimulationSettings {
|
||||
/* version number */
|
||||
short version;
|
||||
/* id number of simulation domain, needed if more than a
|
||||
* single domain should be simulated */
|
||||
short domainId; // unused within blender
|
||||
|
||||
/* geometrical extent */
|
||||
float geoStart[3], geoSize[3];
|
||||
|
||||
/* resolutions */
|
||||
short resolutionxyz;
|
||||
short previewresxyz;
|
||||
/* size of the domain in real units (meters along largest resolution x,y,z extent) */
|
||||
float realsize;
|
||||
|
||||
/* fluid properties */
|
||||
double viscosity;
|
||||
/* gravity strength */
|
||||
float gravity[3];
|
||||
/* anim start end time */
|
||||
float animStart, aniFrameTime;
|
||||
/* no. of frames to simulate & output */
|
||||
short noOfFrames;
|
||||
/* g star param (LBM compressibility) */
|
||||
float gstar;
|
||||
/* activate refinement? */
|
||||
short maxRefine;
|
||||
/* probability for surface particle generation (0.0=off) */
|
||||
float generateParticles;
|
||||
/* amount of tracer particles to generate (0=off) */
|
||||
int numTracerParticles;
|
||||
|
||||
/* store output path, and file prefix for baked fluid surface */
|
||||
char outputPath[160+80];
|
||||
|
||||
/* channel for frame time, visc & gravity animations */
|
||||
int channelSizeFrameTime;
|
||||
float *channelFrameTime;
|
||||
int channelSizeViscosity;
|
||||
float *channelViscosity;
|
||||
int channelSizeGravity;
|
||||
float *channelGravity; // vector
|
||||
|
||||
/* boundary types and settings for domain walls */
|
||||
short domainobsType;
|
||||
float domainobsPartslip;
|
||||
/* generate speed vectors for vertices (e.g. for image based motion blur)*/
|
||||
short generateVertexVectors;
|
||||
/* strength of surface smoothing */
|
||||
float surfaceSmoothing;
|
||||
/* no. of surface subdivisions */
|
||||
int surfaceSubdivs;
|
||||
|
||||
/* global transformation to apply to fluidsim mesh */
|
||||
float surfaceTrafo[4*4];
|
||||
|
||||
/* development variables, testing for upcoming releases...*/
|
||||
float farFieldSize;
|
||||
|
||||
/* callback function to notify calling program of performed simulation steps
|
||||
* or newly available frame data, if NULL it is ignored */
|
||||
elbeemRunSimulationCallback runsimCallback;
|
||||
/* pointer passed to runsimCallback for user data storage */
|
||||
void* runsimUserData;
|
||||
|
||||
} elbeemSimulationSettings;
|
||||
|
||||
|
||||
// defines for elbeemMesh->type below
|
||||
/* please keep in sync with DNA_object_fluidsim.h */
|
||||
#define OB_FLUIDSIM_FLUID 4
|
||||
#define OB_FLUIDSIM_OBSTACLE 8
|
||||
#define OB_FLUIDSIM_INFLOW 16
|
||||
#define OB_FLUIDSIM_OUTFLOW 32
|
||||
#define OB_FLUIDSIM_PARTICLE 64
|
||||
#define OB_FLUIDSIM_CONTROL 128
|
||||
|
||||
// defines for elbeemMesh->obstacleType below
|
||||
#define FLUIDSIM_OBSTACLE_NOSLIP 1
|
||||
#define FLUIDSIM_OBSTACLE_PARTSLIP 2
|
||||
#define FLUIDSIM_OBSTACLE_FREESLIP 3
|
||||
|
||||
#define OB_VOLUMEINIT_VOLUME 1
|
||||
#define OB_VOLUMEINIT_SHELL 2
|
||||
#define OB_VOLUMEINIT_BOTH (OB_VOLUMEINIT_SHELL|OB_VOLUMEINIT_VOLUME)
|
||||
|
||||
// a single mesh object
|
||||
typedef struct elbeemMesh {
|
||||
/* obstacle,fluid or inflow or control ... */
|
||||
short type;
|
||||
/* id of simulation domain it belongs to */
|
||||
short parentDomainId;
|
||||
|
||||
/* vertices */
|
||||
int numVertices;
|
||||
float *vertices; // = float[n][3];
|
||||
/* animated vertices */
|
||||
int channelSizeVertices;
|
||||
float *channelVertices; // = float[channelSizeVertices* (n*3+1) ];
|
||||
|
||||
/* triangles */
|
||||
int numTriangles;
|
||||
int *triangles; // = int[][3];
|
||||
|
||||
/* animation channels */
|
||||
int channelSizeTranslation;
|
||||
float *channelTranslation;
|
||||
int channelSizeRotation;
|
||||
float *channelRotation;
|
||||
int channelSizeScale;
|
||||
float *channelScale;
|
||||
|
||||
/* active channel */
|
||||
int channelSizeActive;
|
||||
float *channelActive;
|
||||
/* initial velocity channel (e.g. for inflow) */
|
||||
int channelSizeInitialVel;
|
||||
float *channelInitialVel; // vector
|
||||
/* use initial velocity in object coordinates? (e.g. for rotation) */
|
||||
short localInivelCoords;
|
||||
/* boundary types and settings */
|
||||
short obstacleType;
|
||||
float obstaclePartslip;
|
||||
/* amount of force transfer from fluid to obj, 0=off, 1=normal */
|
||||
float obstacleImpactFactor;
|
||||
/* init volume, shell or both? use OB_VOLUMEINIT_xxx defines above */
|
||||
short volumeInitType;
|
||||
|
||||
/* name of the mesh, mostly for debugging */
|
||||
const char *name;
|
||||
|
||||
/* fluid control settings */
|
||||
float cpsTimeStart;
|
||||
float cpsTimeEnd;
|
||||
float cpsQuality;
|
||||
|
||||
int channelSizeAttractforceStrength;
|
||||
float *channelAttractforceStrength;
|
||||
int channelSizeAttractforceRadius;
|
||||
float *channelAttractforceRadius;
|
||||
int channelSizeVelocityforceStrength;
|
||||
float *channelVelocityforceStrength;
|
||||
int channelSizeVelocityforceRadius;
|
||||
float *channelVelocityforceRadius;
|
||||
} elbeemMesh;
|
||||
|
||||
// API functions
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
// reset elbeemSimulationSettings struct with defaults
|
||||
void elbeemResetSettings(struct elbeemSimulationSettings*);
|
||||
|
||||
// start fluidsim init (returns !=0 upon failure)
|
||||
int elbeemInit(void);
|
||||
|
||||
// frees fluidsim
|
||||
int elbeemFree(void);
|
||||
|
||||
// start fluidsim init (returns !=0 upon failure)
|
||||
int elbeemAddDomain(struct elbeemSimulationSettings*);
|
||||
|
||||
// get failure message during simulation or init
|
||||
// if an error occured (the string is copied into buffer,
|
||||
// max. length = 256 chars )
|
||||
void elbeemGetErrorString(char *buffer);
|
||||
|
||||
// reset elbeemMesh struct with zeroes
|
||||
void elbeemResetMesh(struct elbeemMesh*);
|
||||
|
||||
// add mesh as fluidsim object
|
||||
int elbeemAddMesh(struct elbeemMesh*);
|
||||
|
||||
// do the actual simulation
|
||||
int elbeemSimulate(void);
|
||||
|
||||
// continue a previously stopped simulation
|
||||
int elbeemContinueSimulation(void);
|
||||
|
||||
|
||||
// helper functions
|
||||
|
||||
// simplify animation channels
|
||||
// returns if the channel and its size changed
|
||||
int elbeemSimplifyChannelFloat(float *channel, int *size);
|
||||
int elbeemSimplifyChannelVec3(float *channel, int *size);
|
||||
|
||||
// helper functions implemented in utilities.cpp
|
||||
|
||||
/* set elbeem debug output level (0=off to 10=full on) */
|
||||
void elbeemSetDebugLevel(int level);
|
||||
/* elbeem debug output function, prints if debug level >0 */
|
||||
void elbeemDebugOut(char *msg);
|
||||
|
||||
/* estimate how much memory a given setup will require */
|
||||
double elbeemEstimateMemreq(int res,
|
||||
float sx, float sy, float sz,
|
||||
int refine, char *retstr);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
// internal defines, do not use for initializing elbeemMesh
|
||||
// structs, for these use OB_xxx defines above
|
||||
|
||||
/*! fluid geometry init types */
|
||||
// type "int" used, so max is 8
|
||||
#define FGI_FLAGSTART 16
|
||||
#define FGI_FLUID (1<<(FGI_FLAGSTART+ 0))
|
||||
#define FGI_NO_FLUID (1<<(FGI_FLAGSTART+ 1))
|
||||
#define FGI_BNDNO (1<<(FGI_FLAGSTART+ 2))
|
||||
#define FGI_BNDFREE (1<<(FGI_FLAGSTART+ 3))
|
||||
#define FGI_BNDPART (1<<(FGI_FLAGSTART+ 4))
|
||||
#define FGI_NO_BND (1<<(FGI_FLAGSTART+ 5))
|
||||
#define FGI_MBNDINFLOW (1<<(FGI_FLAGSTART+ 6))
|
||||
#define FGI_MBNDOUTFLOW (1<<(FGI_FLAGSTART+ 7))
|
||||
#define FGI_CONTROL (1<<(FGI_FLAGSTART+ 8))
|
||||
|
||||
// all boundary types at once
|
||||
#define FGI_ALLBOUNDS ( FGI_BNDNO | FGI_BNDFREE | FGI_BNDPART | FGI_MBNDINFLOW | FGI_MBNDOUTFLOW )
|
||||
|
||||
|
||||
#endif // ELBEEM_API_H
|
|
@ -13,4 +13,3 @@ if env['WITH_BF_CXX_GUARDEDALLOC']:
|
|||
incs = '.'
|
||||
|
||||
env.BlenderLib ('bf_intern_guardedalloc', sources, Split(incs), defs, libtype=['intern','player'], priority = [5,150] )
|
||||
|
||||
|
|
|
@ -98,9 +98,9 @@ public:
|
|||
Vector dw; //!< angular acceration vector
|
||||
public:
|
||||
RotationAcc():R(),w() {}
|
||||
explicit RotationAcc(const Rotation& _R):R(_R),w(Vector::Zero()){}
|
||||
RotationAcc(const Rotation& _R,const Vector& _w,const Vector& _dw):
|
||||
R(_R),w(_w),dw(_dw) {}
|
||||
explicit RotationAcc(const Rotation& R_):R(R_),w(Vector::Zero()){}
|
||||
RotationAcc(const Rotation& R_,const Vector& _w,const Vector& _dw):
|
||||
R(R_),w(_w),dw(_dw) {}
|
||||
IMETHOD RotationAcc& operator = (const RotationAcc& arg);
|
||||
IMETHOD RotationAcc& operator = (const Rotation& arg);
|
||||
IMETHOD static RotationAcc Identity();
|
||||
|
@ -152,9 +152,9 @@ public:
|
|||
VectorAcc p; //!< Translation, velocity and acceleration of origin.
|
||||
public:
|
||||
FrameAcc(){}
|
||||
explicit FrameAcc(const Frame& _T):M(_T.M),p(_T.p) {}
|
||||
FrameAcc(const Frame& _T,const Twist& _t,const Twist& _dt):
|
||||
M(_T.M,_t.rot,_dt.rot),p(_T.p,_t.vel,_dt.vel) {}
|
||||
explicit FrameAcc(const Frame& T_):M(T_.M),p(T_.p) {}
|
||||
FrameAcc(const Frame& T_,const Twist& _t,const Twist& _dt):
|
||||
M(T_.M,_t.rot,_dt.rot),p(T_.p,_t.vel,_dt.vel) {}
|
||||
FrameAcc(const RotationAcc& _M,const VectorAcc& _p):M(_M),p(_p) {}
|
||||
|
||||
IMETHOD FrameAcc& operator = (const FrameAcc& arg);
|
||||
|
|
|
@ -399,7 +399,7 @@ sgstrf (superlu_options_t *options, SuperMatrix *A,
|
|||
resetrep_col (nseg, segrep, &repfnz[k]);
|
||||
|
||||
#ifdef DEBUG
|
||||
// sprint_lu_col("[2]: ", jj, pivrow, xprune, &Glu);
|
||||
sprint_lu_col("[2]: ", jj, pivrow, xprune, &Glu);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -11,4 +11,3 @@ if env['WITH_BF_CXX_GUARDEDALLOC']:
|
|||
incs += ' #intern/guardedalloc'
|
||||
|
||||
env.BlenderLib ('bf_intern_string', sources, Split(incs), defs, libtype=['intern','player'], priority = [50,10] )
|
||||
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
#
|
||||
# $Id$
|
||||
#
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): none yet.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
all: plugins
|
||||
|
||||
plugins:
|
||||
@/bin/sh -c 'for i in *.c; do ../bmake $$i; done;'
|
||||
|
||||
clean:
|
||||
rm -rf *.o *.so
|
File diff suppressed because it is too large
Load Diff
|
@ -1,26 +0,0 @@
|
|||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
# constants
|
||||
import _bpy
|
||||
version = _bpy._VERSION
|
||||
version_string = _bpy._VERSION_STR
|
||||
home = _bpy._HOME
|
||||
binary_path = _bpy._BINPATH
|
|
@ -1,200 +0,0 @@
|
|||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8-80 compliant>
|
||||
|
||||
# for slightly faster access
|
||||
from bpy.__ops__ import add as op_add
|
||||
from bpy.__ops__ import remove as op_remove
|
||||
from bpy.__ops__ import dir as op_dir
|
||||
from bpy.__ops__ import call as op_call
|
||||
from bpy.__ops__ import as_string as op_as_string
|
||||
from bpy.__ops__ import get_rna as op_get_rna
|
||||
|
||||
# Keep in sync with WM_types.h
|
||||
context_dict = {
|
||||
'INVOKE_DEFAULT': 0,
|
||||
'INVOKE_REGION_WIN': 1,
|
||||
'INVOKE_AREA': 2,
|
||||
'INVOKE_SCREEN': 3,
|
||||
'EXEC_DEFAULT': 4,
|
||||
'EXEC_REGION_WIN': 5,
|
||||
'EXEC_AREA': 6,
|
||||
'EXEC_SCREEN': 7,
|
||||
}
|
||||
|
||||
|
||||
class bpy_ops(object):
|
||||
'''
|
||||
Fake module like class.
|
||||
|
||||
bpy.ops
|
||||
'''
|
||||
|
||||
def __getattr__(self, module):
|
||||
'''
|
||||
gets a bpy.ops submodule
|
||||
'''
|
||||
if module.startswith('__'):
|
||||
raise AttributeError(module)
|
||||
return bpy_ops_submodule(module)
|
||||
|
||||
def add(self, pyop):
|
||||
op_add(pyop)
|
||||
|
||||
def remove(self, pyop):
|
||||
op_remove(pyop)
|
||||
|
||||
def __dir__(self):
|
||||
|
||||
submodules = set()
|
||||
|
||||
# add this classes functions
|
||||
for id_name in dir(self.__class__):
|
||||
if not id_name.startswith('__'):
|
||||
submodules.add(id_name)
|
||||
|
||||
for id_name in op_dir():
|
||||
id_split = id_name.split('_OT_', 1)
|
||||
|
||||
if len(id_split) == 2:
|
||||
submodules.add(id_split[0].lower())
|
||||
else:
|
||||
submodules.add(id_split[0])
|
||||
|
||||
return list(submodules)
|
||||
|
||||
def __repr__(self):
|
||||
return "<module like class 'bpy.ops'>"
|
||||
|
||||
|
||||
class bpy_ops_submodule(object):
|
||||
'''
|
||||
Utility class to fake submodules.
|
||||
|
||||
eg. bpy.ops.object
|
||||
'''
|
||||
__keys__ = ('module',)
|
||||
|
||||
def __init__(self, module):
|
||||
self.module = module
|
||||
|
||||
def __getattr__(self, func):
|
||||
'''
|
||||
gets a bpy.ops.submodule function
|
||||
'''
|
||||
if func.startswith('__'):
|
||||
raise AttributeError(func)
|
||||
return bpy_ops_submodule_op(self.module, func)
|
||||
|
||||
def __dir__(self):
|
||||
|
||||
functions = set()
|
||||
|
||||
module_upper = self.module.upper()
|
||||
|
||||
for id_name in op_dir():
|
||||
id_split = id_name.split('_OT_', 1)
|
||||
if len(id_split) == 2 and module_upper == id_split[0]:
|
||||
functions.add(id_split[1])
|
||||
|
||||
return list(functions)
|
||||
|
||||
def __repr__(self):
|
||||
return "<module like class 'bpy.ops.%s'>" % self.module
|
||||
|
||||
|
||||
class bpy_ops_submodule_op(object):
|
||||
'''
|
||||
Utility class to fake submodule operators.
|
||||
|
||||
eg. bpy.ops.object.somefunc
|
||||
'''
|
||||
|
||||
__keys__ = ('module', 'func')
|
||||
|
||||
|
||||
def _get_doc(self):
|
||||
return op_as_string(self.idname())
|
||||
|
||||
__doc__ = property(_get_doc)
|
||||
|
||||
|
||||
def _get_doc(self):
|
||||
return op_as_string(self.idname())
|
||||
|
||||
__doc__ = property(_get_doc)
|
||||
|
||||
def __init__(self, module, func):
|
||||
self.module = module
|
||||
self.func = func
|
||||
|
||||
def idname(self):
|
||||
# submod.foo -> SUBMOD_OT_foo
|
||||
return self.module.upper() + '_OT_' + self.func
|
||||
|
||||
def __call__(self, *args, **kw):
|
||||
|
||||
# Get the operator from blender
|
||||
if len(args) > 2:
|
||||
raise ValueError("1 or 2 args execution context is supported")
|
||||
|
||||
C_dict = None
|
||||
|
||||
if args:
|
||||
|
||||
C_exec = 'EXEC_DEFAULT'
|
||||
|
||||
if len(args) == 2:
|
||||
C_exec = args[0]
|
||||
C_dict = args[1]
|
||||
else:
|
||||
if type(args[0]) != str:
|
||||
C_dict = args[0]
|
||||
else:
|
||||
C_exec = args[0]
|
||||
|
||||
try:
|
||||
context = context_dict[C_exec]
|
||||
except:
|
||||
raise ValueError("Expected a single context argument in: " + \
|
||||
str(list(context_dict.keys())))
|
||||
|
||||
if len(args) == 2:
|
||||
C_dict = args[1]
|
||||
|
||||
return op_call(self.idname(), C_dict, kw, context)
|
||||
|
||||
else:
|
||||
return op_call(self.idname(), C_dict, kw)
|
||||
|
||||
def get_rna(self):
|
||||
'''
|
||||
currently only used for 'bl_rna'
|
||||
'''
|
||||
return op_get_rna(self.idname())
|
||||
|
||||
def __repr__(self): # useful display, repr(op)
|
||||
return op_as_string(self.idname())
|
||||
|
||||
def __str__(self): # used for print(...)
|
||||
return "<function bpy.ops.%s.%s at 0x%x'>" % \
|
||||
(self.module, self.func, id(self))
|
||||
|
||||
import bpy
|
||||
bpy.ops = bpy_ops()
|
|
@ -1,111 +0,0 @@
|
|||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
import bpy
|
||||
|
||||
def collect_baseclasses(_class, bases):
|
||||
|
||||
if _class is type or _class is object:
|
||||
return bases
|
||||
|
||||
bases.append(_class)
|
||||
for _superclass in _class.__bases__:
|
||||
collect_baseclasses(_superclass, bases)
|
||||
|
||||
return bases
|
||||
|
||||
def collect_subclasses(_class, subs):
|
||||
|
||||
if _class is type or _class is object:
|
||||
return subs
|
||||
|
||||
subs.append(_class)
|
||||
for _subclass in _class.__subclasses__():
|
||||
collect_subclasses(_subclass, subs)
|
||||
|
||||
return subs
|
||||
|
||||
class DynMenu(bpy.types.Menu):
|
||||
|
||||
def draw(self, context):
|
||||
'''
|
||||
This is a draw function that is used to call all subclasses draw functions
|
||||
starting from the registered classes draw function and working down.
|
||||
|
||||
DynMenu.setup() must be called first.
|
||||
|
||||
Sort/group classes could be nice
|
||||
'''
|
||||
|
||||
subclass_ls = []
|
||||
collect_subclasses(self.__class__, subclass_ls)
|
||||
# print(subclass_ls)
|
||||
|
||||
for subclass in subclass_ls:
|
||||
# print("drawwing", subclass) # , dir(subclass))
|
||||
subclass.internal_draw(self, context)
|
||||
# print("subclass.internal_draw", subclass.internal_draw)
|
||||
|
||||
def setup(menu_class):
|
||||
'''
|
||||
Setup subclasses (not needed when self.add() is used)
|
||||
'''
|
||||
bases = collect_baseclasses(menu_class, [])
|
||||
|
||||
# Incase 'DynMenu' isnt last
|
||||
while bases[-1] is not DynMenu:
|
||||
bases.pop()
|
||||
bases.pop() # remove 'DynMenu'
|
||||
|
||||
root_class = bases[-1] # this is the registered class
|
||||
|
||||
for subclass in collect_subclasses(root_class, []):
|
||||
#print(subclass)
|
||||
|
||||
draw = getattr(subclass, 'draw', None)
|
||||
if draw and not hasattr(subclass, 'internal_draw'):
|
||||
# print("replace", subclass, draw)
|
||||
try:
|
||||
del subclass.draw
|
||||
except:
|
||||
pass
|
||||
subclass.internal_draw = draw
|
||||
|
||||
root_class.draw = DynMenu.draw
|
||||
|
||||
def add(menu_class, func):
|
||||
'''
|
||||
Add a single function directly without having to make a class
|
||||
|
||||
important that the returned value should be stored in the module that called it.
|
||||
'''
|
||||
|
||||
newclass = type('<menuclass>', (menu_class,), {})
|
||||
newclass.internal_draw = func
|
||||
setup(menu_class)
|
||||
return newclass
|
||||
|
||||
'''
|
||||
# so we dont need to import this module
|
||||
DynMenu.setup = setup
|
||||
DynMenu.add = add
|
||||
|
||||
# Only so we can access as bpy.types.
|
||||
# dont ever use this directly!
|
||||
bpy.types.register(DynMenu)
|
||||
'''
|
|
@ -1,154 +0,0 @@
|
|||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
import bpy
|
||||
import mathutils
|
||||
from math import cos, sin, pi
|
||||
|
||||
|
||||
def add_torus(major_rad, minor_rad, major_seg, minor_seg):
|
||||
Vector = mathutils.Vector
|
||||
Quaternion = mathutils.Quaternion
|
||||
|
||||
PI_2 = pi * 2.0
|
||||
z_axis = 0.0, 0.0, 1.0
|
||||
|
||||
verts = []
|
||||
faces = []
|
||||
i1 = 0
|
||||
tot_verts = major_seg * minor_seg
|
||||
for major_index in range(major_seg):
|
||||
quat = Quaternion(z_axis, (major_index / major_seg) * PI_2)
|
||||
|
||||
for minor_index in range(minor_seg):
|
||||
angle = 2 * pi * minor_index / minor_seg
|
||||
|
||||
vec = Vector((major_rad + (cos(angle) * minor_rad), 0.0,
|
||||
(sin(angle) * minor_rad))) * quat
|
||||
|
||||
verts.extend(vec[:])
|
||||
|
||||
if minor_index + 1 == minor_seg:
|
||||
i2 = (major_index) * minor_seg
|
||||
i3 = i1 + minor_seg
|
||||
i4 = i2 + minor_seg
|
||||
|
||||
else:
|
||||
i2 = i1 + 1
|
||||
i3 = i1 + minor_seg
|
||||
i4 = i3 + 1
|
||||
|
||||
if i2 >= tot_verts:
|
||||
i2 = i2 - tot_verts
|
||||
if i3 >= tot_verts:
|
||||
i3 = i3 - tot_verts
|
||||
if i4 >= tot_verts:
|
||||
i4 = i4 - tot_verts
|
||||
|
||||
# stupid eekadoodle
|
||||
if i2:
|
||||
faces.extend([i1, i3, i4, i2])
|
||||
else:
|
||||
faces.extend([i2, i1, i3, i4])
|
||||
|
||||
i1 += 1
|
||||
|
||||
return verts, faces
|
||||
|
||||
from bpy.props import *
|
||||
|
||||
|
||||
class AddTorus(bpy.types.Operator):
|
||||
'''Add a torus mesh'''
|
||||
bl_idname = "mesh.primitive_torus_add"
|
||||
bl_label = "Add Torus"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
major_radius = FloatProperty(name="Major Radius",
|
||||
description="Radius from the origin to the center of the cross sections",
|
||||
default=1.0, min=0.01, max=100.0)
|
||||
minor_radius = FloatProperty(name="Minor Radius",
|
||||
description="Radius of the torus' cross section",
|
||||
default=0.25, min=0.01, max=100.0)
|
||||
major_segments = IntProperty(name="Major Segments",
|
||||
description="Number of segments for the main ring of the torus",
|
||||
default=48, min=3, max=256)
|
||||
minor_segments = IntProperty(name="Minor Segments",
|
||||
description="Number of segments for the minor ring of the torus",
|
||||
default=12, min=3, max=256)
|
||||
use_abso = BoolProperty(name="Use Int+Ext Controls",
|
||||
description="Use the Int / Ext controls for torus dimensions",
|
||||
default=False)
|
||||
abso_major_rad = FloatProperty(name="Exterior Radius",
|
||||
description="Total Exterior Radius of the torus",
|
||||
default=1.0, min=0.01, max=100.0)
|
||||
abso_minor_rad = FloatProperty(name="Inside Radius",
|
||||
description="Total Interior Radius of the torus",
|
||||
default=0.5, min=0.01, max=100.0)
|
||||
|
||||
# generic transform props
|
||||
view_align = BoolProperty(name="Align to View",
|
||||
default=False)
|
||||
location = FloatVectorProperty(name="Location",
|
||||
subtype='TRANSLATION')
|
||||
rotation = FloatVectorProperty(name="Rotation",
|
||||
subtype='EULER')
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
if self.use_abso == True:
|
||||
extra_helper = (self.abso_major_rad - self.abso_minor_rad) * 0.5
|
||||
self.major_radius = self.abso_minor_rad + extra_helper
|
||||
self.minor_radius = extra_helper
|
||||
|
||||
verts_loc, faces = add_torus(self.major_radius,
|
||||
self.minor_radius,
|
||||
self.major_segments,
|
||||
self.minor_segments)
|
||||
|
||||
mesh = bpy.data.meshes.new("Torus")
|
||||
|
||||
mesh.vertices.add(len(verts_loc) // 3)
|
||||
mesh.faces.add(len(faces) // 4)
|
||||
|
||||
mesh.vertices.foreach_set("co", verts_loc)
|
||||
mesh.faces.foreach_set("vertices_raw", faces)
|
||||
mesh.update()
|
||||
|
||||
import add_object_utils
|
||||
add_object_utils.object_data_add(context, mesh, operator=self)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def menu_func(self, context):
|
||||
self.layout.operator(AddTorus.bl_idname, text="Torus", icon='MESH_TORUS')
|
||||
|
||||
|
||||
def register():
|
||||
bpy.utils.register_class(AddTorus)
|
||||
bpy.types.INFO_MT_mesh_add.append(menu_func)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_class(AddTorus)
|
||||
bpy.types.INFO_MT_mesh_add.remove(menu_func)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
|
@ -1,708 +0,0 @@
|
|||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
data_path_update = [
|
||||
("ClothCollisionSettings", "min_distance", "distance_min"),
|
||||
("ClothCollisionSettings", "self_min_distance", "self_distance_min"),
|
||||
("ClothCollisionSettings", "enable_collision", "use_collision"),
|
||||
("ClothCollisionSettings", "enable_self_collision", "use_self_collision"),
|
||||
("ClothSettings", "pin_cloth", "use_pin_cloth"),
|
||||
("ClothSettings", "stiffness_scaling", "use_stiffness_scale"),
|
||||
("CollisionSettings", "random_damping", "damping_random"),
|
||||
("CollisionSettings", "random_friction", "friction_random"),
|
||||
("CollisionSettings", "inner_thickness", "thickness_inner"),
|
||||
("CollisionSettings", "outer_thickness", "thickness_outer"),
|
||||
("CollisionSettings", "kill_particles", "use_particle_kill"),
|
||||
("Constraint", "proxy_local", "is_proxy_local"),
|
||||
("ActionConstraint", "maximum", "max"),
|
||||
("ActionConstraint", "minimum", "min"),
|
||||
("FollowPathConstraint", "use_fixed_position", "use_fixed_location"),
|
||||
("KinematicConstraint", "chain_length", "chain_count"),
|
||||
("KinematicConstraint", "pos_lock_x", "lock_location_x"),
|
||||
("KinematicConstraint", "pos_lock_y", "lock_location_y"),
|
||||
("KinematicConstraint", "pos_lock_z", "lock_location_z"),
|
||||
("KinematicConstraint", "rot_lock_x", "lock_rotation_x"),
|
||||
("KinematicConstraint", "rot_lock_y", "lock_rotation_y"),
|
||||
("KinematicConstraint", "rot_lock_z", "lock_rotation_z"),
|
||||
("KinematicConstraint", "axis_reference", "reference_axis"),
|
||||
("KinematicConstraint", "use_position", "use_location"),
|
||||
("LimitLocationConstraint", "maximum_x", "max_x"),
|
||||
("LimitLocationConstraint", "maximum_y", "max_y"),
|
||||
("LimitLocationConstraint", "maximum_z", "max_z"),
|
||||
("LimitLocationConstraint", "minimum_x", "min_x"),
|
||||
("LimitLocationConstraint", "minimum_y", "min_y"),
|
||||
("LimitLocationConstraint", "minimum_z", "min_z"),
|
||||
("LimitLocationConstraint", "use_maximum_x", "use_max_x"),
|
||||
("LimitLocationConstraint", "use_maximum_y", "use_max_y"),
|
||||
("LimitLocationConstraint", "use_maximum_z", "use_max_z"),
|
||||
("LimitLocationConstraint", "use_minimum_x", "use_min_x"),
|
||||
("LimitLocationConstraint", "use_minimum_y", "use_min_y"),
|
||||
("LimitLocationConstraint", "use_minimum_z", "use_min_z"),
|
||||
("LimitLocationConstraint", "limit_transform", "use_transform_limit"),
|
||||
("LimitRotationConstraint", "maximum_x", "max_x"),
|
||||
("LimitRotationConstraint", "maximum_y", "max_y"),
|
||||
("LimitRotationConstraint", "maximum_z", "max_z"),
|
||||
("LimitRotationConstraint", "minimum_x", "min_x"),
|
||||
("LimitRotationConstraint", "minimum_y", "min_y"),
|
||||
("LimitRotationConstraint", "minimum_z", "min_z"),
|
||||
("LimitRotationConstraint", "limit_transform", "use_transform_limit"),
|
||||
("LimitScaleConstraint", "maximum_x", "max_x"),
|
||||
("LimitScaleConstraint", "maximum_y", "max_y"),
|
||||
("LimitScaleConstraint", "maximum_z", "max_z"),
|
||||
("LimitScaleConstraint", "minimum_x", "min_x"),
|
||||
("LimitScaleConstraint", "minimum_y", "min_y"),
|
||||
("LimitScaleConstraint", "minimum_z", "min_z"),
|
||||
("LimitScaleConstraint", "use_maximum_x", "use_max_x"),
|
||||
("LimitScaleConstraint", "use_maximum_y", "use_max_y"),
|
||||
("LimitScaleConstraint", "use_maximum_z", "use_max_z"),
|
||||
("LimitScaleConstraint", "use_minimum_x", "use_min_x"),
|
||||
("LimitScaleConstraint", "use_minimum_y", "use_min_y"),
|
||||
("LimitScaleConstraint", "use_minimum_z", "use_min_z"),
|
||||
("LimitScaleConstraint", "limit_transform", "use_transform_limit"),
|
||||
("PivotConstraint", "enabled_rotation_range", "rotation_range"),
|
||||
("PivotConstraint", "use_relative_position", "use_relative_location"),
|
||||
("PythonConstraint", "number_of_targets", "target_count"),
|
||||
("SplineIKConstraint", "chain_length", "chain_count"),
|
||||
("SplineIKConstraint", "chain_offset", "use_chain_offset"),
|
||||
("SplineIKConstraint", "even_divisions", "use_even_divisions"),
|
||||
("SplineIKConstraint", "y_stretch", "use_y_stretch"),
|
||||
("SplineIKConstraint", "xz_scaling_mode", "xz_scale_mode"),
|
||||
("StretchToConstraint", "original_length", "rest_length"),
|
||||
("TrackToConstraint", "target_z", "use_target_z"),
|
||||
("TransformConstraint", "extrapolate_motion", "use_motion_extrapolate"),
|
||||
("FieldSettings", "do_location", "apply_to_location"),
|
||||
("FieldSettings", "do_rotation", "apply_to_rotation"),
|
||||
("FieldSettings", "maximum_distance", "distance_max"),
|
||||
("FieldSettings", "minimum_distance", "distance_min"),
|
||||
("FieldSettings", "radial_maximum", "radial_max"),
|
||||
("FieldSettings", "radial_minimum", "radial_min"),
|
||||
("FieldSettings", "force_2d", "use_2d_force"),
|
||||
("FieldSettings", "do_absorption", "use_absorption"),
|
||||
("FieldSettings", "global_coordinates", "use_global_coords"),
|
||||
("FieldSettings", "guide_path_add", "use_guide_path_add"),
|
||||
("FieldSettings", "multiple_springs", "use_multiple_springs"),
|
||||
("FieldSettings", "use_coordinates", "use_object_coords"),
|
||||
("FieldSettings", "root_coordinates", "use_root_coords"),
|
||||
("ControlFluidSettings", "reverse_frames", "use_reverse_frames"),
|
||||
("DomainFluidSettings", "real_world_size", "simulation_scale"),
|
||||
("DomainFluidSettings", "surface_smoothing", "surface_smooth"),
|
||||
("DomainFluidSettings", "reverse_frames", "use_reverse_frames"),
|
||||
("DomainFluidSettings", "generate_speed_vectors", "use_speed_vectors"),
|
||||
("DomainFluidSettings", "override_time", "use_time_override"),
|
||||
("FluidFluidSettings", "export_animated_mesh", "use_animated_mesh"),
|
||||
("InflowFluidSettings", "export_animated_mesh", "use_animated_mesh"),
|
||||
("InflowFluidSettings", "local_coordinates", "use_local_coords"),
|
||||
("ObstacleFluidSettings", "export_animated_mesh", "use_animated_mesh"),
|
||||
("OutflowFluidSettings", "export_animated_mesh", "use_animated_mesh"),
|
||||
("ParticleFluidSettings", "drops", "use_drops"),
|
||||
("ParticleFluidSettings", "floats", "use_floats"),
|
||||
("Armature", "drawtype", "draw_type"),
|
||||
("Armature", "layer_protection", "layers_protected"),
|
||||
("Armature", "auto_ik", "use_auto_ik"),
|
||||
("Armature", "delay_deform", "use_deform_delay"),
|
||||
("Armature", "deform_envelope", "use_deform_envelopes"),
|
||||
("Armature", "deform_quaternion", "use_deform_preserve_volume"),
|
||||
("Armature", "deform_vertexgroups", "use_deform_vertex_groups"),
|
||||
("Armature", "x_axis_mirror", "use_mirror_x"),
|
||||
("Curve", "width", "offset"),
|
||||
("Image", "animation_speed", "fps"),
|
||||
("Image", "animation_end", "frame_end"),
|
||||
("Image", "animation_start", "frame_start"),
|
||||
("Image", "animated", "use_animation"),
|
||||
("Image", "clamp_x", "use_clamp_x"),
|
||||
("Image", "clamp_y", "use_clamp_y"),
|
||||
("Image", "premultiply", "use_premultiply"),
|
||||
("AreaLamp", "shadow_ray_sampling_method", "shadow_ray_sample_method"),
|
||||
("AreaLamp", "only_shadow", "use_only_shadow"),
|
||||
("AreaLamp", "shadow_layer", "use_shadow_layer"),
|
||||
("AreaLamp", "umbra", "use_umbra"),
|
||||
("PointLamp", "shadow_ray_sampling_method", "shadow_ray_sample_method"),
|
||||
("PointLamp", "only_shadow", "use_only_shadow"),
|
||||
("PointLamp", "shadow_layer", "use_shadow_layer"),
|
||||
("PointLamp", "sphere", "use_sphere"),
|
||||
("SpotLamp", "shadow_ray_sampling_method", "shadow_ray_sample_method"),
|
||||
("SpotLamp", "auto_clip_end", "use_auto_clip_end"),
|
||||
("SpotLamp", "auto_clip_start", "use_auto_clip_start"),
|
||||
("SpotLamp", "only_shadow", "use_only_shadow"),
|
||||
("SpotLamp", "shadow_layer", "use_shadow_layer"),
|
||||
("SpotLamp", "sphere", "use_sphere"),
|
||||
("SunLamp", "only_shadow", "use_only_shadow"),
|
||||
("SunLamp", "shadow_layer", "use_shadow_layer"),
|
||||
("Material", "z_offset", "offset_z"),
|
||||
("Material", "shadow_casting_alpha", "shadow_cast_alpha"),
|
||||
("Material", "cast_approximate", "use_cast_approximate"),
|
||||
("Material", "cast_buffer_shadows", "use_cast_buffer_shadows"),
|
||||
("Material", "cast_shadows_only", "use_cast_shadows_only"),
|
||||
("Material", "face_texture", "use_face_texture"),
|
||||
("Material", "face_texture_alpha", "use_face_texture_alpha"),
|
||||
("Material", "full_oversampling", "use_full_oversampling"),
|
||||
("Material", "light_group_exclusive", "use_light_group_exclusive"),
|
||||
("Material", "object_color", "use_object_color"),
|
||||
("Material", "only_shadow", "use_only_shadow"),
|
||||
("Material", "ray_shadow_bias", "use_ray_shadow_bias"),
|
||||
("Material", "traceable", "use_raytrace"),
|
||||
("Material", "shadeless", "use_shadeless"),
|
||||
("Material", "tangent_shading", "use_tangent_shading"),
|
||||
("Material", "transparency", "use_transparency"),
|
||||
("Material", "receive_transparent_shadows", "use_transparent_shadows"),
|
||||
("Material", "vertex_color_light", "use_vertex_color_light"),
|
||||
("Material", "vertex_color_paint", "use_vertex_color_paint"),
|
||||
("Mesh", "autosmooth_angle", "auto_smooth_angle"),
|
||||
("Mesh", "autosmooth", "use_auto_smooth"),
|
||||
("Object", "max_draw_type", "draw_type"),
|
||||
("Object", "use_dupli_verts_rotation", "use_dupli_vertices_rotation"),
|
||||
("Object", "shape_key_edit_mode", "use_shape_key_edit_mode"),
|
||||
("Object", "slow_parent", "use_slow_parent"),
|
||||
("Object", "time_offset_add_parent", "use_time_offset_add_parent"),
|
||||
("Object", "time_offset_edit", "use_time_offset_edit"),
|
||||
("Object", "time_offset_parent", "use_time_offset_parent"),
|
||||
("Object", "time_offset_particle", "use_time_offset_particle"),
|
||||
("ParticleSettings", "adaptive_pix", "adaptive_pixel"),
|
||||
("ParticleSettings", "child_effector", "apply_effector_to_children"),
|
||||
("ParticleSettings", "child_guide", "apply_guide_to_children"),
|
||||
("ParticleSettings", "billboard_split_offset", "billboard_offset_split"),
|
||||
("ParticleSettings", "billboard_random_tilt", "billboard_tilt_random"),
|
||||
("ParticleSettings", "child_length_thres", "child_length_threshold"),
|
||||
("ParticleSettings", "child_random_size", "child_size_random"),
|
||||
("ParticleSettings", "clumppow", "clump_shape"),
|
||||
("ParticleSettings", "damp_factor", "damping"),
|
||||
("ParticleSettings", "draw_as", "draw_method"),
|
||||
("ParticleSettings", "random_factor", "factor_random"),
|
||||
("ParticleSettings", "grid_invert", "invert_grid"),
|
||||
("ParticleSettings", "random_length", "length_random"),
|
||||
("ParticleSettings", "random_lifetime", "lifetime_random"),
|
||||
("ParticleSettings", "billboard_lock", "lock_billboard"),
|
||||
("ParticleSettings", "boids_2d", "lock_boids_to_surface"),
|
||||
("ParticleSettings", "object_aligned_factor", "object_align_factor"),
|
||||
("ParticleSettings", "random_phase_factor", "phase_factor_random"),
|
||||
("ParticleSettings", "ren_as", "render_type"),
|
||||
("ParticleSettings", "rendered_child_nbr", "rendered_child_count"),
|
||||
("ParticleSettings", "random_rotation_factor", "rotation_factor_random"),
|
||||
("ParticleSettings", "rough1", "roughness_1"),
|
||||
("ParticleSettings", "rough1_size", "roughness_1_size"),
|
||||
("ParticleSettings", "rough2", "roughness_2"),
|
||||
("ParticleSettings", "rough2_size", "roughness_2_size"),
|
||||
("ParticleSettings", "rough2_thres", "roughness_2_threshold"),
|
||||
("ParticleSettings", "rough_end_shape", "roughness_end_shape"),
|
||||
("ParticleSettings", "rough_endpoint", "roughness_endpoint"),
|
||||
("ParticleSettings", "random_size", "size_random"),
|
||||
("ParticleSettings", "abs_path_time", "use_absolute_path_time"),
|
||||
("ParticleSettings", "animate_branching", "use_animate_branching"),
|
||||
("ParticleSettings", "branching", "use_branching"),
|
||||
("ParticleSettings", "died", "use_dead"),
|
||||
("ParticleSettings", "die_on_collision", "use_die_on_collision"),
|
||||
("ParticleSettings", "rotation_dynamic", "use_dynamic_rotation"),
|
||||
("ParticleSettings", "even_distribution", "use_even_distribution"),
|
||||
("ParticleSettings", "rand_group", "use_group_pick_random"),
|
||||
("ParticleSettings", "hair_bspline", "use_hair_bspline"),
|
||||
("ParticleSettings", "sizemass", "use_multiply_size_mass"),
|
||||
("ParticleSettings", "react_multiple", "use_react_multiple"),
|
||||
("ParticleSettings", "react_start_end", "use_react_start_end"),
|
||||
("ParticleSettings", "render_adaptive", "use_render_adaptive"),
|
||||
("ParticleSettings", "self_effect", "use_self_effect"),
|
||||
("ParticleSettings", "enable_simplify", "use_simplify"),
|
||||
("ParticleSettings", "size_deflect", "use_size_deflect"),
|
||||
("ParticleSettings", "render_strand", "use_strand_primitive"),
|
||||
("ParticleSettings", "symmetric_branching", "use_symmetric_branching"),
|
||||
("ParticleSettings", "velocity_length", "use_velocity_length"),
|
||||
("ParticleSettings", "whole_group", "use_whole_group"),
|
||||
("CloudsTexture", "noise_size", "noise_scale"),
|
||||
("DistortedNoiseTexture", "noise_size", "noise_scale"),
|
||||
("EnvironmentMapTexture", "filter_size_minimum", "use_filter_size_min"),
|
||||
("EnvironmentMapTexture", "mipmap_gauss", "use_mipmap_gauss"),
|
||||
("ImageTexture", "calculate_alpha", "use_calculate_alpha"),
|
||||
("ImageTexture", "checker_even", "use_checker_even"),
|
||||
("ImageTexture", "checker_odd", "use_checker_odd"),
|
||||
("ImageTexture", "filter_size_minimum", "use_filter_size_min"),
|
||||
("ImageTexture", "flip_axis", "use_flip_axis"),
|
||||
("ImageTexture", "mipmap_gauss", "use_mipmap_gauss"),
|
||||
("ImageTexture", "mirror_x", "use_mirror_x"),
|
||||
("ImageTexture", "mirror_y", "use_mirror_y"),
|
||||
("ImageTexture", "normal_map", "use_normal_map"),
|
||||
("MarbleTexture", "noise_size", "noise_scale"),
|
||||
("MarbleTexture", "noisebasis2", "noisebasis_2"),
|
||||
("MusgraveTexture", "highest_dimension", "dimension_max"),
|
||||
("MusgraveTexture", "noise_size", "noise_scale"),
|
||||
("StucciTexture", "noise_size", "noise_scale"),
|
||||
("VoronoiTexture", "coloring", "color_mode"),
|
||||
("VoronoiTexture", "noise_size", "noise_scale"),
|
||||
("WoodTexture", "noise_size", "noise_scale"),
|
||||
("WoodTexture", "noisebasis2", "noisebasis_2"),
|
||||
("World", "blend_sky", "use_sky_blend"),
|
||||
("World", "paper_sky", "use_sky_paper"),
|
||||
("World", "real_sky", "use_sky_real"),
|
||||
("ImageUser", "auto_refresh", "use_auto_refresh"),
|
||||
("MaterialHalo", "flares_sub", "flare_subflare_count"),
|
||||
("MaterialHalo", "flare_subsize", "flare_subflare_size"),
|
||||
("MaterialHalo", "line_number", "line_count"),
|
||||
("MaterialHalo", "rings", "ring_count"),
|
||||
("MaterialHalo", "star_tips", "star_tip_count"),
|
||||
("MaterialHalo", "xalpha", "use_extreme_alpha"),
|
||||
("MaterialHalo", "flare_mode", "use_flare_mode"),
|
||||
("MaterialHalo", "vertex_normal", "use_vertex_normal"),
|
||||
("MaterialPhysics", "align_to_normal", "use_normal_align"),
|
||||
("MaterialStrand", "min_size", "size_min"),
|
||||
("MaterialStrand", "blender_units", "use_blender_units"),
|
||||
("MaterialStrand", "surface_diffuse", "use_surface_diffuse"),
|
||||
("MaterialStrand", "tangent_shading", "use_tangent_shading"),
|
||||
("MaterialSubsurfaceScattering", "error_tolerance", "error_threshold"),
|
||||
("MaterialVolume", "depth_cutoff", "depth_threshold"),
|
||||
("MaterialVolume", "lighting_mode", "light_method"),
|
||||
("MaterialVolume", "step_calculation", "step_method"),
|
||||
("MaterialVolume", "external_shadows", "use_external_shadows"),
|
||||
("MaterialVolume", "light_cache", "use_light_cache"),
|
||||
("ArmatureModifier", "multi_modifier", "use_multi_modifier"),
|
||||
("ArrayModifier", "constant_offset_displacement", "constant_offset_displace"),
|
||||
("ArrayModifier", "merge_distance", "merge_threshold"),
|
||||
("ArrayModifier", "relative_offset_displacement", "relative_offset_displace"),
|
||||
("ArrayModifier", "constant_offset", "use_constant_offset"),
|
||||
("ArrayModifier", "merge_adjacent_vertices", "use_merge_vertices"),
|
||||
("ArrayModifier", "merge_end_vertices", "use_merge_vertices_cap"),
|
||||
("ArrayModifier", "add_offset_object", "use_object_offset"),
|
||||
("ArrayModifier", "relative_offset", "use_relative_offset"),
|
||||
("BevelModifier", "only_vertices", "use_only_vertices"),
|
||||
("CastModifier", "from_radius", "use_radius_as_size"),
|
||||
("DisplaceModifier", "midlevel", "mid_level"),
|
||||
("DisplaceModifier", "texture_coordinates", "texture_coords"),
|
||||
("EdgeSplitModifier", "use_sharp", "use_edge_sharp"),
|
||||
("ExplodeModifier", "split_edges", "use_edge_split"),
|
||||
("MirrorModifier", "merge_limit", "merge_threshold"),
|
||||
("MirrorModifier", "mirror_u", "use_mirror_u"),
|
||||
("MirrorModifier", "mirror_v", "use_mirror_v"),
|
||||
("MirrorModifier", "mirror_vertex_groups", "use_mirror_vertex_groups"),
|
||||
("ParticleInstanceModifier", "particle_system_number", "particle_system_index"),
|
||||
("ParticleInstanceModifier", "keep_shape", "use_preserve_shape"),
|
||||
("ShrinkwrapModifier", "cull_back_faces", "use_cull_back_faces"),
|
||||
("ShrinkwrapModifier", "cull_front_faces", "use_cull_front_faces"),
|
||||
("ShrinkwrapModifier", "keep_above_surface", "use_keep_above_surface"),
|
||||
("SimpleDeformModifier", "lock_x_axis", "lock_x"),
|
||||
("SimpleDeformModifier", "lock_y_axis", "lock_y"),
|
||||
("SmokeModifier", "smoke_type", "type"),
|
||||
("SubsurfModifier", "subsurf_uv", "use_subsurf_uv"),
|
||||
("UVProjectModifier", "num_projectors", "projector_count"),
|
||||
("UVProjectModifier", "override_image", "use_image_override"),
|
||||
("WaveModifier", "texture_coordinates", "texture_coords"),
|
||||
("WaveModifier", "x_normal", "use_normal_x"),
|
||||
("WaveModifier", "y_normal", "use_normal_y"),
|
||||
("WaveModifier", "z_normal", "use_normal_z"),
|
||||
("NlaStrip", "blending", "blend_type"),
|
||||
("NlaStrip", "animated_influence", "use_animated_influence"),
|
||||
("NlaStrip", "animated_time", "use_animated_time"),
|
||||
("NlaStrip", "animated_time_cyclic", "use_animated_time_cyclic"),
|
||||
("NlaStrip", "auto_blending", "use_auto_blend"),
|
||||
("CompositorNodeAlphaOver", "convert_premul", "use_premultiply"),
|
||||
("CompositorNodeBlur", "sizex", "size_x"),
|
||||
("CompositorNodeBlur", "sizey", "size_y"),
|
||||
("CompositorNodeChannelMatte", "algorithm", "limit_method"),
|
||||
("CompositorNodeChromaMatte", "acceptance", "tolerance"),
|
||||
("CompositorNodeColorBalance", "correction_formula", "correction_method"),
|
||||
("CompositorNodeColorSpill", "algorithm", "limit_method"),
|
||||
("CompositorNodeColorSpill", "unspill", "use_unspill"),
|
||||
("CompositorNodeCrop", "x2", "max_x"),
|
||||
("CompositorNodeCrop", "y2", "max_y"),
|
||||
("CompositorNodeCrop", "x1", "min_x"),
|
||||
("CompositorNodeCrop", "y1", "min_y"),
|
||||
("CompositorNodeCrop", "crop_size", "use_crop_size"),
|
||||
("CompositorNodeDefocus", "max_blur", "blur_max"),
|
||||
("CompositorNodeDefocus", "gamma_correction", "use_gamma_correction"),
|
||||
("CompositorNodeGlare", "rotate_45", "use_rotate_45"),
|
||||
("CompositorNodeImage", "auto_refresh", "use_auto_refresh"),
|
||||
("CompositorNodeLensdist", "projector", "use_projector"),
|
||||
("CompositorNodeVecBlur", "max_speed", "speed_max"),
|
||||
("CompositorNodeVecBlur", "min_speed", "speed_min"),
|
||||
("ShaderNodeMapping", "maximum", "max"),
|
||||
("ShaderNodeMapping", "minimum", "min"),
|
||||
("ShaderNodeMapping", "clamp_maximum", "use_max"),
|
||||
("ShaderNodeMapping", "clamp_minimum", "use_min"),
|
||||
("VertexPaint", "all_faces", "use_all_faces"),
|
||||
("VertexPaint", "spray", "use_spray"),
|
||||
("ParticleEdit", "add_keys", "default_key_count"),
|
||||
("ParticleEdit", "selection_mode", "select_mode"),
|
||||
("ParticleEdit", "auto_velocity", "use_auto_velocity"),
|
||||
("ParticleEdit", "add_interpolate", "use_default_interpolate"),
|
||||
("ParticleEdit", "emitter_deflect", "use_emitter_deflect"),
|
||||
("ParticleEdit", "fade_time", "use_fade_time"),
|
||||
("ParticleEdit", "keep_lengths", "use_preserve_length"),
|
||||
("ParticleEdit", "keep_root", "use_preserve_root"),
|
||||
("ParticleSystem", "vertex_group_clump_negate", "invert_vertex_group_clump"),
|
||||
("ParticleSystem", "vertex_group_density_negate", "invert_vertex_group_density"),
|
||||
("ParticleSystem", "vertex_group_field_negate", "invert_vertex_group_field"),
|
||||
("ParticleSystem", "vertex_group_kink_negate", "invert_vertex_group_kink"),
|
||||
("ParticleSystem", "vertex_group_length_negate", "invert_vertex_group_length"),
|
||||
("ParticleSystem", "vertex_group_rotation_negate", "invert_vertex_group_rotation"),
|
||||
("ParticleSystem", "vertex_group_roughness1_negate", "invert_vertex_group_roughness_1"),
|
||||
("ParticleSystem", "vertex_group_roughness2_negate", "invert_vertex_group_roughness_2"),
|
||||
("ParticleSystem", "vertex_group_roughness_end_negate", "invert_vertex_group_roughness_end"),
|
||||
("ParticleSystem", "vertex_group_size_negate", "invert_vertex_group_size"),
|
||||
("ParticleSystem", "vertex_group_tangent_negate", "invert_vertex_group_tangent"),
|
||||
("ParticleSystem", "vertex_group_velocity_negate", "invert_vertex_group_velocity"),
|
||||
("ParticleSystem", "hair_dynamics", "use_hair_dynamics"),
|
||||
("ParticleSystem", "keyed_timing", "use_keyed_timing"),
|
||||
("PointDensity", "falloff_softness", "falloff_soft"),
|
||||
("PointDensity", "particle_cache", "particle_cache_space"),
|
||||
("PointDensity", "turbulence_size", "turbulence_scale"),
|
||||
("PointDensity", "turbulence", "use_turbulence"),
|
||||
("PointDensity", "vertices_cache", "vertex_cache_space"),
|
||||
("PoseBone", "ik_lin_weight", "ik_linear_weight"),
|
||||
("PoseBone", "ik_rot_weight", "ik_rotation_weight"),
|
||||
("PoseBone", "ik_limit_x", "use_ik_limit_x"),
|
||||
("PoseBone", "ik_limit_y", "use_ik_limit_y"),
|
||||
("PoseBone", "ik_limit_z", "use_ik_limit_z"),
|
||||
("PoseBone", "ik_lin_control", "use_ik_linear_control"),
|
||||
("PoseBone", "ik_rot_control", "use_ik_rotation_control"),
|
||||
("Bone", "use_hinge", "use_inherit_rotation"),
|
||||
("SPHFluidSettings", "spring_k", "spring_force"),
|
||||
("SPHFluidSettings", "stiffness_k", "stiffness"),
|
||||
("SPHFluidSettings", "stiffness_knear", "stiffness_near"),
|
||||
("SceneGameData", "framing_color", "frame_color"),
|
||||
("SceneGameData", "framing_type", "frame_type"),
|
||||
("SceneGameData", "eye_separation", "stereo_eye_separation"),
|
||||
("SceneGameData", "activity_culling", "use_activity_culling"),
|
||||
("SceneGameData", "auto_start", "use_auto_start"),
|
||||
("SceneGameData", "glsl_extra_textures", "use_glsl_extra_textures"),
|
||||
("SceneGameData", "glsl_lights", "use_glsl_lights"),
|
||||
("SceneGameData", "glsl_nodes", "use_glsl_nodes"),
|
||||
("SceneGameData", "glsl_ramps", "use_glsl_ramps"),
|
||||
("SceneGameData", "glsl_shaders", "use_glsl_shaders"),
|
||||
("SceneGameData", "glsl_shadows", "use_glsl_shadows"),
|
||||
("Sequence", "blend_opacity", "blend_alpha"),
|
||||
("Sequence", "blend_mode", "blend_type"),
|
||||
("Sequence", "frame_final_length", "frame_final_duration"),
|
||||
("Sequence", "use_effect_default_fade", "use_default_fade"),
|
||||
("SequenceColorBalance", "inverse_gain", "invert_gain"),
|
||||
("SequenceColorBalance", "inverse_gamma", "invert_gamma"),
|
||||
("SequenceColorBalance", "inverse_lift", "invert_lift"),
|
||||
("EffectSequence", "multiply_colors", "color_multiply"),
|
||||
("EffectSequence", "de_interlace", "use_deinterlace"),
|
||||
("EffectSequence", "flip_x", "use_flip_x"),
|
||||
("EffectSequence", "flip_y", "use_flip_y"),
|
||||
("EffectSequence", "convert_float", "use_float"),
|
||||
("EffectSequence", "premultiply", "use_premultiply"),
|
||||
("EffectSequence", "proxy_custom_directory", "use_proxy_custom_directory"),
|
||||
("EffectSequence", "proxy_custom_file", "use_proxy_custom_file"),
|
||||
("EffectSequence", "reverse_frames", "use_reverse_frames"),
|
||||
("GlowSequence", "blur_distance", "blur_radius"),
|
||||
("GlowSequence", "only_boost", "use_only_boost"),
|
||||
("SpeedControlSequence", "curve_compress_y", "use_curve_compress_y"),
|
||||
("SpeedControlSequence", "curve_velocity", "use_curve_velocity"),
|
||||
("SpeedControlSequence", "frame_blending", "use_frame_blend"),
|
||||
("TransformSequence", "uniform_scale", "use_uniform_scale"),
|
||||
("ImageSequence", "animation_end_offset", "animation_offset_end"),
|
||||
("ImageSequence", "animation_start_offset", "animation_offset_start"),
|
||||
("ImageSequence", "multiply_colors", "color_multiply"),
|
||||
("ImageSequence", "de_interlace", "use_deinterlace"),
|
||||
("ImageSequence", "flip_x", "use_flip_x"),
|
||||
("ImageSequence", "flip_y", "use_flip_y"),
|
||||
("ImageSequence", "convert_float", "use_float"),
|
||||
("ImageSequence", "premultiply", "use_premultiply"),
|
||||
("ImageSequence", "proxy_custom_directory", "use_proxy_custom_directory"),
|
||||
("ImageSequence", "proxy_custom_file", "use_proxy_custom_file"),
|
||||
("ImageSequence", "reverse_frames", "use_reverse_frames"),
|
||||
("MetaSequence", "animation_end_offset", "animation_offset_end"),
|
||||
("MetaSequence", "animation_start_offset", "animation_offset_start"),
|
||||
("MetaSequence", "multiply_colors", "color_multiply"),
|
||||
("MetaSequence", "de_interlace", "use_deinterlace"),
|
||||
("MetaSequence", "flip_x", "use_flip_x"),
|
||||
("MetaSequence", "flip_y", "use_flip_y"),
|
||||
("MetaSequence", "convert_float", "use_float"),
|
||||
("MetaSequence", "premultiply", "use_premultiply"),
|
||||
("MetaSequence", "proxy_custom_directory", "use_proxy_custom_directory"),
|
||||
("MetaSequence", "proxy_custom_file", "use_proxy_custom_file"),
|
||||
("MetaSequence", "reverse_frames", "use_reverse_frames"),
|
||||
("MovieSequence", "animation_end_offset", "animation_offset_end"),
|
||||
("MovieSequence", "animation_start_offset", "animation_offset_start"),
|
||||
("MovieSequence", "multiply_colors", "color_multiply"),
|
||||
("MovieSequence", "de_interlace", "use_deinterlace"),
|
||||
("MovieSequence", "flip_x", "use_flip_x"),
|
||||
("MovieSequence", "flip_y", "use_flip_y"),
|
||||
("MovieSequence", "convert_float", "use_float"),
|
||||
("MovieSequence", "premultiply", "use_premultiply"),
|
||||
("MovieSequence", "proxy_custom_directory", "use_proxy_custom_directory"),
|
||||
("MovieSequence", "proxy_custom_file", "use_proxy_custom_file"),
|
||||
("MovieSequence", "reverse_frames", "use_reverse_frames"),
|
||||
("MulticamSequence", "animation_end_offset", "animation_offset_end"),
|
||||
("MulticamSequence", "animation_start_offset", "animation_offset_start"),
|
||||
("MulticamSequence", "multiply_colors", "color_multiply"),
|
||||
("MulticamSequence", "de_interlace", "use_deinterlace"),
|
||||
("MulticamSequence", "flip_x", "use_flip_x"),
|
||||
("MulticamSequence", "flip_y", "use_flip_y"),
|
||||
("MulticamSequence", "convert_float", "use_float"),
|
||||
("MulticamSequence", "premultiply", "use_premultiply"),
|
||||
("MulticamSequence", "proxy_custom_directory", "use_proxy_custom_directory"),
|
||||
("MulticamSequence", "proxy_custom_file", "use_proxy_custom_file"),
|
||||
("MulticamSequence", "reverse_frames", "use_reverse_frames"),
|
||||
("SceneSequence", "animation_end_offset", "animation_offset_end"),
|
||||
("SceneSequence", "animation_start_offset", "animation_offset_start"),
|
||||
("SceneSequence", "multiply_colors", "color_multiply"),
|
||||
("SceneSequence", "de_interlace", "use_deinterlace"),
|
||||
("SceneSequence", "flip_x", "use_flip_x"),
|
||||
("SceneSequence", "flip_y", "use_flip_y"),
|
||||
("SceneSequence", "convert_float", "use_float"),
|
||||
("SceneSequence", "premultiply", "use_premultiply"),
|
||||
("SceneSequence", "proxy_custom_directory", "use_proxy_custom_directory"),
|
||||
("SceneSequence", "proxy_custom_file", "use_proxy_custom_file"),
|
||||
("SceneSequence", "reverse_frames", "use_reverse_frames"),
|
||||
("SoundSequence", "animation_end_offset", "animation_offset_end"),
|
||||
("SoundSequence", "animation_start_offset", "animation_offset_start"),
|
||||
("SmokeDomainSettings", "smoke_domain_colli", "collision_extents"),
|
||||
("SmokeDomainSettings", "smoke_cache_high_comp", "point_cache_compress_high_type"),
|
||||
("SmokeDomainSettings", "smoke_cache_comp", "point_cache_compress_type"),
|
||||
("SmokeDomainSettings", "maxres", "resolution_max"),
|
||||
("SmokeDomainSettings", "smoothemitter", "smooth_emitter"),
|
||||
("SmokeDomainSettings", "dissolve_smoke", "use_dissolve_smoke"),
|
||||
("SmokeDomainSettings", "dissolve_smoke_log", "use_dissolve_smoke_log"),
|
||||
("SmokeDomainSettings", "highres", "use_high_resolution"),
|
||||
("SoftBodySettings", "bending", "bend"),
|
||||
("SoftBodySettings", "error_limit", "error_threshold"),
|
||||
("SoftBodySettings", "lcom", "location_mass_center"),
|
||||
("SoftBodySettings", "lrot", "rotation_estimate"),
|
||||
("SoftBodySettings", "lscale", "scale_estimate"),
|
||||
("SoftBodySettings", "maxstep", "step_max"),
|
||||
("SoftBodySettings", "minstep", "step_min"),
|
||||
("SoftBodySettings", "diagnose", "use_diagnose"),
|
||||
("SoftBodySettings", "edge_collision", "use_edge_collision"),
|
||||
("SoftBodySettings", "estimate_matrix", "use_estimate_matrix"),
|
||||
("SoftBodySettings", "face_collision", "use_face_collision"),
|
||||
("SoftBodySettings", "self_collision", "use_self_collision"),
|
||||
("SoftBodySettings", "stiff_quads", "use_stiff_quads"),
|
||||
("TexMapping", "maximum", "max"),
|
||||
("TexMapping", "minimum", "min"),
|
||||
("TexMapping", "has_maximum", "use_max"),
|
||||
("TexMapping", "has_minimum", "use_min"),
|
||||
("TextCharacterFormat", "bold", "use_bold"),
|
||||
("TextCharacterFormat", "italic", "use_italic"),
|
||||
("TextCharacterFormat", "underline", "use_underline"),
|
||||
("TextureSlot", "rgb_to_intensity", "use_rgb_to_intensity"),
|
||||
("TextureSlot", "stencil", "use_stencil"),
|
||||
("LampTextureSlot", "texture_coordinates", "texture_coords"),
|
||||
("LampTextureSlot", "map_color", "use_map_color"),
|
||||
("LampTextureSlot", "map_shadow", "use_map_shadow"),
|
||||
("MaterialTextureSlot", "coloremission_factor", "color_emission_factor"),
|
||||
("MaterialTextureSlot", "colordiff_factor", "diffuse_color_factor"),
|
||||
("MaterialTextureSlot", "x_mapping", "mapping_x"),
|
||||
("MaterialTextureSlot", "y_mapping", "mapping_y"),
|
||||
("MaterialTextureSlot", "z_mapping", "mapping_z"),
|
||||
("MaterialTextureSlot", "colorreflection_factor", "reflection_color_factor"),
|
||||
("MaterialTextureSlot", "colorspec_factor", "specular_color_factor"),
|
||||
("MaterialTextureSlot", "texture_coordinates", "texture_coords"),
|
||||
("MaterialTextureSlot", "colortransmission_factor", "transmission_color_factor"),
|
||||
("MaterialTextureSlot", "from_dupli", "use_from_dupli"),
|
||||
("MaterialTextureSlot", "from_original", "use_from_original"),
|
||||
("MaterialTextureSlot", "map_alpha", "use_map_alpha"),
|
||||
("MaterialTextureSlot", "map_ambient", "use_map_ambient"),
|
||||
("MaterialTextureSlot", "map_colordiff", "use_map_color_diff"),
|
||||
("MaterialTextureSlot", "map_coloremission", "use_map_color_emission"),
|
||||
("MaterialTextureSlot", "map_colorreflection", "use_map_color_reflection"),
|
||||
("MaterialTextureSlot", "map_colorspec", "use_map_color_spec"),
|
||||
("MaterialTextureSlot", "map_colortransmission", "use_map_color_transmission"),
|
||||
("MaterialTextureSlot", "map_density", "use_map_density"),
|
||||
("MaterialTextureSlot", "map_diffuse", "use_map_diffuse"),
|
||||
("MaterialTextureSlot", "map_displacement", "use_map_displacement"),
|
||||
("MaterialTextureSlot", "map_emission", "use_map_emission"),
|
||||
("MaterialTextureSlot", "map_emit", "use_map_emit"),
|
||||
("MaterialTextureSlot", "map_hardness", "use_map_hardness"),
|
||||
("MaterialTextureSlot", "map_mirror", "use_map_mirror"),
|
||||
("MaterialTextureSlot", "map_normal", "use_map_normal"),
|
||||
("MaterialTextureSlot", "map_raymir", "use_map_raymir"),
|
||||
("MaterialTextureSlot", "map_reflection", "use_map_reflect"),
|
||||
("MaterialTextureSlot", "map_scattering", "use_map_scatter"),
|
||||
("MaterialTextureSlot", "map_specular", "use_map_specular"),
|
||||
("MaterialTextureSlot", "map_translucency", "use_map_translucency"),
|
||||
("MaterialTextureSlot", "map_warp", "use_map_warp"),
|
||||
("WorldTextureSlot", "texture_coordinates", "texture_coords"),
|
||||
("WorldTextureSlot", "map_blend", "use_map_blend"),
|
||||
("WorldTextureSlot", "map_horizon", "use_map_horizon"),
|
||||
("WorldTextureSlot", "map_zenith_down", "use_map_zenith_down"),
|
||||
("WorldTextureSlot", "map_zenith_up", "use_map_zenith_up"),
|
||||
("VoxelData", "still_frame_number", "still_frame"),
|
||||
("WorldLighting", "ao_blend_mode", "ao_blend_type"),
|
||||
("WorldLighting", "error_tolerance", "error_threshold"),
|
||||
("WorldLighting", "use_ambient_occlusion", "use_ambient_occlusian"),
|
||||
("WorldLighting", "pixel_cache", "use_cache"),
|
||||
("WorldLighting", "use_environment_lighting", "use_environment_light"),
|
||||
("WorldLighting", "use_indirect_lighting", "use_indirect_light"),
|
||||
("WorldStarsSettings", "color_randomization", "color_random"),
|
||||
("WorldStarsSettings", "min_distance", "distance_min"),
|
||||
("WorldLighting", "falloff", "use_falloff"),
|
||||
("Constraint", "disabled", "is_valid"),
|
||||
("ClampToConstraint", "cyclic", "use_cyclic"),
|
||||
("ImageTexture", "filter", "filter_type"),
|
||||
("ImageTexture", "interpolation", "use_interpolation"),
|
||||
("ImageTexture", "mipmap", "use_mipmap"),
|
||||
("ImageUser", "frames", "frame_duration"),
|
||||
("ImageUser", "offset", "frame_offset"),
|
||||
("ImageUser", "cyclic", "use_cyclic"),
|
||||
("ArmatureModifier", "invert", "invert_vertex_group"),
|
||||
("ArmatureModifier", "quaternion", "use_deform_preserve_volume"),
|
||||
("ArrayModifier", "length", "fit_length"),
|
||||
("BevelModifier", "angle", "angle_limit"),
|
||||
("BuildModifier", "length", "frame_duration"),
|
||||
("BuildModifier", "randomize", "use_random_order"),
|
||||
("CastModifier", "x", "use_x"),
|
||||
("CastModifier", "y", "use_y"),
|
||||
("CastModifier", "z", "use_z"),
|
||||
("ExplodeModifier", "size", "use_size"),
|
||||
("MaskModifier", "invert", "invert_vertex_group"),
|
||||
("MeshDeformModifier", "invert", "invert_vertex_group"),
|
||||
("MeshDeformModifier", "dynamic", "use_dynamic_bind"),
|
||||
("MirrorModifier", "clip", "use_clip"),
|
||||
("MirrorModifier", "x", "use_x"),
|
||||
("MirrorModifier", "y", "use_y"),
|
||||
("MirrorModifier", "z", "use_z"),
|
||||
("ParticleInstanceModifier", "children", "use_children"),
|
||||
("ParticleInstanceModifier", "normal", "use_normal"),
|
||||
("ParticleInstanceModifier", "size", "use_size"),
|
||||
("ShrinkwrapModifier", "negative", "use_negative_direction"),
|
||||
("ShrinkwrapModifier", "positive", "use_positive_direction"),
|
||||
("ShrinkwrapModifier", "x", "use_project_x"),
|
||||
("ShrinkwrapModifier", "y", "use_project_y"),
|
||||
("ShrinkwrapModifier", "z", "use_project_z"),
|
||||
("ShrinkwrapModifier", "mode", "wrap_method"),
|
||||
("SimpleDeformModifier", "mode", "deform_method"),
|
||||
("SimpleDeformModifier", "relative", "use_relative"),
|
||||
("SmoothModifier", "repeat", "iterations"),
|
||||
("SmoothModifier", "x", "use_x"),
|
||||
("SmoothModifier", "y", "use_y"),
|
||||
("SmoothModifier", "z", "use_z"),
|
||||
("SolidifyModifier", "invert", "invert_vertex_group"),
|
||||
("WaveModifier", "cyclic", "use_cyclic"),
|
||||
("WaveModifier", "normals", "use_normal"),
|
||||
("WaveModifier", "x", "use_x"),
|
||||
("WaveModifier", "y", "use_y"),
|
||||
("DampedTrackConstraint", "track", "track_axis"),
|
||||
("FloorConstraint", "sticky", "use_sticky"),
|
||||
("FollowPathConstraint", "forward", "forward_axis"),
|
||||
("FollowPathConstraint", "up", "up_axis"),
|
||||
("LockedTrackConstraint", "lock", "lock_axis"),
|
||||
("LockedTrackConstraint", "track", "track_axis"),
|
||||
("MaintainVolumeConstraint", "axis", "free_axis"),
|
||||
("TrackToConstraint", "track", "track_axis"),
|
||||
("TrackToConstraint", "up", "up_axis"),
|
||||
("GameProperty", "debug", "show_debug"),
|
||||
("Image", "tiles", "use_tiles"),
|
||||
("Lamp", "diffuse", "use_diffuse"),
|
||||
("Lamp", "negative", "use_negative"),
|
||||
("Lamp", "layer", "use_own_layer"),
|
||||
("Lamp", "specular", "use_specular"),
|
||||
("AreaLamp", "dither", "use_dither"),
|
||||
("AreaLamp", "jitter", "use_jitter"),
|
||||
("SpotLamp", "square", "use_square"),
|
||||
("Material", "cubic", "use_cubic"),
|
||||
("Material", "shadows", "use_shadows"),
|
||||
("ParticleSettings", "amount", "count"),
|
||||
("ParticleSettings", "display", "draw_percentage"),
|
||||
("ParticleSettings", "velocity", "show_velocity"),
|
||||
("ParticleSettings", "trand", "use_emit_random"),
|
||||
("ParticleSettings", "parent", "use_parent_particles"),
|
||||
("ParticleSettings", "emitter", "use_render_emitter"),
|
||||
("ParticleSettings", "viewport", "use_simplify_viewport"),
|
||||
("Texture", "brightness", "intensity"),
|
||||
("CloudsTexture", "stype", "cloud_type"),
|
||||
("EnvironmentMapTexture", "filter", "filter_type"),
|
||||
("EnvironmentMapTexture", "mipmap", "use_mipmap"),
|
||||
("MarbleTexture", "stype", "marble_type"),
|
||||
("StucciTexture", "stype", "stucci_type"),
|
||||
("WoodTexture", "stype", "wood_type"),
|
||||
("World", "range", "color_range"),
|
||||
("World", "lighting", "light_settings"),
|
||||
("World", "mist", "mist_settings"),
|
||||
("World", "stars", "star_settings"),
|
||||
("MaterialHalo", "lines", "use_lines"),
|
||||
("MaterialHalo", "ring", "use_ring"),
|
||||
("MaterialHalo", "soft", "use_soft"),
|
||||
("MaterialHalo", "star", "use_star"),
|
||||
("MaterialHalo", "texture", "use_texture"),
|
||||
("MaterialPhysics", "damp", "damping"),
|
||||
("MaterialRaytraceTransparency", "limit", "depth_max"),
|
||||
("NlaStrip", "reversed", "use_reverse"),
|
||||
("CompositorNodeBlur", "bokeh", "use_bokeh"),
|
||||
("CompositorNodeBlur", "gamma", "use_gamma_correction"),
|
||||
("CompositorNodeBlur", "relative", "use_relative"),
|
||||
("CompositorNodeChannelMatte", "high", "limit_max"),
|
||||
("CompositorNodeChannelMatte", "low", "limit_min"),
|
||||
("CompositorNodeChannelMatte", "channel", "matte_channel"),
|
||||
("CompositorNodeChromaMatte", "cutoff", "threshold"),
|
||||
("CompositorNodeColorMatte", "h", "color_hue"),
|
||||
("CompositorNodeColorMatte", "s", "color_saturation"),
|
||||
("CompositorNodeColorMatte", "v", "color_value"),
|
||||
("CompositorNodeDBlur", "wrap", "use_wrap"),
|
||||
("CompositorNodeDefocus", "preview", "use_preview"),
|
||||
("CompositorNodeHueSat", "hue", "color_hue"),
|
||||
("CompositorNodeHueSat", "sat", "color_saturation"),
|
||||
("CompositorNodeHueSat", "val", "color_value"),
|
||||
("CompositorNodeImage", "frames", "frame_duration"),
|
||||
("CompositorNodeImage", "offset", "frame_offset"),
|
||||
("CompositorNodeImage", "start", "frame_start"),
|
||||
("CompositorNodeImage", "cyclic", "use_cyclic"),
|
||||
("CompositorNodeInvert", "alpha", "invert_alpha"),
|
||||
("CompositorNodeInvert", "rgb", "invert_rgb"),
|
||||
("CompositorNodeLensdist", "fit", "use_fit"),
|
||||
("CompositorNodeLensdist", "jitter", "use_jitter"),
|
||||
("CompositorNodeMixRGB", "alpha", "use_alpha"),
|
||||
("CompositorNodeRotate", "filter", "filter_type"),
|
||||
("CompositorNodeTime", "end", "frame_end"),
|
||||
("CompositorNodeTime", "start", "frame_start"),
|
||||
("CompositorNodeVecBlur", "curved", "use_curved"),
|
||||
("ShaderNodeExtendedMaterial", "diffuse", "use_diffuse"),
|
||||
("ShaderNodeExtendedMaterial", "specular", "use_specular"),
|
||||
("ShaderNodeMaterial", "diffuse", "use_diffuse"),
|
||||
("ShaderNodeMaterial", "specular", "use_specular"),
|
||||
("ShaderNodeMixRGB", "alpha", "use_alpha"),
|
||||
("TextureNodeCurveTime", "end", "frame_end"),
|
||||
("TextureNodeCurveTime", "start", "frame_start"),
|
||||
("TextureNodeMixRGB", "alpha", "use_alpha"),
|
||||
("TextureSlot", "negate", "invert"),
|
||||
("TextureSlot", "size", "scale"),
|
||||
("SoftBodySettings", "damp", "damping"),
|
||||
("SequenceCrop", "right", "max_x"),
|
||||
("SequenceCrop", "top", "max_y"),
|
||||
("SequenceCrop", "bottom", "min_x"),
|
||||
("SequenceCrop", "left", "min_y"),
|
||||
("Sequence", "speed_fader", "speed_factor"),
|
||||
("SpeedControlSequence", "global_speed", "multiply_speed"),
|
||||
("SpeedControlSequence", "use_curve_velocity", "use_as_speed"),
|
||||
("SpeedControlSequence", "use_curve_compress_y", "scale_to_length"),
|
||||
]
|
||||
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
class UpdateAnimData(bpy.types.Operator):
|
||||
'''Update data paths from 2.53 to edited data paths of drivers and fcurves'''
|
||||
bl_idname = "anim.update_data_paths"
|
||||
bl_label = "Update Animation Data"
|
||||
|
||||
def execute(self, context):
|
||||
import animsys_refactor
|
||||
animsys_refactor.update_data_paths(data_path_update)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
bpy.ops.anim.update_data_paths()
|
||||
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
|
@ -1,294 +0,0 @@
|
|||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
import sys
|
||||
import bpy
|
||||
|
||||
language_id = 'python'
|
||||
|
||||
# store our own __main__ module, not 100% needed
|
||||
# but python expects this in some places
|
||||
_BPY_MAIN_OWN = True
|
||||
|
||||
|
||||
def add_scrollback(text, text_type):
|
||||
for l in text.split('\n'):
|
||||
bpy.ops.console.scrollback_append(text=l.replace('\t', ' '),
|
||||
type=text_type)
|
||||
|
||||
|
||||
def get_console(console_id):
|
||||
'''
|
||||
helper function for console operators
|
||||
currently each text datablock gets its own
|
||||
console - code.InteractiveConsole()
|
||||
...which is stored in this function.
|
||||
|
||||
console_id can be any hashable type
|
||||
'''
|
||||
from code import InteractiveConsole
|
||||
|
||||
consoles = getattr(get_console, "consoles", None)
|
||||
hash_next = hash(bpy.context.window_manager)
|
||||
|
||||
if consoles is None:
|
||||
consoles = get_console.consoles = {}
|
||||
get_console.consoles_namespace_hash = hash_next
|
||||
else:
|
||||
# check if clearning the namespace is needed to avoid a memory leak.
|
||||
# the window manager is normally loaded with new blend files
|
||||
# so this is a reasonable way to deal with namespace clearing.
|
||||
# bpy.data hashing is reset by undo so cant be used.
|
||||
hash_prev = getattr(get_console, "consoles_namespace_hash", 0)
|
||||
|
||||
if hash_prev != hash_next:
|
||||
get_console.consoles_namespace_hash = hash_next
|
||||
consoles.clear()
|
||||
|
||||
console_data = consoles.get(console_id)
|
||||
|
||||
if console_data:
|
||||
console, stdout, stderr = console_data
|
||||
|
||||
# XXX, bug in python 3.1.2 ? (worked in 3.1.1)
|
||||
# seems there is no way to clear StringIO objects for writing, have to make new ones each time.
|
||||
import io
|
||||
stdout = io.StringIO()
|
||||
stderr = io.StringIO()
|
||||
else:
|
||||
if _BPY_MAIN_OWN:
|
||||
import types
|
||||
bpy_main_mod = types.ModuleType("__main__")
|
||||
namespace = bpy_main_mod.__dict__
|
||||
else:
|
||||
namespace = {}
|
||||
|
||||
namespace["__builtins__"] = sys.modules["builtins"]
|
||||
namespace["bpy"] = bpy
|
||||
namespace["C"] = bpy.context
|
||||
|
||||
console = InteractiveConsole(locals=namespace, filename="<blender_console>")
|
||||
|
||||
console.push("from mathutils import *")
|
||||
console.push("from math import *")
|
||||
|
||||
if _BPY_MAIN_OWN:
|
||||
console._bpy_main_mod = bpy_main_mod
|
||||
|
||||
import io
|
||||
stdout = io.StringIO()
|
||||
stderr = io.StringIO()
|
||||
|
||||
consoles[console_id] = console, stdout, stderr
|
||||
|
||||
return console, stdout, stderr
|
||||
|
||||
|
||||
# Both prompts must be the same length
|
||||
PROMPT = '>>> '
|
||||
PROMPT_MULTI = '... '
|
||||
|
||||
|
||||
def execute(context):
|
||||
sc = context.space_data
|
||||
|
||||
try:
|
||||
line_object = sc.history[-1]
|
||||
except:
|
||||
return {'CANCELLED'}
|
||||
|
||||
console, stdout, stderr = get_console(hash(context.region))
|
||||
|
||||
# redirect output
|
||||
sys.stdout = stdout
|
||||
sys.stderr = stderr
|
||||
|
||||
# dont allow the stdin to be used, can lock blender.
|
||||
stdin_backup = sys.stdin
|
||||
sys.stdin = None
|
||||
|
||||
if _BPY_MAIN_OWN:
|
||||
main_mod_back = sys.modules["__main__"]
|
||||
sys.modules["__main__"] = console._bpy_main_mod
|
||||
|
||||
# incase exception happens
|
||||
line = "" # incase of encodingf error
|
||||
is_multiline = False
|
||||
|
||||
try:
|
||||
line = line_object.body
|
||||
|
||||
# run the console, "\n" executes a multiline statement
|
||||
line_exec = line if line.strip() else "\n"
|
||||
|
||||
is_multiline = console.push(line_exec)
|
||||
except:
|
||||
# unlikely, but this can happen with unicode errors for example.
|
||||
import traceback
|
||||
stderr.write(traceback.format_exc())
|
||||
|
||||
if _BPY_MAIN_OWN:
|
||||
sys.modules["__main__"] = main_mod_back
|
||||
|
||||
stdout.seek(0)
|
||||
stderr.seek(0)
|
||||
|
||||
output = stdout.read()
|
||||
output_err = stderr.read()
|
||||
|
||||
# cleanup
|
||||
sys.stdout = sys.__stdout__
|
||||
sys.stderr = sys.__stderr__
|
||||
sys.last_traceback = None
|
||||
|
||||
# So we can reuse, clear all data
|
||||
stdout.truncate(0)
|
||||
stderr.truncate(0)
|
||||
|
||||
# special exception. its possible the command loaded a new user interface
|
||||
if hash(sc) != hash(context.space_data):
|
||||
return
|
||||
|
||||
bpy.ops.console.scrollback_append(text=sc.prompt + line, type='INPUT')
|
||||
|
||||
if is_multiline:
|
||||
sc.prompt = PROMPT_MULTI
|
||||
else:
|
||||
sc.prompt = PROMPT
|
||||
|
||||
# insert a new blank line
|
||||
bpy.ops.console.history_append(text="", current_character=0,
|
||||
remove_duplicates=True)
|
||||
|
||||
# Insert the output into the editor
|
||||
# not quite correct because the order might have changed,
|
||||
# but ok 99% of the time.
|
||||
if output:
|
||||
add_scrollback(output, 'OUTPUT')
|
||||
if output_err:
|
||||
add_scrollback(output_err, 'ERROR')
|
||||
|
||||
# restore the stdin
|
||||
sys.stdin = stdin_backup
|
||||
|
||||
# execute any hooks
|
||||
for func, args in execute.hooks:
|
||||
func(*args)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
execute.hooks = []
|
||||
|
||||
|
||||
def autocomplete(context):
|
||||
from console import intellisense
|
||||
|
||||
sc = context.space_data
|
||||
|
||||
console = get_console(hash(context.region))[0]
|
||||
|
||||
if not console:
|
||||
return {'CANCELLED'}
|
||||
|
||||
# dont allow the stdin to be used, can lock blender.
|
||||
# note: unlikely stdin would be used for autocomp. but its possible.
|
||||
stdin_backup = sys.stdin
|
||||
sys.stdin = None
|
||||
|
||||
scrollback = ""
|
||||
scrollback_error = ""
|
||||
|
||||
if _BPY_MAIN_OWN:
|
||||
main_mod_back = sys.modules["__main__"]
|
||||
sys.modules["__main__"] = console._bpy_main_mod
|
||||
|
||||
try:
|
||||
current_line = sc.history[-1]
|
||||
line = current_line.body
|
||||
|
||||
# This function isnt aware of the text editor or being an operator
|
||||
# just does the autocomp then copy its results back
|
||||
current_line.body, current_line.current_character, scrollback = \
|
||||
intellisense.expand(
|
||||
line=current_line.body,
|
||||
cursor=current_line.current_character,
|
||||
namespace=console.locals,
|
||||
private=bpy.app.debug)
|
||||
except:
|
||||
# unlikely, but this can happen with unicode errors for example.
|
||||
# or if the api attribute access its self causes an error.
|
||||
import traceback
|
||||
scrollback_error = traceback.format_exc()
|
||||
|
||||
if _BPY_MAIN_OWN:
|
||||
sys.modules["__main__"] = main_mod_back
|
||||
|
||||
# Separate automplete output by command prompts
|
||||
if scrollback != '':
|
||||
bpy.ops.console.scrollback_append(text=sc.prompt + current_line.body, type='INPUT')
|
||||
|
||||
# Now we need to copy back the line from blender back into the
|
||||
# text editor. This will change when we dont use the text editor
|
||||
# anymore
|
||||
if scrollback:
|
||||
add_scrollback(scrollback, 'INFO')
|
||||
|
||||
if scrollback_error:
|
||||
add_scrollback(scrollback_error, 'ERROR')
|
||||
|
||||
# restore the stdin
|
||||
sys.stdin = stdin_backup
|
||||
|
||||
context.area.tag_redraw()
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def banner(context):
|
||||
sc = context.space_data
|
||||
version_string = sys.version.strip().replace('\n', ' ')
|
||||
|
||||
add_scrollback("PYTHON INTERACTIVE CONSOLE %s" % version_string, 'OUTPUT')
|
||||
add_scrollback("", 'OUTPUT')
|
||||
add_scrollback("Command History: Up/Down Arrow", 'OUTPUT')
|
||||
add_scrollback("Cursor: Left/Right Home/End", 'OUTPUT')
|
||||
add_scrollback("Remove: Backspace/Delete", 'OUTPUT')
|
||||
add_scrollback("Execute: Enter", 'OUTPUT')
|
||||
add_scrollback("Autocomplete: Ctrl+Space", 'OUTPUT')
|
||||
add_scrollback("Ctrl +/- Wheel: Zoom", 'OUTPUT')
|
||||
add_scrollback("Builtin Modules: bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bgl, blf, mathutils", 'OUTPUT')
|
||||
add_scrollback("Convenience Imports: from mathutils import *; from math import *", 'OUTPUT')
|
||||
add_scrollback("", 'OUTPUT')
|
||||
add_scrollback(" WARNING!!! Blender 2.5 API is subject to change, see API reference for more info.", 'ERROR')
|
||||
add_scrollback("", 'OUTPUT')
|
||||
sc.prompt = PROMPT
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def register():
|
||||
pass
|
||||
|
||||
|
||||
def unregister():
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
|
@ -1,90 +0,0 @@
|
|||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
from math import *
|
||||
import bpy
|
||||
from mathutils import *
|
||||
|
||||
|
||||
def main(context):
|
||||
def cleanupEulCurve(fcv):
|
||||
keys = []
|
||||
|
||||
for k in fcv.keyframe_points:
|
||||
keys.append([k.handle_left.copy(), k.co.copy(), k.handle_right.copy()])
|
||||
print(keys)
|
||||
|
||||
for i in range(len(keys)):
|
||||
cur = keys[i]
|
||||
prev = keys[i - 1] if i > 0 else None
|
||||
next = keys[i + 1] if i < len(keys) - 1 else None
|
||||
|
||||
if prev is None:
|
||||
continue
|
||||
|
||||
th = pi
|
||||
if abs(prev[1][1] - cur[1][1]) >= th: # more than 180 degree jump
|
||||
fac = pi * 2.0
|
||||
if prev[1][1] > cur[1][1]:
|
||||
while abs(cur[1][1] - prev[1][1]) >= th: # < prev[1][1]:
|
||||
cur[0][1] += fac
|
||||
cur[1][1] += fac
|
||||
cur[2][1] += fac
|
||||
elif prev[1][1] < cur[1][1]:
|
||||
while abs(cur[1][1] - prev[1][1]) >= th:
|
||||
cur[0][1] -= fac
|
||||
cur[1][1] -= fac
|
||||
cur[2][1] -= fac
|
||||
|
||||
for i in range(len(keys)):
|
||||
for x in range(2):
|
||||
fcv.keyframe_points[i].handle_left[x] = keys[i][0][x]
|
||||
fcv.keyframe_points[i].co[x] = keys[i][1][x]
|
||||
fcv.keyframe_points[i].handle_right[x] = keys[i][2][x]
|
||||
|
||||
flist = bpy.context.active_object.animation_data.action.fcurves
|
||||
for f in flist:
|
||||
if f.select and f.data_path.endswith("rotation_euler"):
|
||||
cleanupEulCurve(f)
|
||||
|
||||
|
||||
class DiscontFilterOp(bpy.types.Operator):
|
||||
"""Fixes the most common causes of gimbal lock in the fcurves of the active bone"""
|
||||
bl_idname = "graph.euler_filter"
|
||||
bl_label = "Filter out discontinuities in the active fcurves"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.active_object != None
|
||||
|
||||
def execute(self, context):
|
||||
main(context)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
|
@ -1,205 +0,0 @@
|
|||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
from bpy.props import StringProperty
|
||||
|
||||
|
||||
class EditExternally(bpy.types.Operator):
|
||||
'''Edit image in an external application'''
|
||||
bl_idname = "image.external_edit"
|
||||
bl_label = "Image Edit Externally"
|
||||
bl_options = {'REGISTER'}
|
||||
|
||||
filepath = StringProperty(name="File Path", description="Path to an image file", maxlen=1024, default="")
|
||||
|
||||
def _editor_guess(self, context):
|
||||
import platform
|
||||
try:
|
||||
system = platform.system()
|
||||
except UnicodeDecodeError:
|
||||
import sys
|
||||
system = sys.platform
|
||||
|
||||
image_editor = context.user_preferences.filepaths.image_editor
|
||||
|
||||
# use image editor in the preferences when available.
|
||||
if not image_editor:
|
||||
if system in ('Windows', 'win32'):
|
||||
image_editor = ["start"] # not tested!
|
||||
elif system == 'Darwin':
|
||||
image_editor = ["open"]
|
||||
else:
|
||||
image_editor = ["gimp"]
|
||||
else:
|
||||
if system == 'Darwin':
|
||||
# blender file selector treats .app as a folder
|
||||
# and will include a trailing backslash, so we strip it.
|
||||
image_editor.rstrip('\\')
|
||||
image_editor = ["open", "-a", image_editor]
|
||||
else:
|
||||
image_editor = [image_editor]
|
||||
|
||||
return image_editor
|
||||
|
||||
def execute(self, context):
|
||||
import os
|
||||
import subprocess
|
||||
filepath = bpy.path.abspath(self.filepath)
|
||||
|
||||
if not os.path.exists(filepath):
|
||||
self.report('ERROR', "Image path '%s' not found." % filepath)
|
||||
return {'CANCELLED'}
|
||||
|
||||
cmd = self._editor_guess(context) + [filepath]
|
||||
|
||||
subprocess.Popen(cmd)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
try:
|
||||
filepath = context.space_data.image.filepath
|
||||
except:
|
||||
self.report({'ERROR'}, "Image not found on disk")
|
||||
return {'CANCELLED'}
|
||||
|
||||
self.filepath = filepath
|
||||
self.execute(context)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class SaveDirty(bpy.types.Operator):
|
||||
"""Save all modified textures"""
|
||||
bl_idname = "image.save_dirty"
|
||||
bl_label = "Save Dirty"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
def execute(self, context):
|
||||
unique_paths = set()
|
||||
for image in bpy.data.images:
|
||||
if image.is_dirty:
|
||||
filepath = bpy.path.abspath(image.filepath)
|
||||
if "\\" not in filepath and "/" not in filepath:
|
||||
self.report({'WARNING'}, "Invalid path: " + filepath)
|
||||
elif filepath in unique_paths:
|
||||
self.report({'WARNING'}, "Path used by more then one image: " + filepath)
|
||||
else:
|
||||
unique_paths.add(filepath)
|
||||
image.save()
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class ProjectEdit(bpy.types.Operator):
|
||||
"""Edit a snapshot if the viewport in an external image editor"""
|
||||
bl_idname = "image.project_edit"
|
||||
bl_label = "Project Edit"
|
||||
bl_options = {'REGISTER'}
|
||||
|
||||
_proj_hack = [""]
|
||||
|
||||
def execute(self, context):
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
EXT = "png" # could be made an option but for now ok
|
||||
|
||||
for image in bpy.data.images:
|
||||
image.tag = True
|
||||
|
||||
if 'FINISHED' not in bpy.ops.paint.image_from_view():
|
||||
return {'CANCELLED'}
|
||||
|
||||
image_new = None
|
||||
for image in bpy.data.images:
|
||||
if not image.tag:
|
||||
image_new = image
|
||||
break
|
||||
|
||||
if not image_new:
|
||||
self.report({'ERROR'}, "Could not make new image")
|
||||
return {'CANCELLED'}
|
||||
|
||||
filepath = os.path.basename(bpy.data.filepath)
|
||||
filepath = os.path.splitext(filepath)[0]
|
||||
# filepath = bpy.path.clean_name(filepath) # fixes <memory> rubbish, needs checking
|
||||
|
||||
if filepath.startswith(".") or filepath == "":
|
||||
# TODO, have a way to check if the file is saved, assume startup.blend
|
||||
tmpdir = context.user_preferences.filepaths.temporary_directory
|
||||
filepath = os.path.join(tmpdir, "project_edit")
|
||||
else:
|
||||
filepath = "//" + filepath
|
||||
|
||||
obj = context.object
|
||||
|
||||
if obj:
|
||||
filepath += "_" + bpy.path.clean_name(obj.name)
|
||||
|
||||
filepath_final = filepath + "." + EXT
|
||||
i = 0
|
||||
|
||||
while os.path.exists(bpy.path.abspath(filepath_final)):
|
||||
filepath_final = filepath + ("%.3d.%s" % (i, EXT))
|
||||
i += 1
|
||||
|
||||
image_new.name = os.path.basename(filepath_final)
|
||||
ProjectEdit._proj_hack[0] = image_new.name
|
||||
|
||||
image_new.filepath_raw = filepath_final # TODO, filepath raw is crummy
|
||||
image_new.file_format = 'PNG'
|
||||
image_new.save()
|
||||
|
||||
bpy.ops.image.external_edit(filepath=filepath_final)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class ProjectApply(bpy.types.Operator):
|
||||
"""Project edited image back onto the object"""
|
||||
bl_idname = "image.project_apply"
|
||||
bl_label = "Project Apply"
|
||||
bl_options = {'REGISTER'}
|
||||
|
||||
def execute(self, context):
|
||||
image_name = ProjectEdit._proj_hack[0] # TODO, deal with this nicer
|
||||
|
||||
try:
|
||||
image = bpy.data.images[image_name]
|
||||
except KeyError:
|
||||
self.report({'ERROR'}, "Could not find image '%s'" % image_name)
|
||||
return {'CANCELLED'}
|
||||
|
||||
image.reload()
|
||||
bpy.ops.paint.project_image(image=image_name)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
|
@ -1,183 +0,0 @@
|
|||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
class MeshSelectInteriorFaces(bpy.types.Operator):
|
||||
'''Select faces where all edges have more then 2 face users.'''
|
||||
|
||||
bl_idname = "mesh.faces_select_interior"
|
||||
bl_label = "Select Interior Faces"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
ob = context.active_object
|
||||
return (ob and ob.type == 'MESH')
|
||||
|
||||
def execute(self, context):
|
||||
ob = context.active_object
|
||||
context.tool_settings.mesh_select_mode = False, False, True
|
||||
is_editmode = (ob.mode == 'EDIT')
|
||||
if is_editmode:
|
||||
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
|
||||
|
||||
mesh = ob.data
|
||||
|
||||
face_list = mesh.faces[:]
|
||||
face_edge_keys = [face.edge_keys for face in face_list]
|
||||
|
||||
edge_face_count = mesh.edge_face_count_dict
|
||||
|
||||
def test_interior(index):
|
||||
for key in face_edge_keys[index]:
|
||||
if edge_face_count[key] < 3:
|
||||
return False
|
||||
return True
|
||||
|
||||
for index, face in enumerate(face_list):
|
||||
if(test_interior(index)):
|
||||
face.select = True
|
||||
else:
|
||||
face.select = False
|
||||
|
||||
if is_editmode:
|
||||
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class MeshMirrorUV(bpy.types.Operator):
|
||||
'''Copy mirror UV coordinates on the X axis based on a mirrored mesh'''
|
||||
bl_idname = "mesh.faces_miror_uv"
|
||||
bl_label = "Copy Mirrored UV coords"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
ob = context.active_object
|
||||
return (ob and ob.type == 'MESH')
|
||||
|
||||
def execute(self, context):
|
||||
DIR = 1 # TODO, make an option
|
||||
|
||||
from mathutils import Vector
|
||||
|
||||
ob = context.active_object
|
||||
is_editmode = (ob.mode == 'EDIT')
|
||||
if is_editmode:
|
||||
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
|
||||
|
||||
mesh = ob.data
|
||||
|
||||
# mirror lookups
|
||||
mirror_gt = {}
|
||||
mirror_lt = {}
|
||||
|
||||
vcos = [v.co.to_tuple(5) for v in mesh.vertices]
|
||||
|
||||
for i, co in enumerate(vcos):
|
||||
if co[0] > 0.0:
|
||||
mirror_gt[co] = i
|
||||
elif co[0] < 0.0:
|
||||
mirror_lt[co] = i
|
||||
else:
|
||||
mirror_gt[co] = i
|
||||
mirror_lt[co] = i
|
||||
|
||||
#for i, v in enumerate(mesh.vertices):
|
||||
vmap = {}
|
||||
for mirror_a, mirror_b in (mirror_gt, mirror_lt), (mirror_lt, mirror_gt):
|
||||
for co, i in mirror_a.items():
|
||||
nco = (-co[0], co[1], co[2])
|
||||
j = mirror_b.get(nco)
|
||||
if j is not None:
|
||||
vmap[i] = j
|
||||
|
||||
active_uv_layer = None
|
||||
for lay in mesh.uv_textures:
|
||||
if lay.active:
|
||||
active_uv_layer = lay.data
|
||||
break
|
||||
|
||||
fuvs = [(uv.uv1, uv.uv2, uv.uv3, uv.uv4) for uv in active_uv_layer]
|
||||
fuvs_cpy = [(uv[0].copy(), uv[1].copy(), uv[2].copy(), uv[3].copy()) for uv in fuvs]
|
||||
|
||||
# as a list
|
||||
faces = mesh.faces[:]
|
||||
|
||||
fuvsel = [(False not in uv.select_uv) for uv in active_uv_layer]
|
||||
fcents = [f.center for f in faces]
|
||||
|
||||
# find mirror faces
|
||||
mirror_fm = {}
|
||||
for i, f in enumerate(faces):
|
||||
verts = f.vertices[:]
|
||||
verts.sort()
|
||||
verts = tuple(verts)
|
||||
mirror_fm[verts] = i
|
||||
|
||||
fmap = {}
|
||||
for i, f in enumerate(faces):
|
||||
verts = [vmap.get(j) for j in f.vertices]
|
||||
if None not in verts:
|
||||
verts.sort()
|
||||
j = mirror_fm.get(tuple(verts))
|
||||
if j is not None:
|
||||
fmap[i] = j
|
||||
|
||||
done = [False] * len(faces)
|
||||
for i, j in fmap.items():
|
||||
|
||||
if not fuvsel[i] or not fuvsel[j]:
|
||||
continue
|
||||
elif DIR == 0 and fcents[i][0] < 0.0:
|
||||
continue
|
||||
elif DIR == 1 and fcents[i][0] > 0.0:
|
||||
continue
|
||||
|
||||
# copy UVs
|
||||
uv1 = fuvs[i]
|
||||
uv2 = fuvs_cpy[j]
|
||||
|
||||
# get the correct rotation
|
||||
v1 = faces[j].vertices[:]
|
||||
v2 = [vmap[k] for k in faces[i].vertices[:]]
|
||||
|
||||
for k in range(len(uv1)):
|
||||
k_map = v1.index(v2[k])
|
||||
uv1[k].x = - (uv2[k_map].x - 0.5) + 0.5
|
||||
uv1[k].y = uv2[k_map].y
|
||||
|
||||
if is_editmode:
|
||||
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
|
@ -1,185 +0,0 @@
|
|||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def pose_info():
|
||||
from mathutils import Matrix
|
||||
|
||||
info = {}
|
||||
|
||||
obj = bpy.context.object
|
||||
pose = obj.pose
|
||||
|
||||
pose_items = pose.bones.items()
|
||||
|
||||
for name, pbone in pose_items:
|
||||
binfo = {}
|
||||
bone = pbone.bone
|
||||
|
||||
binfo["parent"] = getattr(bone.parent, "name", None)
|
||||
binfo["bone"] = bone
|
||||
binfo["pbone"] = pbone
|
||||
binfo["matrix_local"] = bone.matrix_local.copy()
|
||||
try:
|
||||
binfo["matrix_local_inv"] = binfo["matrix_local"].inverted()
|
||||
except:
|
||||
binfo["matrix_local_inv"] = Matrix()
|
||||
|
||||
binfo["matrix"] = bone.matrix.copy()
|
||||
binfo["matrix_pose"] = pbone.matrix.copy()
|
||||
try:
|
||||
binfo["matrix_pose_inv"] = binfo["matrix_pose"].inverted()
|
||||
except:
|
||||
binfo["matrix_pose_inv"] = Matrix()
|
||||
|
||||
print(binfo["matrix_pose"])
|
||||
info[name] = binfo
|
||||
|
||||
for name, pbone in pose_items:
|
||||
binfo = info[name]
|
||||
binfo_parent = binfo.get("parent", None)
|
||||
if binfo_parent:
|
||||
binfo_parent = info[binfo_parent]
|
||||
|
||||
matrix = binfo["matrix_pose"]
|
||||
rest_matrix = binfo["matrix_local"]
|
||||
|
||||
if binfo_parent:
|
||||
matrix = binfo_parent["matrix_pose_inv"] * matrix
|
||||
rest_matrix = binfo_parent["matrix_local_inv"] * rest_matrix
|
||||
|
||||
matrix = rest_matrix.inverted() * matrix
|
||||
|
||||
binfo["matrix_key"] = matrix.copy()
|
||||
|
||||
return info
|
||||
|
||||
|
||||
def bake(frame_start, frame_end, step=1, only_selected=False):
|
||||
scene = bpy.context.scene
|
||||
obj = bpy.context.object
|
||||
pose = obj.pose
|
||||
|
||||
info_ls = []
|
||||
|
||||
frame_range = range(frame_start, frame_end + 1, step)
|
||||
|
||||
# could spped this up by applying steps here too...
|
||||
for f in frame_range:
|
||||
scene.frame_set(f)
|
||||
|
||||
info = pose_info()
|
||||
info_ls.append(info)
|
||||
f += 1
|
||||
|
||||
action = bpy.data.actions.new("Action")
|
||||
|
||||
bpy.context.object.animation_data.action = action
|
||||
|
||||
pose_items = pose.bones.items()
|
||||
|
||||
for name, pbone in pose_items:
|
||||
if only_selected and not pbone.select:
|
||||
continue
|
||||
|
||||
for f in frame_range:
|
||||
matrix = info_ls[int((f - frame_start) / step)][name]["matrix_key"]
|
||||
|
||||
#pbone.location = matrix.to_translation()
|
||||
#pbone.rotation_quaternion = matrix.to_quaternion()
|
||||
pbone.matrix_basis = matrix
|
||||
|
||||
pbone.keyframe_insert("location", -1, f, name)
|
||||
|
||||
rotation_mode = pbone.rotation_mode
|
||||
|
||||
if rotation_mode == 'QUATERNION':
|
||||
pbone.keyframe_insert("rotation_quaternion", -1, f, name)
|
||||
elif rotation_mode == 'AXIS_ANGLE':
|
||||
pbone.keyframe_insert("rotation_axis_angle", -1, f, name)
|
||||
else: # euler, XYZ, ZXY etc
|
||||
pbone.keyframe_insert("rotation_euler", -1, f, name)
|
||||
|
||||
pbone.keyframe_insert("scale", -1, f, name)
|
||||
|
||||
return action
|
||||
|
||||
|
||||
from bpy.props import *
|
||||
|
||||
|
||||
class BakeAction(bpy.types.Operator):
|
||||
'''Bake animation to an Action'''
|
||||
bl_idname = "nla.bake"
|
||||
bl_label = "Bake Action"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
frame_start = IntProperty(name="Start Frame",
|
||||
description="Start frame for baking",
|
||||
default=1, min=1, max=300000)
|
||||
frame_end = IntProperty(name="End Frame",
|
||||
description="End frame for baking",
|
||||
default=250, min=1, max=300000)
|
||||
step = IntProperty(name="Frame Step",
|
||||
description="Frame Step",
|
||||
default=1, min=1, max=120)
|
||||
only_selected = BoolProperty(name="Only Selected",
|
||||
default=True)
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
action = bake(self.frame_start, self.frame_end, self.step, self.only_selected)
|
||||
|
||||
# basic cleanup, could move elsewhere
|
||||
for fcu in action.fcurves:
|
||||
keyframe_points = fcu.keyframe_points
|
||||
i = 1
|
||||
while i < len(fcu.keyframe_points) - 1:
|
||||
val_prev = keyframe_points[i - 1].co[1]
|
||||
val_next = keyframe_points[i + 1].co[1]
|
||||
val = keyframe_points[i].co[1]
|
||||
|
||||
if abs(val - val_prev) + abs(val - val_next) < 0.0001:
|
||||
keyframe_points.remove(keyframe_points[i])
|
||||
else:
|
||||
i += 1
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
wm = context.window_manager
|
||||
return wm.invoke_props_dialog(self)
|
||||
|
||||
|
||||
#def menu_func(self, context):
|
||||
# self.layout.operator(BakeAction.bl_idname, text="Bake Armature Action")
|
||||
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
|
@ -1,574 +0,0 @@
|
|||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
from bpy.props import *
|
||||
|
||||
|
||||
class SelectPattern(bpy.types.Operator):
|
||||
'''Select object matching a naming pattern'''
|
||||
bl_idname = "object.select_pattern"
|
||||
bl_label = "Select Pattern"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
pattern = StringProperty(name="Pattern", description="Name filter using '*' and '?' wildcard chars", maxlen=32, default="*")
|
||||
case_sensitive = BoolProperty(name="Case Sensitive", description="Do a case sensitive compare", default=False)
|
||||
extend = BoolProperty(name="Extend", description="Extend the existing selection", default=True)
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
import fnmatch
|
||||
|
||||
if self.case_sensitive:
|
||||
pattern_match = fnmatch.fnmatchcase
|
||||
else:
|
||||
pattern_match = lambda a, b: fnmatch.fnmatchcase(a.upper(), b.upper())
|
||||
|
||||
obj = context.object
|
||||
if obj and obj.mode == 'POSE':
|
||||
items = obj.data.bones
|
||||
elif obj and obj.type == 'ARMATURE' and obj.mode == 'EDIT':
|
||||
items = obj.data.edit_bones
|
||||
else:
|
||||
items = context.visible_objects
|
||||
|
||||
# Can be pose bones or objects
|
||||
for item in items:
|
||||
if pattern_match(item.name, self.pattern):
|
||||
item.select = True
|
||||
elif not self.extend:
|
||||
item.select = False
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
wm = context.window_manager
|
||||
return wm.invoke_props_popup(self, event)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.prop(self, "pattern")
|
||||
row = layout.row()
|
||||
row.prop(self, "case_sensitive")
|
||||
row.prop(self, "extend")
|
||||
|
||||
|
||||
class SelectCamera(bpy.types.Operator):
|
||||
'''Select object matching a naming pattern'''
|
||||
bl_idname = "object.select_camera"
|
||||
bl_label = "Select Camera"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.scene.camera is not None
|
||||
|
||||
def execute(self, context):
|
||||
scene = context.scene
|
||||
camera = scene.camera
|
||||
if camera.name not in scene.objects:
|
||||
self.report({'WARNING'}, "Active camera is not in this scene")
|
||||
|
||||
context.scene.objects.active = camera
|
||||
camera.select = True
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class SelectHierarchy(bpy.types.Operator):
|
||||
'''Select object relative to the active objects position in the hierarchy'''
|
||||
bl_idname = "object.select_hierarchy"
|
||||
bl_label = "Select Hierarchy"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
direction = EnumProperty(items=(
|
||||
('PARENT', "Parent", ""),
|
||||
('CHILD', "Child", "")),
|
||||
name="Direction",
|
||||
description="Direction to select in the hierarchy",
|
||||
default='PARENT')
|
||||
|
||||
extend = BoolProperty(name="Extend", description="Extend the existing selection", default=False)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.object
|
||||
|
||||
def execute(self, context):
|
||||
select_new = []
|
||||
act_new = None
|
||||
|
||||
selected_objects = context.selected_objects
|
||||
obj_act = context.object
|
||||
|
||||
if context.object not in selected_objects:
|
||||
selected_objects.append(context.object)
|
||||
|
||||
if self.direction == 'PARENT':
|
||||
for obj in selected_objects:
|
||||
parent = obj.parent
|
||||
|
||||
if parent:
|
||||
if obj_act == obj:
|
||||
act_new = parent
|
||||
|
||||
select_new.append(parent)
|
||||
|
||||
else:
|
||||
for obj in selected_objects:
|
||||
select_new.extend(obj.children)
|
||||
|
||||
if select_new:
|
||||
select_new.sort(key=lambda obj_iter: obj_iter.name)
|
||||
act_new = select_new[0]
|
||||
|
||||
# dont edit any object settings above this
|
||||
if select_new:
|
||||
if not self.extend:
|
||||
bpy.ops.object.select_all(action='DESELECT')
|
||||
|
||||
for obj in select_new:
|
||||
obj.select = True
|
||||
|
||||
context.scene.objects.active = act_new
|
||||
return {'FINISHED'}
|
||||
|
||||
return {'CANCELLED'}
|
||||
|
||||
|
||||
class SubdivisionSet(bpy.types.Operator):
|
||||
'''Sets a Subdivision Surface Level (1-5)'''
|
||||
|
||||
bl_idname = "object.subdivision_set"
|
||||
bl_label = "Subdivision Set"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
level = IntProperty(name="Level",
|
||||
default=1, min=-100, max=100, soft_min=-6, soft_max=6)
|
||||
|
||||
relative = BoolProperty(name="Relative", description="Apply the subsurf level as an offset relative to the current level", default=False)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
obs = context.selected_editable_objects
|
||||
return (obs is not None)
|
||||
|
||||
def execute(self, context):
|
||||
level = self.level
|
||||
relative = self.relative
|
||||
|
||||
if relative and level == 0:
|
||||
return {'CANCELLED'} # nothing to do
|
||||
|
||||
def set_object_subd(obj):
|
||||
for mod in obj.modifiers:
|
||||
if mod.type == 'MULTIRES':
|
||||
if not relative:
|
||||
if level <= mod.total_levels:
|
||||
if obj.mode == 'SCULPT':
|
||||
if mod.sculpt_levels != level:
|
||||
mod.sculpt_levels = level
|
||||
elif obj.mode == 'OBJECT':
|
||||
if mod.levels != level:
|
||||
mod.levels = level
|
||||
return
|
||||
else:
|
||||
if obj.mode == 'SCULPT':
|
||||
if mod.sculpt_levels + level <= mod.total_levels:
|
||||
mod.sculpt_levels += level
|
||||
elif obj.mode == 'OBJECT':
|
||||
if mod.levels + level <= mod.total_levels:
|
||||
mod.levels += level
|
||||
return
|
||||
|
||||
elif mod.type == 'SUBSURF':
|
||||
if relative:
|
||||
mod.levels += level
|
||||
else:
|
||||
if mod.levels != level:
|
||||
mod.levels = level
|
||||
|
||||
return
|
||||
|
||||
# add a new modifier
|
||||
try:
|
||||
mod = obj.modifiers.new("Subsurf", 'SUBSURF')
|
||||
mod.levels = level
|
||||
except:
|
||||
self.report({'WARNING'}, "Modifiers cannot be added to object: " + obj.name)
|
||||
|
||||
for obj in context.selected_editable_objects:
|
||||
set_object_subd(obj)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class ShapeTransfer(bpy.types.Operator):
|
||||
'''Copy another selected objects active shape to this one by applying the relative offsets'''
|
||||
|
||||
bl_idname = "object.shape_key_transfer"
|
||||
bl_label = "Transfer Shape Key"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
mode = EnumProperty(items=(
|
||||
('OFFSET', "Offset", "Apply the relative positional offset"),
|
||||
('RELATIVE_FACE', "Relative Face", "Calculate the geometricly relative position (using faces)."),
|
||||
('RELATIVE_EDGE', "Relative Edge", "Calculate the geometricly relative position (using edges).")),
|
||||
name="Transformation Mode",
|
||||
description="Method to apply relative shape positions to the new shape",
|
||||
default='OFFSET')
|
||||
|
||||
use_clamp = BoolProperty(name="Clamp Offset",
|
||||
description="Clamp the transformation to the distance each vertex moves in the original shape.",
|
||||
default=False)
|
||||
|
||||
def _main(self, ob_act, objects, mode='OFFSET', use_clamp=False):
|
||||
|
||||
def me_nos(verts):
|
||||
return [v.normal.copy() for v in verts]
|
||||
|
||||
def me_cos(verts):
|
||||
return [v.co.copy() for v in verts]
|
||||
|
||||
def ob_add_shape(ob, name):
|
||||
me = ob.data
|
||||
key = ob.shape_key_add(from_mix=False)
|
||||
if len(me.shape_keys.keys) == 1:
|
||||
key.name = "Basis"
|
||||
key = ob.shape_key_add(from_mix=False) # we need a rest
|
||||
key.name = name
|
||||
ob.active_shape_key_index = len(me.shape_keys.keys) - 1
|
||||
ob.show_only_shape_key = True
|
||||
|
||||
from mathutils.geometry import barycentric_transform
|
||||
from mathutils import Vector
|
||||
|
||||
if use_clamp and mode == 'OFFSET':
|
||||
use_clamp = False
|
||||
|
||||
me = ob_act.data
|
||||
orig_key_name = ob_act.active_shape_key.name
|
||||
|
||||
orig_shape_coords = me_cos(ob_act.active_shape_key.data)
|
||||
|
||||
orig_normals = me_nos(me.vertices)
|
||||
# orig_coords = me_cos(me.vertices) # the actual mverts location isnt as relyable as the base shape :S
|
||||
orig_coords = me_cos(me.shape_keys.keys[0].data)
|
||||
|
||||
for ob_other in objects:
|
||||
me_other = ob_other.data
|
||||
if len(me_other.vertices) != len(me.vertices):
|
||||
self.report({'WARNING'}, "Skipping '%s', vertex count differs" % ob_other.name)
|
||||
continue
|
||||
|
||||
target_normals = me_nos(me_other.vertices)
|
||||
if me_other.shape_keys:
|
||||
target_coords = me_cos(me_other.shape_keys.keys[0].data)
|
||||
else:
|
||||
target_coords = me_cos(me_other.vertices)
|
||||
|
||||
ob_add_shape(ob_other, orig_key_name)
|
||||
|
||||
# editing the final coords, only list that stores wrapped coords
|
||||
target_shape_coords = [v.co for v in ob_other.active_shape_key.data]
|
||||
|
||||
median_coords = [[] for i in range(len(me.vertices))]
|
||||
|
||||
# Method 1, edge
|
||||
if mode == 'OFFSET':
|
||||
for i, vert_cos in enumerate(median_coords):
|
||||
vert_cos.append(target_coords[i] + (orig_shape_coords[i] - orig_coords[i]))
|
||||
|
||||
elif mode == 'RELATIVE_FACE':
|
||||
for face in me.faces:
|
||||
i1, i2, i3, i4 = face.vertices_raw
|
||||
if i4 != 0:
|
||||
pt = barycentric_transform(orig_shape_coords[i1],
|
||||
orig_coords[i4], orig_coords[i1], orig_coords[i2],
|
||||
target_coords[i4], target_coords[i1], target_coords[i2])
|
||||
median_coords[i1].append(pt)
|
||||
|
||||
pt = barycentric_transform(orig_shape_coords[i2],
|
||||
orig_coords[i1], orig_coords[i2], orig_coords[i3],
|
||||
target_coords[i1], target_coords[i2], target_coords[i3])
|
||||
median_coords[i2].append(pt)
|
||||
|
||||
pt = barycentric_transform(orig_shape_coords[i3],
|
||||
orig_coords[i2], orig_coords[i3], orig_coords[i4],
|
||||
target_coords[i2], target_coords[i3], target_coords[i4])
|
||||
median_coords[i3].append(pt)
|
||||
|
||||
pt = barycentric_transform(orig_shape_coords[i4],
|
||||
orig_coords[i3], orig_coords[i4], orig_coords[i1],
|
||||
target_coords[i3], target_coords[i4], target_coords[i1])
|
||||
median_coords[i4].append(pt)
|
||||
|
||||
else:
|
||||
pt = barycentric_transform(orig_shape_coords[i1],
|
||||
orig_coords[i3], orig_coords[i1], orig_coords[i2],
|
||||
target_coords[i3], target_coords[i1], target_coords[i2])
|
||||
median_coords[i1].append(pt)
|
||||
|
||||
pt = barycentric_transform(orig_shape_coords[i2],
|
||||
orig_coords[i1], orig_coords[i2], orig_coords[i3],
|
||||
target_coords[i1], target_coords[i2], target_coords[i3])
|
||||
median_coords[i2].append(pt)
|
||||
|
||||
pt = barycentric_transform(orig_shape_coords[i3],
|
||||
orig_coords[i2], orig_coords[i3], orig_coords[i1],
|
||||
target_coords[i2], target_coords[i3], target_coords[i1])
|
||||
median_coords[i3].append(pt)
|
||||
|
||||
elif mode == 'RELATIVE_EDGE':
|
||||
for ed in me.edges:
|
||||
i1, i2 = ed.vertices
|
||||
v1, v2 = orig_coords[i1], orig_coords[i2]
|
||||
edge_length = (v1 - v2).length
|
||||
n1loc = v1 + orig_normals[i1] * edge_length
|
||||
n2loc = v2 + orig_normals[i2] * edge_length
|
||||
|
||||
# now get the target nloc's
|
||||
v1_to, v2_to = target_coords[i1], target_coords[i2]
|
||||
edlen_to = (v1_to - v2_to).length
|
||||
n1loc_to = v1_to + target_normals[i1] * edlen_to
|
||||
n2loc_to = v2_to + target_normals[i2] * edlen_to
|
||||
|
||||
pt = barycentric_transform(orig_shape_coords[i1],
|
||||
v2, v1, n1loc,
|
||||
v2_to, v1_to, n1loc_to)
|
||||
median_coords[i1].append(pt)
|
||||
|
||||
pt = barycentric_transform(orig_shape_coords[i2],
|
||||
v1, v2, n2loc,
|
||||
v1_to, v2_to, n2loc_to)
|
||||
median_coords[i2].append(pt)
|
||||
|
||||
# apply the offsets to the new shape
|
||||
from functools import reduce
|
||||
VectorAdd = Vector.__add__
|
||||
|
||||
for i, vert_cos in enumerate(median_coords):
|
||||
if vert_cos:
|
||||
co = reduce(VectorAdd, vert_cos) / len(vert_cos)
|
||||
|
||||
if use_clamp:
|
||||
# clamp to the same movement as the original
|
||||
# breaks copy between different scaled meshes.
|
||||
len_from = (orig_shape_coords[i] - orig_coords[i]).length
|
||||
ofs = co - target_coords[i]
|
||||
ofs.length = len_from
|
||||
co = target_coords[i] + ofs
|
||||
|
||||
target_shape_coords[i][:] = co
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
obj = context.active_object
|
||||
return (obj and obj.mode != 'EDIT')
|
||||
|
||||
def execute(self, context):
|
||||
C = bpy.context
|
||||
ob_act = C.active_object
|
||||
objects = [ob for ob in C.selected_editable_objects if ob != ob_act]
|
||||
|
||||
if 1: # swap from/to, means we cant copy to many at once.
|
||||
if len(objects) != 1:
|
||||
self.report({'ERROR'}, "Expected one other selected mesh object to copy from")
|
||||
return {'CANCELLED'}
|
||||
ob_act, objects = objects[0], [ob_act]
|
||||
|
||||
if ob_act.type != 'MESH':
|
||||
self.report({'ERROR'}, "Other object is not a mesh.")
|
||||
return {'CANCELLED'}
|
||||
|
||||
if ob_act.active_shape_key is None:
|
||||
self.report({'ERROR'}, "Other object has no shape key")
|
||||
return {'CANCELLED'}
|
||||
return self._main(ob_act, objects, self.mode, self.use_clamp)
|
||||
|
||||
|
||||
class JoinUVs(bpy.types.Operator):
|
||||
'''Copy UV Layout to objects with matching geometry'''
|
||||
bl_idname = "object.join_uvs"
|
||||
bl_label = "Join as UVs"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
obj = context.active_object
|
||||
return (obj and obj.type == 'MESH')
|
||||
|
||||
def _main(self, context):
|
||||
import array
|
||||
obj = context.active_object
|
||||
mesh = obj.data
|
||||
|
||||
is_editmode = (obj.mode == 'EDIT')
|
||||
if is_editmode:
|
||||
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
|
||||
|
||||
if not mesh.uv_textures:
|
||||
self.report({'WARNING'}, "Object: %s, Mesh: '%s' has no UVs\n" % (obj.name, mesh.name))
|
||||
else:
|
||||
len_faces = len(mesh.faces)
|
||||
|
||||
uv_array = array.array('f', [0.0] * 8) * len_faces # seems to be the fastest way to create an array
|
||||
mesh.uv_textures.active.data.foreach_get("uv_raw", uv_array)
|
||||
|
||||
objects = context.selected_editable_objects[:]
|
||||
|
||||
for obj_other in objects:
|
||||
if obj_other.type == 'MESH':
|
||||
obj_other.data.tag = False
|
||||
|
||||
for obj_other in objects:
|
||||
if obj_other != obj and obj_other.type == 'MESH':
|
||||
mesh_other = obj_other.data
|
||||
if mesh_other != mesh:
|
||||
if mesh_other.tag == False:
|
||||
mesh_other.tag = True
|
||||
|
||||
if len(mesh_other.faces) != len_faces:
|
||||
self.report({'WARNING'}, "Object: %s, Mesh: '%s' has %d faces, expected %d\n" % (obj_other.name, mesh_other.name, len(mesh_other.faces), len_faces))
|
||||
else:
|
||||
uv_other = mesh_other.uv_textures.active
|
||||
if not uv_other:
|
||||
uv_other = mesh_other.uv_textures.new() # should return the texture it adds
|
||||
|
||||
# finally do the copy
|
||||
uv_other.data.foreach_set("uv_raw", uv_array)
|
||||
|
||||
if is_editmode:
|
||||
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
|
||||
|
||||
def execute(self, context):
|
||||
self._main(context)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class MakeDupliFace(bpy.types.Operator):
|
||||
'''Make linked objects into dupli-faces'''
|
||||
bl_idname = "object.make_dupli_face"
|
||||
bl_label = "Make Dupli-Face"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
obj = context.active_object
|
||||
return (obj and obj.type == 'MESH')
|
||||
|
||||
def _main(self, context):
|
||||
from mathutils import Vector
|
||||
|
||||
SCALE_FAC = 0.01
|
||||
offset = 0.5 * SCALE_FAC
|
||||
base_tri = Vector((-offset, -offset, 0.0)), Vector((offset, -offset, 0.0)), Vector((offset, offset, 0.0)), Vector((-offset, offset, 0.0))
|
||||
|
||||
def matrix_to_quat(matrix):
|
||||
# scale = matrix.median_scale
|
||||
trans = matrix.to_translation()
|
||||
rot = matrix.to_3x3() # also contains scale
|
||||
|
||||
return [(b * rot) + trans for b in base_tri]
|
||||
scene = bpy.context.scene
|
||||
linked = {}
|
||||
for obj in bpy.context.selected_objects:
|
||||
data = obj.data
|
||||
if data:
|
||||
linked.setdefault(data, []).append(obj)
|
||||
|
||||
for data, objects in linked.items():
|
||||
face_verts = [axis for obj in objects for v in matrix_to_quat(obj.matrix_world) for axis in v]
|
||||
faces = list(range(len(face_verts) // 3))
|
||||
|
||||
mesh = bpy.data.meshes.new(data.name + "_dupli")
|
||||
|
||||
mesh.vertices.add(len(face_verts) // 3)
|
||||
mesh.faces.add(len(face_verts) // 12)
|
||||
|
||||
mesh.vertices.foreach_set("co", face_verts)
|
||||
mesh.faces.foreach_set("vertices_raw", faces)
|
||||
mesh.update() # generates edge data
|
||||
|
||||
# pick an object to use
|
||||
obj = objects[0]
|
||||
|
||||
ob_new = bpy.data.objects.new(mesh.name, mesh)
|
||||
base = scene.objects.link(ob_new)
|
||||
base.layers[:] = obj.layers
|
||||
|
||||
ob_inst = bpy.data.objects.new(data.name, data)
|
||||
base = scene.objects.link(ob_inst)
|
||||
base.layers[:] = obj.layers
|
||||
|
||||
for obj in objects:
|
||||
scene.objects.unlink(obj)
|
||||
|
||||
ob_new.dupli_type = 'FACES'
|
||||
ob_inst.parent = ob_new
|
||||
ob_new.use_dupli_faces_scale = True
|
||||
ob_new.dupli_faces_scale = 1.0 / SCALE_FAC
|
||||
|
||||
def execute(self, context):
|
||||
self._main(context)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class IsolateTypeRender(bpy.types.Operator):
|
||||
'''Hide unselected render objects of same type as active by setting the hide render flag'''
|
||||
bl_idname = "object.isolate_type_render"
|
||||
bl_label = "Restrict Render Unselected"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
def execute(self, context):
|
||||
act_type = context.object.type
|
||||
|
||||
for obj in context.visible_objects:
|
||||
|
||||
if obj.select:
|
||||
obj.hide_render = False
|
||||
else:
|
||||
if obj.type == act_type:
|
||||
obj.hide_render = True
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class ClearAllRestrictRender(bpy.types.Operator):
|
||||
'''Reveal all render objects by setting the hide render flag'''
|
||||
bl_idname = "object.hide_render_clear_all"
|
||||
bl_label = "Clear All Restrict Render"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
def execute(self, context):
|
||||
for obj in context.scene.objects:
|
||||
obj.hide_render = False
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
|
@ -1,300 +0,0 @@
|
|||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
from mathutils import Vector
|
||||
|
||||
|
||||
def align_objects(align_x, align_y, align_z, align_mode, relative_to):
|
||||
|
||||
cursor = bpy.context.scene.cursor_location
|
||||
|
||||
Left_Up_Front_SEL = [0.0, 0.0, 0.0]
|
||||
Right_Down_Back_SEL = [0.0, 0.0, 0.0]
|
||||
|
||||
flag_first = True
|
||||
|
||||
objs = []
|
||||
|
||||
for obj in bpy.context.selected_objects:
|
||||
matrix_world = obj.matrix_world
|
||||
bb_world = [Vector(v[:]) * matrix_world for v in obj.bound_box]
|
||||
objs.append((obj, bb_world))
|
||||
|
||||
if not objs:
|
||||
return False
|
||||
|
||||
for obj, bb_world in objs:
|
||||
Left_Up_Front = bb_world[1]
|
||||
Right_Down_Back = bb_world[7]
|
||||
|
||||
# Active Center
|
||||
|
||||
if obj == bpy.context.active_object:
|
||||
|
||||
center_active_x = (Left_Up_Front[0] + Right_Down_Back[0]) / 2.0
|
||||
center_active_y = (Left_Up_Front[1] + Right_Down_Back[1]) / 2.0
|
||||
center_active_z = (Left_Up_Front[2] + Right_Down_Back[2]) / 2.0
|
||||
|
||||
size_active_x = (Right_Down_Back[0] - Left_Up_Front[0]) / 2.0
|
||||
size_active_y = (Right_Down_Back[1] - Left_Up_Front[1]) / 2.0
|
||||
size_active_z = (Left_Up_Front[2] - Right_Down_Back[2]) / 2.0
|
||||
|
||||
# Selection Center
|
||||
|
||||
if flag_first:
|
||||
flag_first = False
|
||||
|
||||
Left_Up_Front_SEL[0] = Left_Up_Front[0]
|
||||
Left_Up_Front_SEL[1] = Left_Up_Front[1]
|
||||
Left_Up_Front_SEL[2] = Left_Up_Front[2]
|
||||
|
||||
Right_Down_Back_SEL[0] = Right_Down_Back[0]
|
||||
Right_Down_Back_SEL[1] = Right_Down_Back[1]
|
||||
Right_Down_Back_SEL[2] = Right_Down_Back[2]
|
||||
|
||||
else:
|
||||
# X axis
|
||||
if Left_Up_Front[0] < Left_Up_Front_SEL[0]:
|
||||
Left_Up_Front_SEL[0] = Left_Up_Front[0]
|
||||
# Y axis
|
||||
if Left_Up_Front[1] < Left_Up_Front_SEL[1]:
|
||||
Left_Up_Front_SEL[1] = Left_Up_Front[1]
|
||||
# Z axis
|
||||
if Left_Up_Front[2] > Left_Up_Front_SEL[2]:
|
||||
Left_Up_Front_SEL[2] = Left_Up_Front[2]
|
||||
|
||||
# X axis
|
||||
if Right_Down_Back[0] > Right_Down_Back_SEL[0]:
|
||||
Right_Down_Back_SEL[0] = Right_Down_Back[0]
|
||||
# Y axis
|
||||
if Right_Down_Back[1] > Right_Down_Back_SEL[1]:
|
||||
Right_Down_Back_SEL[1] = Right_Down_Back[1]
|
||||
# Z axis
|
||||
if Right_Down_Back[2] < Right_Down_Back_SEL[2]:
|
||||
Right_Down_Back_SEL[2] = Right_Down_Back[2]
|
||||
|
||||
center_sel_x = (Left_Up_Front_SEL[0] + Right_Down_Back_SEL[0]) / 2.0
|
||||
center_sel_y = (Left_Up_Front_SEL[1] + Right_Down_Back_SEL[1]) / 2.0
|
||||
center_sel_z = (Left_Up_Front_SEL[2] + Right_Down_Back_SEL[2]) / 2.0
|
||||
|
||||
# Main Loop
|
||||
|
||||
for obj, bb_world in objs:
|
||||
|
||||
loc_world = obj.location
|
||||
bb_world = [Vector(v[:]) * obj.matrix_world for v in obj.bound_box]
|
||||
|
||||
Left_Up_Front = bb_world[1]
|
||||
Right_Down_Back = bb_world[7]
|
||||
|
||||
center_x = (Left_Up_Front[0] + Right_Down_Back[0]) / 2.0
|
||||
center_y = (Left_Up_Front[1] + Right_Down_Back[1]) / 2.0
|
||||
center_z = (Left_Up_Front[2] + Right_Down_Back[2]) / 2.0
|
||||
|
||||
positive_x = Right_Down_Back[0]
|
||||
positive_y = Right_Down_Back[1]
|
||||
positive_z = Left_Up_Front[2]
|
||||
|
||||
negative_x = Left_Up_Front[0]
|
||||
negative_y = Left_Up_Front[1]
|
||||
negative_z = Right_Down_Back[2]
|
||||
|
||||
obj_loc = obj.location
|
||||
|
||||
if align_x:
|
||||
|
||||
# Align Mode
|
||||
|
||||
if relative_to == 'OPT_4': # Active relative
|
||||
if align_mode == 'OPT_1':
|
||||
obj_x = obj_loc[0] - negative_x - size_active_x
|
||||
|
||||
elif align_mode == 'OPT_3':
|
||||
obj_x = obj_loc[0] - positive_x + size_active_x
|
||||
|
||||
else: # Everything else relative
|
||||
if align_mode == 'OPT_1':
|
||||
obj_x = obj_loc[0] - negative_x
|
||||
|
||||
elif align_mode == 'OPT_3':
|
||||
obj_x = obj_loc[0] - positive_x
|
||||
|
||||
if align_mode == 'OPT_2': # All relative
|
||||
obj_x = obj_loc[0] - center_x
|
||||
|
||||
# Relative To
|
||||
|
||||
if relative_to == 'OPT_1':
|
||||
loc_x = obj_x
|
||||
|
||||
elif relative_to == 'OPT_2':
|
||||
loc_x = obj_x + cursor[0]
|
||||
|
||||
elif relative_to == 'OPT_3':
|
||||
loc_x = obj_x + center_sel_x
|
||||
|
||||
elif relative_to == 'OPT_4':
|
||||
loc_x = obj_x + center_active_x
|
||||
|
||||
obj.location[0] = loc_x
|
||||
|
||||
if align_y:
|
||||
# Align Mode
|
||||
|
||||
if relative_to == 'OPT_4': # Active relative
|
||||
if align_mode == 'OPT_1':
|
||||
obj_y = obj_loc[1] - negative_y - size_active_y
|
||||
|
||||
elif align_mode == 'OPT_3':
|
||||
obj_y = obj_loc[1] - positive_y + size_active_y
|
||||
|
||||
else: # Everything else relative
|
||||
if align_mode == 'OPT_1':
|
||||
obj_y = obj_loc[1] - negative_y
|
||||
|
||||
elif align_mode == 'OPT_3':
|
||||
obj_y = obj_loc[1] - positive_y
|
||||
|
||||
if align_mode == 'OPT_2': # All relative
|
||||
obj_y = obj_loc[1] - center_y
|
||||
|
||||
# Relative To
|
||||
|
||||
if relative_to == 'OPT_1':
|
||||
loc_y = obj_y
|
||||
|
||||
elif relative_to == 'OPT_2':
|
||||
loc_y = obj_y + cursor[1]
|
||||
|
||||
elif relative_to == 'OPT_3':
|
||||
loc_y = obj_y + center_sel_y
|
||||
|
||||
elif relative_to == 'OPT_4':
|
||||
loc_y = obj_y + center_active_y
|
||||
|
||||
obj.location[1] = loc_y
|
||||
|
||||
if align_z:
|
||||
# Align Mode
|
||||
if relative_to == 'OPT_4': # Active relative
|
||||
if align_mode == 'OPT_1':
|
||||
obj_z = obj_loc[2] - negative_z - size_active_z
|
||||
|
||||
elif align_mode == 'OPT_3':
|
||||
obj_z = obj_loc[2] - positive_z + size_active_z
|
||||
|
||||
else: # Everything else relative
|
||||
if align_mode == 'OPT_1':
|
||||
obj_z = obj_loc[2] - negative_z
|
||||
|
||||
elif align_mode == 'OPT_3':
|
||||
obj_z = obj_loc[2] - positive_z
|
||||
|
||||
if align_mode == 'OPT_2': # All relative
|
||||
obj_z = obj_loc[2] - center_z
|
||||
|
||||
# Relative To
|
||||
|
||||
if relative_to == 'OPT_1':
|
||||
loc_z = obj_z
|
||||
|
||||
elif relative_to == 'OPT_2':
|
||||
loc_z = obj_z + cursor[2]
|
||||
|
||||
elif relative_to == 'OPT_3':
|
||||
loc_z = obj_z + center_sel_z
|
||||
|
||||
elif relative_to == 'OPT_4':
|
||||
loc_z = obj_z + center_active_z
|
||||
|
||||
obj.location[2] = loc_z
|
||||
|
||||
return True
|
||||
|
||||
|
||||
from bpy.props import *
|
||||
|
||||
|
||||
class AlignObjects(bpy.types.Operator):
|
||||
'''Align Objects'''
|
||||
bl_idname = "object.align"
|
||||
bl_label = "Align Objects"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
align_mode = bpy.props.EnumProperty(items=(
|
||||
('OPT_1', "Negative Sides", ""),
|
||||
('OPT_2', "Centers", ""),
|
||||
('OPT_3', "Positive Sides", "")),
|
||||
name="Align Mode:",
|
||||
description="",
|
||||
default='OPT_2')
|
||||
|
||||
relative_to = bpy.props.EnumProperty(items=(
|
||||
('OPT_1', "Scene Origin", ""),
|
||||
('OPT_2', "3D Cursor", ""),
|
||||
('OPT_3', "Selection", ""),
|
||||
('OPT_4', "Active", "")),
|
||||
name="Relative To:",
|
||||
description="",
|
||||
default='OPT_4')
|
||||
|
||||
align_axis = EnumProperty(items=(
|
||||
('X', "X", ""),
|
||||
('Y', "Y", ""),
|
||||
('Z', "Z", ""),
|
||||
),
|
||||
name="Align",
|
||||
description="Align to axis",
|
||||
options={'ENUM_FLAG'})
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.mode == 'OBJECT'
|
||||
|
||||
def execute(self, context):
|
||||
align_axis = self.align_axis
|
||||
ret = align_objects('X' in align_axis, 'Y' in align_axis, 'Z' in align_axis, self.align_mode, self.relative_to)
|
||||
|
||||
if not ret:
|
||||
self.report({'WARNING'}, "No objects with bound-box selected")
|
||||
return {'CANCELLED'}
|
||||
else:
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def menu_func(self, context):
|
||||
if context.mode == 'OBJECT':
|
||||
self.layout.operator(AlignObjects.bl_idname,
|
||||
text="Align Objects")
|
||||
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
bpy.types.VIEW3D_MT_transform.append(menu_func)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
bpy.types.VIEW3D_MT_transform.remove(menu_func)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
|
@ -1,167 +0,0 @@
|
|||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def randomize_selected(seed, delta, loc, rot, scale, scale_even):
|
||||
|
||||
import random
|
||||
from random import uniform
|
||||
from mathutils import Vector
|
||||
|
||||
random.seed(seed)
|
||||
|
||||
def rand_vec(vec_range):
|
||||
return Vector(uniform(-val, val) for val in vec_range)
|
||||
|
||||
for obj in bpy.context.selected_objects:
|
||||
|
||||
if loc:
|
||||
if delta:
|
||||
obj.delta_location += rand_vec(loc)
|
||||
else:
|
||||
obj.location += rand_vec(loc)
|
||||
else: # otherwise the values change under us
|
||||
uniform(0.0, 0.0), uniform(0.0, 0.0), uniform(0.0, 0.0)
|
||||
|
||||
if rot: # TODO, non euler's
|
||||
vec = rand_vec(rot)
|
||||
if delta:
|
||||
obj.delta_rotation_euler[0] += vec[0]
|
||||
obj.delta_rotation_euler[1] += vec[1]
|
||||
obj.delta_rotation_euler[2] += vec[2]
|
||||
else:
|
||||
obj.rotation_euler[0] += vec[0]
|
||||
obj.rotation_euler[1] += vec[1]
|
||||
obj.rotation_euler[2] += vec[2]
|
||||
else:
|
||||
uniform(0.0, 0.0), uniform(0.0, 0.0), uniform(0.0, 0.0)
|
||||
|
||||
if scale:
|
||||
if delta:
|
||||
org_sca_x, org_sca_y, org_sca_z = obj.delta_scale
|
||||
else:
|
||||
org_sca_x, org_sca_y, org_sca_z = obj.scale
|
||||
|
||||
if scale_even:
|
||||
sca_x = sca_y = sca_z = uniform(scale[0], - scale[0])
|
||||
uniform(0.0, 0.0), uniform(0.0, 0.0)
|
||||
else:
|
||||
sca_x, sca_y, sca_z = rand_vec(scale)
|
||||
|
||||
if scale_even:
|
||||
aX = -(sca_x * org_sca_x) + org_sca_x
|
||||
aY = -(sca_x * org_sca_y) + org_sca_y
|
||||
aZ = -(sca_x * org_sca_z) + org_sca_z
|
||||
else:
|
||||
aX = sca_x + org_sca_x
|
||||
aY = sca_y + org_sca_y
|
||||
aZ = sca_z + org_sca_z
|
||||
|
||||
if delta:
|
||||
obj.delta_scale = aX, aY, aZ
|
||||
else:
|
||||
obj.scale = aX, aY, aZ
|
||||
else:
|
||||
uniform(0.0, 0.0), uniform(0.0, 0.0), uniform(0.0, 0.0)
|
||||
|
||||
|
||||
from bpy.props import *
|
||||
|
||||
|
||||
class RandomizeLocRotSize(bpy.types.Operator):
|
||||
'''Randomize objects loc/rot/scale'''
|
||||
bl_idname = "object.randomize_transform"
|
||||
bl_label = "Randomize Transform"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
random_seed = IntProperty(name="Random Seed",
|
||||
description="Seed value for the random generator",
|
||||
default=0, min=0, max=1000)
|
||||
|
||||
use_delta = BoolProperty(name="Transform Delta",
|
||||
description="Randomize delta transform values instead of regular transform", default=False)
|
||||
|
||||
use_loc = BoolProperty(name="Randomize Location",
|
||||
description="Randomize the location values", default=True)
|
||||
|
||||
loc = FloatVectorProperty(name="Location",
|
||||
description="Maximun distance the objects can spread over each axis",
|
||||
default=(0.0, 0.0, 0.0), min=-100.0, max=100.0, subtype='TRANSLATION')
|
||||
|
||||
use_rot = BoolProperty(name="Randomize Rotation",
|
||||
description="Randomize the rotation values", default=True)
|
||||
|
||||
rot = FloatVectorProperty(name="Rotation",
|
||||
description="Maximun rotation over each axis",
|
||||
default=(0.0, 0.0, 0.0), min=-180.0, max=180.0, subtype='TRANSLATION')
|
||||
|
||||
use_scale = BoolProperty(name="Randomize Scale",
|
||||
description="Randomize the scale values", default=True)
|
||||
|
||||
scale_even = BoolProperty(name="Scale Even",
|
||||
description="Use the same scale value for all axis", default=False)
|
||||
|
||||
'''scale_min = FloatProperty(name="Minimun Scale Factor",
|
||||
description="Lowest scale percentage possible",
|
||||
default=0.15, min=-1.0, max=1.0, precision=3)'''
|
||||
|
||||
scale = FloatVectorProperty(name="Scale",
|
||||
description="Maximum scale randomization over each axis",
|
||||
default=(0.0, 0.0, 0.0), min=-100.0, max=100.0, subtype='TRANSLATION')
|
||||
|
||||
def execute(self, context):
|
||||
from math import radians
|
||||
|
||||
seed = self.random_seed
|
||||
|
||||
delta = self.use_delta
|
||||
|
||||
loc = None if not self.use_loc else self.loc
|
||||
rot = None if not self.use_rot else self.rot * radians(1.0)
|
||||
scale = None if not self.use_scale else self.scale
|
||||
|
||||
scale_even = self.scale_even
|
||||
#scale_min = self.scale_min
|
||||
|
||||
randomize_selected(seed, delta, loc, rot, scale, scale_even)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def menu_func(self, context):
|
||||
if context.mode == 'OBJECT':
|
||||
self.layout.operator(RandomizeLocRotSize.bl_idname,
|
||||
text="Randomize Transform")
|
||||
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
bpy.types.VIEW3D_MT_transform.append(menu_func)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
bpy.types.VIEW3D_MT_transform.remove(menu_func)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
|
@ -1,364 +0,0 @@
|
|||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
import os
|
||||
|
||||
|
||||
class AddPresetBase():
|
||||
'''Base preset class, only for subclassing
|
||||
subclasses must define
|
||||
- preset_values
|
||||
- preset_subdir '''
|
||||
# bl_idname = "script.preset_base_add"
|
||||
# bl_label = "Add a Python Preset"
|
||||
bl_options = {'REGISTER'} # only because invoke_props_popup requires.
|
||||
|
||||
name = bpy.props.StringProperty(name="Name", description="Name of the preset, used to make the path name", maxlen=64, default="")
|
||||
remove_active = bpy.props.BoolProperty(default=False, options={'HIDDEN'})
|
||||
|
||||
@staticmethod
|
||||
def as_filename(name): # could reuse for other presets
|
||||
for char in " !@#$%^&*(){}:\";'[]<>,.\\/?":
|
||||
name = name.replace(char, '_')
|
||||
return name.lower().strip()
|
||||
|
||||
def execute(self, context):
|
||||
import os
|
||||
|
||||
if hasattr(self, "pre_cb"):
|
||||
self.pre_cb(context)
|
||||
|
||||
preset_menu_class = getattr(bpy.types, self.preset_menu)
|
||||
|
||||
if not self.remove_active:
|
||||
|
||||
if not self.name:
|
||||
return {'FINISHED'}
|
||||
|
||||
filename = self.as_filename(self.name)
|
||||
|
||||
target_path = bpy.utils.user_resource('SCRIPTS', os.path.join("presets", self.preset_subdir), create=True)
|
||||
|
||||
if not target_path:
|
||||
self.report({'WARNING'}, "Failed to create presets path")
|
||||
return {'CANCELLED'}
|
||||
|
||||
filepath = os.path.join(target_path, filename) + ".py"
|
||||
|
||||
if hasattr(self, "add"):
|
||||
self.add(context, filepath)
|
||||
else:
|
||||
file_preset = open(filepath, 'w')
|
||||
file_preset.write("import bpy\n")
|
||||
|
||||
if hasattr(self, "preset_defines"):
|
||||
for rna_path in self.preset_defines:
|
||||
exec(rna_path)
|
||||
file_preset.write("%s\n" % rna_path)
|
||||
file_preset.write("\n")
|
||||
|
||||
for rna_path in self.preset_values:
|
||||
value = eval(rna_path)
|
||||
# convert thin wrapped sequences to simple lists to repr()
|
||||
try:
|
||||
value = value[:]
|
||||
except:
|
||||
pass
|
||||
|
||||
file_preset.write("%s = %r\n" % (rna_path, value))
|
||||
|
||||
file_preset.close()
|
||||
|
||||
preset_menu_class.bl_label = bpy.path.display_name(filename)
|
||||
|
||||
else:
|
||||
preset_active = preset_menu_class.bl_label
|
||||
|
||||
# fairly sloppy but convenient.
|
||||
filepath = bpy.utils.preset_find(preset_active, self.preset_subdir)
|
||||
|
||||
if not filepath:
|
||||
filepath = bpy.utils.preset_find(preset_active, self.preset_subdir, display_name=True)
|
||||
|
||||
if not filepath:
|
||||
return {'CANCELLED'}
|
||||
|
||||
if hasattr(self, "remove"):
|
||||
self.remove(context, filepath)
|
||||
else:
|
||||
try:
|
||||
os.remove(filepath)
|
||||
except:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
# XXX, stupid!
|
||||
preset_menu_class.bl_label = "Presets"
|
||||
|
||||
if hasattr(self, "post_cb"):
|
||||
self.post_cb(context)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
def check(self, context):
|
||||
self.name = self.as_filename(self.name)
|
||||
|
||||
def invoke(self, context, event):
|
||||
if not self.remove_active:
|
||||
wm = context.window_manager
|
||||
return wm.invoke_props_dialog(self)
|
||||
else:
|
||||
return self.execute(context)
|
||||
|
||||
|
||||
class ExecutePreset(bpy.types.Operator):
|
||||
''' Executes a preset '''
|
||||
bl_idname = "script.execute_preset"
|
||||
bl_label = "Execute a Python Preset"
|
||||
|
||||
filepath = bpy.props.StringProperty(name="Path", description="Path of the Python file to execute", maxlen=512, default="")
|
||||
menu_idname = bpy.props.StringProperty(name="Menu ID Name", description="ID name of the menu this was called from", default="")
|
||||
|
||||
def execute(self, context):
|
||||
from os.path import basename
|
||||
filepath = self.filepath
|
||||
|
||||
# change the menu title to the most recently chosen option
|
||||
preset_class = getattr(bpy.types, self.menu_idname)
|
||||
preset_class.bl_label = bpy.path.display_name(basename(filepath))
|
||||
|
||||
# execute the preset using script.python_file_run
|
||||
bpy.ops.script.python_file_run(filepath=filepath)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class AddPresetRender(AddPresetBase, bpy.types.Operator):
|
||||
'''Add a Render Preset'''
|
||||
bl_idname = "render.preset_add"
|
||||
bl_label = "Add Render Preset"
|
||||
preset_menu = "RENDER_MT_presets"
|
||||
|
||||
preset_defines = [
|
||||
"scene = bpy.context.scene"
|
||||
]
|
||||
|
||||
preset_values = [
|
||||
"scene.render.field_order",
|
||||
"scene.render.fps",
|
||||
"scene.render.fps_base",
|
||||
"scene.render.pixel_aspect_x",
|
||||
"scene.render.pixel_aspect_y",
|
||||
"scene.render.resolution_percentage",
|
||||
"scene.render.resolution_x",
|
||||
"scene.render.resolution_y",
|
||||
"scene.render.use_fields",
|
||||
"scene.render.use_fields_still",
|
||||
]
|
||||
|
||||
preset_subdir = "render"
|
||||
|
||||
|
||||
class AddPresetSSS(AddPresetBase, bpy.types.Operator):
|
||||
'''Add a Subsurface Scattering Preset'''
|
||||
bl_idname = "material.sss_preset_add"
|
||||
bl_label = "Add SSS Preset"
|
||||
preset_menu = "MATERIAL_MT_sss_presets"
|
||||
|
||||
preset_defines = [
|
||||
"material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material)"
|
||||
]
|
||||
|
||||
preset_values = [
|
||||
"material.subsurface_scattering.back",
|
||||
"material.subsurface_scattering.color",
|
||||
"material.subsurface_scattering.color_factor",
|
||||
"material.subsurface_scattering.error_threshold",
|
||||
"material.subsurface_scattering.front",
|
||||
"material.subsurface_scattering.ior",
|
||||
"material.subsurface_scattering.radius",
|
||||
"material.subsurface_scattering.scale",
|
||||
"material.subsurface_scattering.texture_factor",
|
||||
]
|
||||
|
||||
preset_subdir = "sss"
|
||||
|
||||
|
||||
class AddPresetCloth(AddPresetBase, bpy.types.Operator):
|
||||
'''Add a Cloth Preset'''
|
||||
bl_idname = "cloth.preset_add"
|
||||
bl_label = "Add Cloth Preset"
|
||||
preset_menu = "CLOTH_MT_presets"
|
||||
|
||||
preset_defines = [
|
||||
"cloth = bpy.context.cloth"
|
||||
]
|
||||
|
||||
preset_values = [
|
||||
"cloth.settings.air_damping",
|
||||
"cloth.settings.bending_stiffness",
|
||||
"cloth.settings.mass",
|
||||
"cloth.settings.quality",
|
||||
"cloth.settings.spring_damping",
|
||||
"cloth.settings.structural_stiffness",
|
||||
]
|
||||
|
||||
preset_subdir = "cloth"
|
||||
|
||||
|
||||
class AddPresetSunSky(AddPresetBase, bpy.types.Operator):
|
||||
'''Add a Sky & Atmosphere Preset'''
|
||||
bl_idname = "lamp.sunsky_preset_add"
|
||||
bl_label = "Add Sunsky Preset"
|
||||
preset_menu = "LAMP_MT_sunsky_presets"
|
||||
|
||||
preset_defines = [
|
||||
"sky = bpy.context.object.data.sky"
|
||||
]
|
||||
|
||||
preset_values = [
|
||||
"sky.atmosphere_extinction",
|
||||
"sky.atmosphere_inscattering",
|
||||
"sky.atmosphere_turbidity",
|
||||
"sky.backscattered_light",
|
||||
"sky.horizon_brightness",
|
||||
"sky.spread",
|
||||
"sky.sun_brightness",
|
||||
"sky.sun_intensity",
|
||||
"sky.sun_size",
|
||||
"sky.use_sky_blend",
|
||||
"sky.use_sky_blend_type",
|
||||
"sky.use_sky_color_space",
|
||||
"sky.use_sky_exposure",
|
||||
]
|
||||
|
||||
preset_subdir = "sunsky"
|
||||
|
||||
|
||||
class AddPresetInteraction(AddPresetBase, bpy.types.Operator):
|
||||
'''Add an Application Interaction Preset'''
|
||||
bl_idname = "wm.interaction_preset_add"
|
||||
bl_label = "Add Interaction Preset"
|
||||
preset_menu = "USERPREF_MT_interaction_presets"
|
||||
|
||||
preset_defines = [
|
||||
"user_preferences = bpy.context.user_preferences"
|
||||
]
|
||||
|
||||
preset_values = [
|
||||
"user_preferences.edit.use_drag_immediately",
|
||||
"user_preferences.edit.use_insertkey_xyz_to_rgb",
|
||||
"user_preferences.inputs.invert_mouse_wheel_zoom",
|
||||
"user_preferences.inputs.select_mouse",
|
||||
"user_preferences.inputs.use_emulate_numpad",
|
||||
"user_preferences.inputs.use_mouse_continuous",
|
||||
"user_preferences.inputs.use_mouse_emulate_3_button",
|
||||
"user_preferences.inputs.view_rotate_method",
|
||||
"user_preferences.inputs.view_zoom_axis",
|
||||
"user_preferences.inputs.view_zoom_method",
|
||||
]
|
||||
|
||||
preset_subdir = "interaction"
|
||||
|
||||
|
||||
class AddPresetKeyconfig(AddPresetBase, bpy.types.Operator):
|
||||
'''Add a Keyconfig Preset'''
|
||||
bl_idname = "wm.keyconfig_preset_add"
|
||||
bl_label = "Add Keyconfig Preset"
|
||||
preset_menu = "USERPREF_MT_keyconfigs"
|
||||
preset_subdir = "keyconfig"
|
||||
|
||||
def add(self, context, filepath):
|
||||
bpy.ops.wm.keyconfig_export(filepath=filepath)
|
||||
bpy.utils.keyconfig_set(filepath)
|
||||
|
||||
def pre_cb(self, context):
|
||||
keyconfigs = bpy.context.window_manager.keyconfigs
|
||||
if self.remove_active:
|
||||
preset_menu_class = getattr(bpy.types, self.preset_menu)
|
||||
preset_menu_class.bl_label = keyconfigs.active.name
|
||||
|
||||
def post_cb(self, context):
|
||||
keyconfigs = bpy.context.window_manager.keyconfigs
|
||||
if self.remove_active:
|
||||
keyconfigs.remove(keyconfigs.active)
|
||||
|
||||
|
||||
class AddPresetOperator(AddPresetBase, bpy.types.Operator):
|
||||
'''Add an Application Interaction Preset'''
|
||||
bl_idname = "wm.operator_preset_add"
|
||||
bl_label = "Operator Preset"
|
||||
preset_menu = "WM_MT_operator_presets"
|
||||
|
||||
operator = bpy.props.StringProperty(name="Operator", maxlen=64, options={'HIDDEN'})
|
||||
|
||||
# XXX, not ideal
|
||||
preset_defines = [
|
||||
"op = bpy.context.space_data.operator",
|
||||
]
|
||||
|
||||
@property
|
||||
def preset_subdir(self):
|
||||
return __class__.operator_path(self.operator)
|
||||
|
||||
@property
|
||||
def preset_values(self):
|
||||
properties_blacklist = bpy.types.Operator.bl_rna.properties.keys()
|
||||
|
||||
prefix, suffix = self.operator.split("_OT_", 1)
|
||||
operator_rna = getattr(getattr(bpy.ops, prefix.lower()), suffix).get_rna().bl_rna
|
||||
|
||||
ret = []
|
||||
for prop_id, prop in operator_rna.properties.items():
|
||||
if (not prop.is_hidden) and prop_id not in properties_blacklist:
|
||||
ret.append("op.%s" % prop_id)
|
||||
|
||||
return ret
|
||||
|
||||
@staticmethod
|
||||
def operator_path(operator):
|
||||
import os
|
||||
prefix, suffix = operator.split("_OT_", 1)
|
||||
return os.path.join("operator", "%s.%s" % (prefix.lower(), suffix))
|
||||
|
||||
|
||||
class WM_MT_operator_presets(bpy.types.Menu):
|
||||
bl_label = "Operator Presets"
|
||||
|
||||
def draw(self, context):
|
||||
self.operator = context.space_data.operator.bl_idname
|
||||
bpy.types.Menu.draw_preset(self, context)
|
||||
|
||||
@property
|
||||
def preset_subdir(self):
|
||||
return AddPresetOperator.operator_path(self.operator)
|
||||
|
||||
preset_operator = "script.execute_preset"
|
||||
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
|
@ -1,157 +0,0 @@
|
|||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# Script copyright (C) Campbell J Barton
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ***** END GPL LICENCE BLOCK *****
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
# History
|
||||
#
|
||||
# Originally written by Matt Ebb
|
||||
|
||||
import bpy
|
||||
import os
|
||||
|
||||
|
||||
def guess_player_path(preset):
|
||||
import platform
|
||||
try:
|
||||
system = platform.system()
|
||||
except UnicodeDecodeError:
|
||||
import sys
|
||||
system = sys.platform
|
||||
|
||||
if preset == 'BLENDER24':
|
||||
player_path = "blender"
|
||||
|
||||
if system == 'Darwin':
|
||||
test_path = "/Applications/blender 2.49.app/Contents/MacOS/blender"
|
||||
elif system in ('Windows', 'win32'):
|
||||
test_path = "/Program Files/Blender Foundation/Blender/blender.exe"
|
||||
|
||||
if os.path.exists(test_path):
|
||||
player_path = test_path
|
||||
|
||||
elif preset == 'DJV':
|
||||
player_path = "djv_view"
|
||||
|
||||
if system == 'Darwin':
|
||||
test_path = '/Applications/djv-0.8.2.app/Contents/Resources/bin/djv_view'
|
||||
if os.path.exists(test_path):
|
||||
player_path = test_path
|
||||
|
||||
elif preset == 'FRAMECYCLER':
|
||||
player_path = "framecycler"
|
||||
|
||||
elif preset == 'RV':
|
||||
player_path = "rv"
|
||||
|
||||
elif preset == 'MPLAYER':
|
||||
player_path = "mplayer"
|
||||
|
||||
return player_path
|
||||
|
||||
|
||||
class PlayRenderedAnim(bpy.types.Operator):
|
||||
'''Plays back rendered frames/movies using an external player.'''
|
||||
bl_idname = "render.play_rendered_anim"
|
||||
bl_label = "Play Rendered Animation"
|
||||
bl_options = {'REGISTER'}
|
||||
|
||||
def execute(self, context):
|
||||
import subprocess
|
||||
|
||||
scene = context.scene
|
||||
rd = scene.render
|
||||
prefs = context.user_preferences
|
||||
|
||||
preset = prefs.filepaths.animation_player_preset
|
||||
player_path = prefs.filepaths.animation_player
|
||||
file_path = bpy.path.abspath(rd.filepath)
|
||||
is_movie = rd.is_movie_format
|
||||
|
||||
# try and guess a command line if it doesn't exist
|
||||
if player_path == '':
|
||||
player_path = guess_player_path(preset)
|
||||
|
||||
if is_movie == False and preset in ('FRAMECYCLER', 'RV', 'MPLAYER'):
|
||||
# replace the number with '#'
|
||||
file_a = rd.frame_path(frame=0)
|
||||
|
||||
# TODO, make an api call for this
|
||||
frame_tmp = 9
|
||||
file_b = rd.frame_path(frame=frame_tmp)
|
||||
|
||||
while len(file_a) == len(file_b):
|
||||
frame_tmp = (frame_tmp * 10) + 9
|
||||
print(frame_tmp)
|
||||
file_b = rd.frame_path(frame=frame_tmp)
|
||||
file_b = rd.frame_path(frame=int(frame_tmp / 10))
|
||||
|
||||
file = "".join((c if file_b[i] == c else "#") for i, c in enumerate(file_a))
|
||||
else:
|
||||
# works for movies and images
|
||||
file = rd.frame_path(frame=scene.frame_start)
|
||||
|
||||
file = bpy.path.abspath(file) # expand '//'
|
||||
|
||||
cmd = [player_path]
|
||||
# extra options, fps controls etc.
|
||||
if preset == 'BLENDER24':
|
||||
opts = ["-a", "-f", str(rd.fps), str(rd.fps_base), file]
|
||||
cmd.extend(opts)
|
||||
elif preset == 'DJV':
|
||||
opts = [file, "-playback_speed", str(rd.fps)]
|
||||
cmd.extend(opts)
|
||||
elif preset == 'FRAMECYCLER':
|
||||
opts = [file, "%d-%d" % (scene.frame_start, scene.frame_end)]
|
||||
cmd.extend(opts)
|
||||
elif preset == 'RV':
|
||||
opts = ["-fps", str(rd.fps), "-play", "[ %s ]" % file]
|
||||
cmd.extend(opts)
|
||||
elif preset == 'MPLAYER':
|
||||
opts = []
|
||||
if is_movie:
|
||||
opts.append(file)
|
||||
else:
|
||||
opts.append("mf://%s" % file.replace("#", "?"))
|
||||
opts += ["-mf", "fps=%.4f" % (rd.fps / rd.fps_base)]
|
||||
opts += ["-loop", "0", "-really-quiet", "-fs"]
|
||||
cmd.extend(opts)
|
||||
else: # 'CUSTOM'
|
||||
cmd.append(file)
|
||||
|
||||
# launch it
|
||||
try:
|
||||
process = subprocess.Popen(cmd)
|
||||
except:
|
||||
pass
|
||||
#raise OSError("Couldn't find an external animation player.")
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
|
@ -1,146 +0,0 @@
|
|||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
|
||||
from bpy.props import *
|
||||
|
||||
|
||||
class SequencerCrossfadeSounds(bpy.types.Operator):
|
||||
'''Do crossfading volume animation of two selected sound strips.'''
|
||||
|
||||
bl_idname = "sequencer.crossfade_sounds"
|
||||
bl_label = "Crossfade sounds"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
if context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip:
|
||||
return context.scene.sequence_editor.active_strip.type == 'SOUND'
|
||||
else:
|
||||
return False
|
||||
|
||||
def execute(self, context):
|
||||
seq1 = None
|
||||
seq2 = None
|
||||
for s in context.scene.sequence_editor.sequences:
|
||||
if s.select and s.type == 'SOUND':
|
||||
if seq1 is None:
|
||||
seq1 = s
|
||||
elif seq2 is None:
|
||||
seq2 = s
|
||||
else:
|
||||
seq2 = None
|
||||
break
|
||||
if seq2 is None:
|
||||
self.report({'ERROR'}, "Select 2 sound strips.")
|
||||
return {'CANCELLED'}
|
||||
if seq1.frame_final_start > seq2.frame_final_start:
|
||||
s = seq1
|
||||
seq1 = seq2
|
||||
seq2 = s
|
||||
if seq1.frame_final_end > seq2.frame_final_start:
|
||||
tempcfra = context.scene.frame_current
|
||||
context.scene.frame_current = seq2.frame_final_start
|
||||
seq1.keyframe_insert('volume')
|
||||
context.scene.frame_current = seq1.frame_final_end
|
||||
seq1.volume = 0
|
||||
seq1.keyframe_insert('volume')
|
||||
seq2.keyframe_insert('volume')
|
||||
context.scene.frame_current = seq2.frame_final_start
|
||||
seq2.volume = 0
|
||||
seq2.keyframe_insert('volume')
|
||||
context.scene.frame_current = tempcfra
|
||||
return {'FINISHED'}
|
||||
else:
|
||||
self.report({'ERROR'}, "The selected strips don't overlap.")
|
||||
return {'CANCELLED'}
|
||||
|
||||
|
||||
class SequencerCutMulticam(bpy.types.Operator):
|
||||
'''Cut multicam strip and select camera.'''
|
||||
|
||||
bl_idname = "sequencer.cut_multicam"
|
||||
bl_label = "Cut multicam"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
camera = IntProperty(name="Camera",
|
||||
default=1, min=1, max=32, soft_min=1, soft_max=32)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
if context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip:
|
||||
return context.scene.sequence_editor.active_strip.type == 'MULTICAM'
|
||||
else:
|
||||
return False
|
||||
|
||||
def execute(self, context):
|
||||
camera = self.camera
|
||||
|
||||
s = context.scene.sequence_editor.active_strip
|
||||
|
||||
if s.multicam_source == camera or camera >= s.channel:
|
||||
return {'FINISHED'}
|
||||
|
||||
if not s.select:
|
||||
s.select = True
|
||||
|
||||
cfra = context.scene.frame_current
|
||||
bpy.ops.sequencer.cut(frame=cfra, type='SOFT', side='RIGHT')
|
||||
for s in context.scene.sequence_editor.sequences_all:
|
||||
if s.select and s.type == 'MULTICAM' and s.frame_final_start <= cfra and cfra < s.frame_final_end:
|
||||
context.scene.sequence_editor.active_strip = s
|
||||
|
||||
context.scene.sequence_editor.active_strip.multicam_source = camera
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class SequencerDeinterlaceSelectedMovies(bpy.types.Operator):
|
||||
'''Deinterlace all selected movie sources.'''
|
||||
|
||||
bl_idname = "sequencer.deinterlace_selected_movies"
|
||||
bl_label = "Deinterlace Movies"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
if context.scene and context.scene.sequence_editor:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def execute(self, context):
|
||||
for s in context.scene.sequence_editor.sequences_all:
|
||||
if s.select and s.type == 'MOVIE':
|
||||
s.use_deinterlace = True
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
|
@ -1,381 +0,0 @@
|
|||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
from bpy.props import *
|
||||
|
||||
|
||||
def write_svg(fw, mesh, image_width, image_height, face_iter):
|
||||
# for making an XML compatible string
|
||||
from xml.sax.saxutils import escape
|
||||
from os.path import basename
|
||||
|
||||
fw('<?xml version="1.0" standalone="no"?>\n')
|
||||
fw('<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" \n')
|
||||
fw(' "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n')
|
||||
fw('<svg width="%dpx" height="%dpx" viewBox="0px 0px %dpx %dpx"\n' % (image_width, image_height, image_width, image_height))
|
||||
fw(' xmlns="http://www.w3.org/2000/svg" version="1.1">\n')
|
||||
desc = "%r, %s, (Blender %s)" % (basename(bpy.data.filepath), mesh.name, bpy.app.version_string)
|
||||
fw('<desc>%s</desc>\n' % escape(desc))
|
||||
|
||||
# svg colors
|
||||
fill_settings = []
|
||||
fill_default = 'fill="grey"'
|
||||
for mat in mesh.materials if mesh.materials else [None]:
|
||||
if mat:
|
||||
fill_settings.append('fill="rgb(%d, %d, %d)"' % tuple(int(c * 255) for c in mat.diffuse_color))
|
||||
else:
|
||||
fill_settings.append(fill_default)
|
||||
|
||||
faces = mesh.faces
|
||||
for i, uvs in face_iter:
|
||||
try: # rare cases material index is invalid.
|
||||
fill = fill_settings[faces[i].material_index]
|
||||
except IndexError:
|
||||
fill = fill_default
|
||||
|
||||
fw('<polygon %s fill-opacity="0.5" stroke="black" stroke-width="1px" \n' % fill)
|
||||
fw(' points="')
|
||||
|
||||
for j, uv in enumerate(uvs):
|
||||
x, y = uv[0], 1.0 - uv[1]
|
||||
fw('%.3f,%.3f ' % (x * image_width, y * image_height))
|
||||
fw('" />\n')
|
||||
fw('\n')
|
||||
fw('</svg>\n')
|
||||
|
||||
|
||||
def write_eps(fw, mesh, image_width, image_height, face_iter):
|
||||
fw('%!PS-Adobe-3.0 EPSF-3.0\n')
|
||||
fw("%%%%Creator: Blender %s\n" % bpy.app.version_string)
|
||||
fw('%%Pages: 1\n')
|
||||
fw('%%Orientation: Portrait\n')
|
||||
fw("%%%%BoundingBox: 0 0 %d %d\n" % (image_width, image_height))
|
||||
fw("%%%%HiResBoundingBox: 0.0 0.0 %.4f %.4f\n" % (image_width, image_height))
|
||||
fw('%%EndComments\n')
|
||||
fw('%%Page: 1 1\n')
|
||||
fw('0 0 translate\n')
|
||||
fw('1.0 1.0 scale\n')
|
||||
fw('0 0 0 setrgbcolor\n')
|
||||
fw('[] 0 setdash\n')
|
||||
fw('1 setlinewidth\n')
|
||||
fw('1 setlinejoin\n')
|
||||
fw('1 setlinecap\n')
|
||||
fw('/DRAW {')
|
||||
# can remove from here to next comment to disable filling, aparently alpha is not supported
|
||||
fw('gsave\n')
|
||||
fw('0.7 setgray\n')
|
||||
fw('fill\n')
|
||||
fw('grestore\n')
|
||||
fw('0 setgray\n')
|
||||
# remove to here
|
||||
fw('stroke\n')
|
||||
fw('} def\n')
|
||||
fw('newpath\n')
|
||||
|
||||
firstline = True
|
||||
for i, uvs in face_iter:
|
||||
for j, uv in enumerate(uvs):
|
||||
x, y = uv[0], uv[1]
|
||||
if j == 0:
|
||||
if not firstline:
|
||||
fw('closepath\n')
|
||||
fw('DRAW\n')
|
||||
fw('newpath\n')
|
||||
firstline = False
|
||||
fw('%.5f %.5f moveto\n' % (x * image_width, y * image_height))
|
||||
else:
|
||||
fw('%.5f %.5f lineto\n' % (x * image_width, y * image_height))
|
||||
|
||||
fw('closepath\n')
|
||||
fw('DRAW\n')
|
||||
fw('showpage\n')
|
||||
fw('%%EOF\n')
|
||||
|
||||
|
||||
def write_png(fw, mesh_source, image_width, image_height, face_iter):
|
||||
filepath = fw.__self__.name
|
||||
fw.__self__.close()
|
||||
|
||||
material_solids = [bpy.data.materials.new("uv_temp_solid") for i in range(max(1, len(mesh_source.materials)))]
|
||||
material_wire = bpy.data.materials.new("uv_temp_wire")
|
||||
|
||||
scene = bpy.data.scenes.new("uv_temp")
|
||||
mesh = bpy.data.meshes.new("uv_temp")
|
||||
for mat_solid in material_solids:
|
||||
mesh.materials.append(mat_solid)
|
||||
|
||||
tot_verts = 0
|
||||
face_lens = []
|
||||
for f in mesh_source.faces:
|
||||
tot_verts += len(f.vertices)
|
||||
|
||||
faces_source = mesh_source.faces
|
||||
|
||||
# get unique UV's incase there are many overlapping which slow down filling.
|
||||
face_hash_3 = set()
|
||||
face_hash_4 = set()
|
||||
for i, uv in face_iter:
|
||||
material_index = faces_source[i].material_index
|
||||
if len(uv) == 3:
|
||||
face_hash_3.add((uv[0][0], uv[0][1], uv[1][0], uv[1][1], uv[2][0], uv[2][1], material_index))
|
||||
else:
|
||||
face_hash_4.add((uv[0][0], uv[0][1], uv[1][0], uv[1][1], uv[2][0], uv[2][1], uv[3][0], uv[3][1], material_index))
|
||||
|
||||
# now set the faces coords and locations
|
||||
# build mesh data
|
||||
mesh_new_vertices = []
|
||||
mesh_new_materials = []
|
||||
mesh_new_face_vertices = []
|
||||
|
||||
current_vert = 0
|
||||
|
||||
for face_data in face_hash_3:
|
||||
mesh_new_vertices.extend([face_data[0], face_data[1], 0.0, face_data[2], face_data[3], 0.0, face_data[4], face_data[5], 0.0])
|
||||
mesh_new_face_vertices.extend([current_vert, current_vert + 1, current_vert + 2, 0])
|
||||
mesh_new_materials.append(face_data[6])
|
||||
current_vert += 3
|
||||
for face_data in face_hash_4:
|
||||
mesh_new_vertices.extend([face_data[0], face_data[1], 0.0, face_data[2], face_data[3], 0.0, face_data[4], face_data[5], 0.0, face_data[6], face_data[7], 0.0])
|
||||
mesh_new_face_vertices.extend([current_vert, current_vert + 1, current_vert + 2, current_vert + 3])
|
||||
mesh_new_materials.append(face_data[8])
|
||||
current_vert += 4
|
||||
|
||||
mesh.vertices.add(len(mesh_new_vertices) // 3)
|
||||
mesh.faces.add(len(mesh_new_face_vertices) // 4)
|
||||
|
||||
mesh.vertices.foreach_set("co", mesh_new_vertices)
|
||||
mesh.faces.foreach_set("vertices_raw", mesh_new_face_vertices)
|
||||
mesh.faces.foreach_set("material_index", mesh_new_materials)
|
||||
|
||||
mesh.update(calc_edges=True)
|
||||
|
||||
obj_solid = bpy.data.objects.new("uv_temp_solid", mesh)
|
||||
obj_wire = bpy.data.objects.new("uv_temp_wire", mesh)
|
||||
base_solid = scene.objects.link(obj_solid)
|
||||
base_wire = scene.objects.link(obj_wire)
|
||||
base_solid.layers[0] = True
|
||||
base_wire.layers[0] = True
|
||||
|
||||
# place behind the wire
|
||||
obj_solid.location = 0, 0, -1
|
||||
|
||||
obj_wire.material_slots[0].link = 'OBJECT'
|
||||
obj_wire.material_slots[0].material = material_wire
|
||||
|
||||
# setup the camera
|
||||
cam = bpy.data.cameras.new("uv_temp")
|
||||
cam.type = 'ORTHO'
|
||||
cam.ortho_scale = 1.0
|
||||
obj_cam = bpy.data.objects.new("uv_temp_cam", cam)
|
||||
obj_cam.location = 0.5, 0.5, 1.0
|
||||
scene.objects.link(obj_cam)
|
||||
scene.camera = obj_cam
|
||||
|
||||
# setup materials
|
||||
for i, mat_solid in enumerate(material_solids):
|
||||
if mesh_source.materials and mesh_source.materials[i]:
|
||||
mat_solid.diffuse_color = mesh_source.materials[i].diffuse_color
|
||||
|
||||
mat_solid.use_shadeless = True
|
||||
mat_solid.use_transparency = True
|
||||
mat_solid.alpha = 0.25
|
||||
|
||||
material_wire.type = 'WIRE'
|
||||
material_wire.use_shadeless = True
|
||||
material_wire.diffuse_color = 0, 0, 0
|
||||
|
||||
# scene render settings
|
||||
scene.render.use_raytrace = False
|
||||
scene.render.alpha_mode = 'STRAIGHT'
|
||||
scene.render.color_mode = 'RGBA'
|
||||
|
||||
scene.render.resolution_x = image_width
|
||||
scene.render.resolution_y = image_height
|
||||
scene.render.resolution_percentage = 100
|
||||
|
||||
if image_width > image_height:
|
||||
scene.render.pixel_aspect_y = image_width / image_height
|
||||
elif image_width < image_height:
|
||||
scene.render.pixel_aspect_x = image_height / image_width
|
||||
|
||||
scene.frame_start = 1
|
||||
scene.frame_end = 1
|
||||
|
||||
scene.render.file_format = 'PNG'
|
||||
scene.render.filepath = filepath
|
||||
|
||||
data_context = {"blend_data": bpy.context.blend_data, "scene": scene}
|
||||
bpy.ops.render.render(data_context, write_still=True)
|
||||
|
||||
# cleanup
|
||||
bpy.data.scenes.remove(scene)
|
||||
bpy.data.objects.remove(obj_cam)
|
||||
bpy.data.objects.remove(obj_solid)
|
||||
bpy.data.objects.remove(obj_wire)
|
||||
|
||||
bpy.data.cameras.remove(cam)
|
||||
bpy.data.meshes.remove(mesh)
|
||||
|
||||
bpy.data.materials.remove(material_wire)
|
||||
for mat_solid in material_solids:
|
||||
bpy.data.materials.remove(mat_solid)
|
||||
|
||||
|
||||
class ExportUVLayout(bpy.types.Operator):
|
||||
"""Export UV layout to file"""
|
||||
|
||||
bl_idname = "uv.export_layout"
|
||||
bl_label = "Export UV Layout"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
filepath = StringProperty(name="File Path", description="File path used for exporting the SVG file", maxlen=1024, default="", subtype='FILE_PATH')
|
||||
check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
|
||||
export_all = BoolProperty(name="All UV's", description="Export all UVs in this mesh (not just the visible ones)", default=False)
|
||||
mode = EnumProperty(items=(
|
||||
('SVG', "Scalable Vector Graphic (.svg)", "Export the UV layout to a vector SVG file"),
|
||||
('EPS', "Encapsulate PostScript (.eps)", "Export the UV layout to a vector EPS file"),
|
||||
('PNG', "PNG Image (.png)", "Export the UV layout a bitmap image")),
|
||||
name="Format",
|
||||
description="File format to export the UV layout to",
|
||||
default='PNG')
|
||||
size = IntVectorProperty(size=2, default=(1024, 1024), min=8, max=32768, description="Dimensions of the exported file")
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
obj = context.active_object
|
||||
return (obj and obj.type == 'MESH' and obj.data.uv_textures)
|
||||
|
||||
def _space_image(self, context):
|
||||
space_data = context.space_data
|
||||
if isinstance(space_data, bpy.types.SpaceImageEditor):
|
||||
return space_data
|
||||
else:
|
||||
return None
|
||||
|
||||
def _image_size(self, context, default_width=1024, default_height=1024):
|
||||
# fallback if not in image context.
|
||||
image_width, image_height = default_width, default_height
|
||||
|
||||
space_data = self._space_image(context)
|
||||
if space_data:
|
||||
image = space_data.image
|
||||
if image:
|
||||
width, height = tuple(context.space_data.image.size)
|
||||
# incase no data is found.
|
||||
if width and height:
|
||||
image_width, image_height = width, height
|
||||
|
||||
return image_width, image_height
|
||||
|
||||
def _face_uv_iter(self, context):
|
||||
obj = context.active_object
|
||||
mesh = obj.data
|
||||
uv_layer = mesh.uv_textures.active.data
|
||||
uv_layer_len = len(uv_layer)
|
||||
|
||||
if not self.export_all:
|
||||
|
||||
local_image = Ellipsis
|
||||
|
||||
if context.tool_settings.show_uv_local_view:
|
||||
space_data = self._space_image(context)
|
||||
if space_data:
|
||||
local_image = space_data.image
|
||||
|
||||
faces = mesh.faces
|
||||
|
||||
for i in range(uv_layer_len):
|
||||
uv_elem = uv_layer[i]
|
||||
# context checks
|
||||
if faces[i].select and (local_image is Ellipsis or local_image == uv_elem.image):
|
||||
#~ uv = uv_elem.uv
|
||||
#~ if False not in uv_elem.select_uv[:len(uv)]:
|
||||
#~ yield (i, uv)
|
||||
|
||||
# just write what we see.
|
||||
yield (i, uv_layer[i].uv)
|
||||
else:
|
||||
# all, simple
|
||||
for i in range(uv_layer_len):
|
||||
yield (i, uv_layer[i].uv)
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
obj = context.active_object
|
||||
is_editmode = (obj.mode == 'EDIT')
|
||||
if is_editmode:
|
||||
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
|
||||
|
||||
mesh = obj.data
|
||||
|
||||
mode = self.mode
|
||||
|
||||
filepath = self.filepath
|
||||
filepath = bpy.path.ensure_ext(filepath, "." + mode.lower())
|
||||
file = open(filepath, "w")
|
||||
fw = file.write
|
||||
|
||||
if mode == 'SVG':
|
||||
func = write_svg
|
||||
elif mode == 'EPS':
|
||||
func = write_eps
|
||||
elif mode == 'PNG':
|
||||
func = write_png
|
||||
|
||||
func(fw, mesh, self.size[0], self.size[1], self._face_uv_iter(context))
|
||||
|
||||
if is_editmode:
|
||||
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
def check(self, context):
|
||||
filepath = bpy.path.ensure_ext(self.filepath, "." + self.mode.lower())
|
||||
if filepath != self.filepath:
|
||||
self.filepath = filepath
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def invoke(self, context, event):
|
||||
import os
|
||||
self.size = self._image_size(context)
|
||||
self.filepath = os.path.splitext(bpy.data.filepath)[0]
|
||||
wm = context.window_manager
|
||||
wm.fileselect_add(self)
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
|
||||
def menu_func(self, context):
|
||||
self.layout.operator(ExportUVLayout.bl_idname)
|
||||
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
bpy.types.IMAGE_MT_uvs.append(menu_func)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
bpy.types.IMAGE_MT_uvs.remove(menu_func)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
|
@ -1,264 +0,0 @@
|
|||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
#for full docs see...
|
||||
# http://mediawiki.blender.org/index.php/Scripts/Manual/UV_Calculate/Follow_active_quads
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def extend(obj, operator, EXTEND_MODE):
|
||||
me = obj.data
|
||||
me_verts = me.vertices
|
||||
# script will fail without UVs
|
||||
if not me.uv_textures:
|
||||
me.uv_textures.new()
|
||||
|
||||
# Toggle Edit mode
|
||||
is_editmode = (obj.mode == 'EDIT')
|
||||
if is_editmode:
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
|
||||
#t = sys.time()
|
||||
edge_average_lengths = {}
|
||||
|
||||
OTHER_INDEX = 2, 3, 0, 1
|
||||
FAST_INDICIES = 0, 2, 1, 3 # order is faster
|
||||
|
||||
def extend_uvs(face_source, face_target, edge_key):
|
||||
'''
|
||||
Takes 2 faces,
|
||||
Projects its extends its UV coords onto the face next to it.
|
||||
Both faces must share an edge
|
||||
'''
|
||||
|
||||
def face_edge_vs(vi):
|
||||
# assume a quad
|
||||
return [(vi[0], vi[1]), (vi[1], vi[2]), (vi[2], vi[3]), (vi[3], vi[0])]
|
||||
|
||||
vidx_source = face_source.vertices
|
||||
vidx_target = face_target.vertices
|
||||
|
||||
faceUVsource = me.uv_textures.active.data[face_source.index]
|
||||
uvs_source = [faceUVsource.uv1, faceUVsource.uv2, faceUVsource.uv3, faceUVsource.uv4]
|
||||
|
||||
faceUVtarget = me.uv_textures.active.data[face_target.index]
|
||||
uvs_target = [faceUVtarget.uv1, faceUVtarget.uv2, faceUVtarget.uv3, faceUVtarget.uv4]
|
||||
|
||||
# vertex index is the key, uv is the value
|
||||
|
||||
uvs_vhash_source = {vindex: uvs_source[i] for i, vindex in enumerate(vidx_source)}
|
||||
|
||||
uvs_vhash_target = {vindex: uvs_target[i] for i, vindex in enumerate(vidx_target)}
|
||||
|
||||
edge_idxs_source = face_edge_vs(vidx_source)
|
||||
edge_idxs_target = face_edge_vs(vidx_target)
|
||||
|
||||
source_matching_edge = -1
|
||||
target_matching_edge = -1
|
||||
|
||||
edge_key_swap = edge_key[1], edge_key[0]
|
||||
|
||||
try:
|
||||
source_matching_edge = edge_idxs_source.index(edge_key)
|
||||
except:
|
||||
source_matching_edge = edge_idxs_source.index(edge_key_swap)
|
||||
try:
|
||||
target_matching_edge = edge_idxs_target.index(edge_key)
|
||||
except:
|
||||
target_matching_edge = edge_idxs_target.index(edge_key_swap)
|
||||
|
||||
edgepair_inner_source = edge_idxs_source[source_matching_edge]
|
||||
edgepair_inner_target = edge_idxs_target[target_matching_edge]
|
||||
edgepair_outer_source = edge_idxs_source[OTHER_INDEX[source_matching_edge]]
|
||||
edgepair_outer_target = edge_idxs_target[OTHER_INDEX[target_matching_edge]]
|
||||
|
||||
if edge_idxs_source[source_matching_edge] == edge_idxs_target[target_matching_edge]:
|
||||
iA = 0 # Flipped, most common
|
||||
iB = 1
|
||||
else: # The normals of these faces must be different
|
||||
iA = 1
|
||||
iB = 0
|
||||
|
||||
# Set the target UV's touching source face, no tricky calc needed,
|
||||
uvs_vhash_target[edgepair_inner_target[0]][:] = uvs_vhash_source[edgepair_inner_source[iA]]
|
||||
uvs_vhash_target[edgepair_inner_target[1]][:] = uvs_vhash_source[edgepair_inner_source[iB]]
|
||||
|
||||
# Set the 2 UV's on the target face that are not touching
|
||||
# for this we need to do basic expaning on the source faces UV's
|
||||
if EXTEND_MODE == 'LENGTH':
|
||||
|
||||
try: # divide by zero is possible
|
||||
'''
|
||||
measure the length of each face from the middle of each edge to the opposite
|
||||
allong the axis we are copying, use this
|
||||
'''
|
||||
i1a = edgepair_outer_target[iB]
|
||||
i2a = edgepair_inner_target[iA]
|
||||
if i1a > i2a:
|
||||
i1a, i2a = i2a, i1a
|
||||
|
||||
i1b = edgepair_outer_source[iB]
|
||||
i2b = edgepair_inner_source[iA]
|
||||
if i1b > i2b:
|
||||
i1b, i2b = i2b, i1b
|
||||
# print edge_average_lengths
|
||||
factor = edge_average_lengths[i1a, i2a][0] / edge_average_lengths[i1b, i2b][0]
|
||||
except:
|
||||
# Div By Zero?
|
||||
factor = 1.0
|
||||
|
||||
uvs_vhash_target[edgepair_outer_target[iB]][:] = uvs_vhash_source[edgepair_inner_source[0]] + factor * (uvs_vhash_source[edgepair_inner_source[0]] - uvs_vhash_source[edgepair_outer_source[1]])
|
||||
uvs_vhash_target[edgepair_outer_target[iA]][:] = uvs_vhash_source[edgepair_inner_source[1]] + factor * (uvs_vhash_source[edgepair_inner_source[1]] - uvs_vhash_source[edgepair_outer_source[0]])
|
||||
|
||||
else:
|
||||
# same as above but with no factors
|
||||
uvs_vhash_target[edgepair_outer_target[iB]][:] = uvs_vhash_source[edgepair_inner_source[0]] + (uvs_vhash_source[edgepair_inner_source[0]] - uvs_vhash_source[edgepair_outer_source[1]])
|
||||
uvs_vhash_target[edgepair_outer_target[iA]][:] = uvs_vhash_source[edgepair_inner_source[1]] + (uvs_vhash_source[edgepair_inner_source[1]] - uvs_vhash_source[edgepair_outer_source[0]])
|
||||
|
||||
if not me.uv_textures:
|
||||
me.uv_textures.new()
|
||||
|
||||
face_act = me.faces.active
|
||||
if face_act == -1:
|
||||
operator.report({'ERROR'}, "No active face.")
|
||||
return
|
||||
|
||||
face_sel = [f for f in me.faces if len(f.vertices) == 4 and f.select]
|
||||
|
||||
face_act_local_index = -1
|
||||
for i, f in enumerate(face_sel):
|
||||
if f.index == face_act:
|
||||
face_act_local_index = i
|
||||
break
|
||||
|
||||
if face_act_local_index == -1:
|
||||
operator.report({'ERROR'}, "Active face not selected.")
|
||||
return
|
||||
|
||||
# Modes
|
||||
# 0 unsearched
|
||||
# 1:mapped, use search from this face. - removed!!
|
||||
# 2:all siblings have been searched. dont search again.
|
||||
face_modes = [0] * len(face_sel)
|
||||
face_modes[face_act_local_index] = 1 # extend UV's from this face.
|
||||
|
||||
# Edge connectivty
|
||||
edge_faces = {}
|
||||
for i, f in enumerate(face_sel):
|
||||
for edkey in f.edge_keys:
|
||||
try:
|
||||
edge_faces[edkey].append(i)
|
||||
except:
|
||||
edge_faces[edkey] = [i]
|
||||
|
||||
if EXTEND_MODE == 'LENGTH':
|
||||
edge_loops = me.edge_loops_from_faces(face_sel, [ed.key for ed in me.edges if ed.use_seam])
|
||||
me_verts = me.vertices
|
||||
for loop in edge_loops:
|
||||
looplen = [0.0]
|
||||
for ed in loop:
|
||||
edge_average_lengths[ed] = looplen
|
||||
looplen[0] += (me_verts[ed[0]].co - me_verts[ed[1]].co).length
|
||||
looplen[0] = looplen[0] / len(loop)
|
||||
|
||||
# remove seams, so we dont map accross seams.
|
||||
for ed in me.edges:
|
||||
if ed.use_seam:
|
||||
# remove the edge pair if we can
|
||||
try:
|
||||
del edge_faces[ed.key]
|
||||
except:
|
||||
pass
|
||||
# Done finding seams
|
||||
|
||||
# face connectivity - faces around each face
|
||||
# only store a list of indices for each face.
|
||||
face_faces = [[] for i in range(len(face_sel))]
|
||||
|
||||
for edge_key, faces in edge_faces.items():
|
||||
if len(faces) == 2: # Only do edges with 2 face users for now
|
||||
face_faces[faces[0]].append((faces[1], edge_key))
|
||||
face_faces[faces[1]].append((faces[0], edge_key))
|
||||
|
||||
# Now we know what face is connected to what other face, map them by connectivity
|
||||
ok = True
|
||||
while ok:
|
||||
ok = False
|
||||
for i in range(len(face_sel)):
|
||||
if face_modes[i] == 1: # searchable
|
||||
for f_sibling, edge_key in face_faces[i]:
|
||||
if face_modes[f_sibling] == 0:
|
||||
face_modes[f_sibling] = 1 # mapped and search from.
|
||||
extend_uvs(face_sel[i], face_sel[f_sibling], edge_key)
|
||||
face_modes[i] = 1 # we can map from this one now.
|
||||
ok = True # keep searching
|
||||
|
||||
face_modes[i] = 2 # dont search again
|
||||
|
||||
if is_editmode:
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
else:
|
||||
me.update_tag()
|
||||
|
||||
|
||||
def main(context, operator):
|
||||
obj = context.active_object
|
||||
|
||||
extend(obj, operator, operator.properties.mode)
|
||||
|
||||
|
||||
class FollowActiveQuads(bpy.types.Operator):
|
||||
'''Follow UVs from active quads along continuous face loops'''
|
||||
bl_idname = "uv.follow_active_quads"
|
||||
bl_label = "Follow Active Quads"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
mode = bpy.props.EnumProperty(items=(("EVEN", "Even", "Space all UVs evently"), ("LENGTH", "Length", "Average space UVs edge length of each loop")),
|
||||
name="Edge Length Mode",
|
||||
description="Method to space UV edge loops",
|
||||
default="LENGTH")
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
obj = context.active_object
|
||||
return (obj is not None and obj.type == 'MESH')
|
||||
|
||||
def execute(self, context):
|
||||
main(context, self)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
# Add to a menu
|
||||
menu_func = (lambda self, context: self.layout.operator(FollowActiveQuads.bl_idname))
|
||||
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
bpy.types.VIEW3D_MT_uv_map.append(menu_func)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
bpy.types.VIEW3D_MT_uv_map.remove(menu_func)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
File diff suppressed because it is too large
Load Diff
|
@ -1,190 +0,0 @@
|
|||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# Script copyright (C) Campbell J Barton
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ***** END GPL LICENCE BLOCK *****
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
# History
|
||||
#
|
||||
# Originally written by Campbell Barton aka ideasman42
|
||||
#
|
||||
# 2009-11-01: * 2.5 port by Keith "Wahooney" Boshoff
|
||||
# * Replaced old method with my own, speed is similar (about 0.001 sec on Suzanne)
|
||||
# but results are far more accurate
|
||||
#
|
||||
|
||||
import bpy
|
||||
import math
|
||||
import time
|
||||
|
||||
from mathutils import Vector
|
||||
from bpy.props import *
|
||||
|
||||
|
||||
def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean, dirt_only):
|
||||
## Window.WaitCursor(1)
|
||||
|
||||
#BPyMesh.meshCalcNormals(me)
|
||||
|
||||
vert_tone = [0.0] * len(me.vertices)
|
||||
|
||||
min_tone = 180.0
|
||||
max_tone = 0.0
|
||||
|
||||
# create lookup table for each vertex's connected vertices (via edges)
|
||||
con = []
|
||||
|
||||
con = [[] for i in range(len(me.vertices))]
|
||||
|
||||
# add connected verts
|
||||
for e in me.edges:
|
||||
con[e.vertices[0]].append(e.vertices[1])
|
||||
con[e.vertices[1]].append(e.vertices[0])
|
||||
|
||||
for i, v in enumerate(me.vertices):
|
||||
vec = Vector()
|
||||
no = v.normal
|
||||
co = v.co
|
||||
|
||||
# get the direction of the vectors between the vertex and it's connected vertices
|
||||
for c in con[i]:
|
||||
vec += (me.vertices[c].co - co).normalized()
|
||||
|
||||
# normalize the vector by dividing by the number of connected verts
|
||||
tot_con = len(con[i])
|
||||
|
||||
if tot_con == 0:
|
||||
continue
|
||||
|
||||
vec /= tot_con
|
||||
|
||||
# angle is the acos of the dot product between vert and connected verts normals
|
||||
ang = math.acos(no.dot(vec))
|
||||
|
||||
# enforce min/max
|
||||
ang = max(clamp_dirt, ang)
|
||||
|
||||
if not dirt_only:
|
||||
ang = min(clamp_clean, ang)
|
||||
|
||||
vert_tone[i] = ang
|
||||
|
||||
# blur tones
|
||||
for i in range(blur_iterations):
|
||||
# backup the original tones
|
||||
orig_vert_tone = list(vert_tone)
|
||||
|
||||
# use connected verts look up for blurring
|
||||
for j, c in enumerate(con):
|
||||
for v in c:
|
||||
vert_tone[j] += blur_strength * orig_vert_tone[v]
|
||||
|
||||
vert_tone[j] /= len(c) * blur_strength + 1
|
||||
|
||||
min_tone = min(vert_tone)
|
||||
max_tone = max(vert_tone)
|
||||
|
||||
# debug information
|
||||
# print(min_tone * 2 * math.pi)
|
||||
# print(max_tone * 2 * math.pi)
|
||||
# print(clamp_clean)
|
||||
# print(clamp_dirt)
|
||||
|
||||
tone_range = max_tone - min_tone
|
||||
|
||||
if not tone_range:
|
||||
return
|
||||
|
||||
active_col_layer = None
|
||||
|
||||
if len(me.vertex_colors):
|
||||
for lay in me.vertex_colors:
|
||||
if lay.active:
|
||||
active_col_layer = lay.data
|
||||
else:
|
||||
bpy.ops.mesh.vertex_color_add()
|
||||
me.vertex_colors[0].active = True
|
||||
active_col_layer = me.vertex_colors[0].data
|
||||
|
||||
if not active_col_layer:
|
||||
return('CANCELLED', )
|
||||
|
||||
for i, f in enumerate(me.faces):
|
||||
if not me.use_paint_mask or f.select:
|
||||
|
||||
f_col = active_col_layer[i]
|
||||
|
||||
f_col = [f_col.color1, f_col.color2, f_col.color3, f_col.color4]
|
||||
|
||||
for j, v in enumerate(f.vertices):
|
||||
col = f_col[j]
|
||||
tone = vert_tone[me.vertices[v].index]
|
||||
tone = (tone - min_tone) / tone_range
|
||||
|
||||
if dirt_only:
|
||||
tone = min(tone, 0.5)
|
||||
tone *= 2
|
||||
|
||||
col[0] = tone * col[0]
|
||||
col[1] = tone * col[1]
|
||||
col[2] = tone * col[2]
|
||||
|
||||
## Window.WaitCursor(0)
|
||||
|
||||
|
||||
class VertexPaintDirt(bpy.types.Operator):
|
||||
|
||||
bl_idname = "paint.vertex_color_dirt"
|
||||
bl_label = "Dirty Vertex Colors"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
blur_strength = FloatProperty(name="Blur Strength", description="Blur strength per iteration", default=1.0, min=0.01, max=1.0)
|
||||
blur_iterations = IntProperty(name="Blur Iterations", description="Number times to blur the colors. (higher blurs more)", default=1, min=0, max=40)
|
||||
clean_angle = FloatProperty(name="Highlight Angle", description="Less then 90 limits the angle used in the tonal range", default=180.0, min=0.0, max=180.0)
|
||||
dirt_angle = FloatProperty(name="Dirt Angle", description="Less then 90 limits the angle used in the tonal range", default=0.0, min=0.0, max=180.0)
|
||||
dirt_only = BoolProperty(name="Dirt Only", description="Dont calculate cleans for convex areas", default=False)
|
||||
|
||||
def execute(self, context):
|
||||
obj = context.object
|
||||
|
||||
if not obj or obj.type != 'MESH':
|
||||
print('Error, no active mesh object, aborting')
|
||||
return('CANCELLED',)
|
||||
|
||||
mesh = obj.data
|
||||
|
||||
t = time.time()
|
||||
|
||||
applyVertexDirt(mesh, self.blur_iterations, self.blur_strength, math.radians(self.dirt_angle), math.radians(self.clean_angle), self.dirt_only)
|
||||
|
||||
print('Dirt calculated in %.6f' % (time.time() - t))
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
|
@ -1,859 +0,0 @@
|
|||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
|
||||
from bpy.props import *
|
||||
from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear
|
||||
|
||||
|
||||
class MESH_OT_delete_edgeloop(bpy.types.Operator):
|
||||
'''Delete an edge loop by merging the faces on each side to a single face loop'''
|
||||
bl_idname = "mesh.delete_edgeloop"
|
||||
bl_label = "Delete Edge Loop"
|
||||
|
||||
def execute(self, context):
|
||||
if 'FINISHED' in bpy.ops.transform.edge_slide(value=1.0):
|
||||
bpy.ops.mesh.select_more()
|
||||
bpy.ops.mesh.remove_doubles()
|
||||
return {'FINISHED'}
|
||||
|
||||
return {'CANCELLED'}
|
||||
|
||||
rna_path_prop = StringProperty(name="Context Attributes",
|
||||
description="rna context string", maxlen=1024, default="")
|
||||
|
||||
rna_reverse_prop = BoolProperty(name="Reverse",
|
||||
description="Cycle backwards", default=False)
|
||||
|
||||
rna_relative_prop = BoolProperty(name="Relative",
|
||||
description="Apply relative to the current value (delta)",
|
||||
default=False)
|
||||
|
||||
|
||||
def context_path_validate(context, data_path):
|
||||
import sys
|
||||
try:
|
||||
value = eval("context.%s" % data_path) if data_path else Ellipsis
|
||||
except AttributeError:
|
||||
if "'NoneType'" in str(sys.exc_info()[1]):
|
||||
# One of the items in the rna path is None, just ignore this
|
||||
value = Ellipsis
|
||||
else:
|
||||
# We have a real error in the rna path, dont ignore that
|
||||
raise
|
||||
|
||||
return value
|
||||
|
||||
|
||||
def execute_context_assign(self, context):
|
||||
if context_path_validate(context, self.data_path) is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
if getattr(self, "relative", False):
|
||||
exec("context.%s+=self.value" % self.data_path)
|
||||
else:
|
||||
exec("context.%s=self.value" % self.data_path)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class BRUSH_OT_set_active_number(bpy.types.Operator):
|
||||
'''Set active sculpt/paint brush from it's number'''
|
||||
bl_idname = "brush.set_active_number"
|
||||
bl_label = "Set Brush Number"
|
||||
|
||||
mode = StringProperty(name="mode",
|
||||
description="Paint mode to set brush for", maxlen=1024)
|
||||
number = IntProperty(name="number",
|
||||
description="Brush number")
|
||||
|
||||
_attr_dict = {"sculpt": "use_paint_sculpt",
|
||||
"vertex_paint": "use_paint_vertex",
|
||||
"weight_paint": "use_paint_weight",
|
||||
"image_paint": "use_paint_texture"}
|
||||
|
||||
def execute(self, context):
|
||||
attr = self._attr_dict.get(self.mode)
|
||||
if attr is None:
|
||||
return {'CANCELLED'}
|
||||
|
||||
for i, brush in enumerate((cur for cur in bpy.data.brushes if getattr(cur, attr))):
|
||||
if i == self.number:
|
||||
getattr(context.tool_settings, self.mode).brush = brush
|
||||
return {'FINISHED'}
|
||||
|
||||
return {'CANCELLED'}
|
||||
|
||||
|
||||
class WM_OT_context_set_boolean(bpy.types.Operator):
|
||||
'''Set a context value.'''
|
||||
bl_idname = "wm.context_set_boolean"
|
||||
bl_label = "Context Set Boolean"
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = BoolProperty(name="Value",
|
||||
description="Assignment value", default=True)
|
||||
|
||||
execute = execute_context_assign
|
||||
|
||||
|
||||
class WM_OT_context_set_int(bpy.types.Operator): # same as enum
|
||||
'''Set a context value.'''
|
||||
bl_idname = "wm.context_set_int"
|
||||
bl_label = "Context Set"
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = IntProperty(name="Value", description="Assign value", default=0)
|
||||
relative = rna_relative_prop
|
||||
|
||||
execute = execute_context_assign
|
||||
|
||||
|
||||
class WM_OT_context_scale_int(bpy.types.Operator):
|
||||
'''Scale an int context value.'''
|
||||
bl_idname = "wm.context_scale_int"
|
||||
bl_label = "Context Set"
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = FloatProperty(name="Value", description="Assign value", default=1.0)
|
||||
always_step = BoolProperty(name="Always Step",
|
||||
description="Always adjust the value by a minimum of 1 when 'value' is not 1.0.",
|
||||
default=True)
|
||||
|
||||
def execute(self, context):
|
||||
if context_path_validate(context, self.data_path) is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
value = self.value
|
||||
data_path = self.data_path
|
||||
|
||||
if value == 1.0: # nothing to do
|
||||
return {'CANCELLED'}
|
||||
|
||||
if getattr(self, "always_step", False):
|
||||
if value > 1.0:
|
||||
add = "1"
|
||||
func = "max"
|
||||
else:
|
||||
add = "-1"
|
||||
func = "min"
|
||||
exec("context.%s = %s(round(context.%s * value), context.%s + %s)" % (data_path, func, data_path, data_path, add))
|
||||
else:
|
||||
exec("context.%s *= value" % self.data_path)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class WM_OT_context_set_float(bpy.types.Operator): # same as enum
|
||||
'''Set a context value.'''
|
||||
bl_idname = "wm.context_set_float"
|
||||
bl_label = "Context Set Float"
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = FloatProperty(name="Value",
|
||||
description="Assignment value", default=0.0)
|
||||
relative = rna_relative_prop
|
||||
|
||||
execute = execute_context_assign
|
||||
|
||||
|
||||
class WM_OT_context_set_string(bpy.types.Operator): # same as enum
|
||||
'''Set a context value.'''
|
||||
bl_idname = "wm.context_set_string"
|
||||
bl_label = "Context Set String"
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = StringProperty(name="Value",
|
||||
description="Assign value", maxlen=1024, default="")
|
||||
|
||||
execute = execute_context_assign
|
||||
|
||||
|
||||
class WM_OT_context_set_enum(bpy.types.Operator):
|
||||
'''Set a context value.'''
|
||||
bl_idname = "wm.context_set_enum"
|
||||
bl_label = "Context Set Enum"
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = StringProperty(name="Value",
|
||||
description="Assignment value (as a string)",
|
||||
maxlen=1024, default="")
|
||||
|
||||
execute = execute_context_assign
|
||||
|
||||
|
||||
class WM_OT_context_set_value(bpy.types.Operator):
|
||||
'''Set a context value.'''
|
||||
bl_idname = "wm.context_set_value"
|
||||
bl_label = "Context Set Value"
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = StringProperty(name="Value",
|
||||
description="Assignment value (as a string)",
|
||||
maxlen=1024, default="")
|
||||
|
||||
def execute(self, context):
|
||||
if context_path_validate(context, self.data_path) is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
exec("context.%s=%s" % (self.data_path, self.value))
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class WM_OT_context_toggle(bpy.types.Operator):
|
||||
'''Toggle a context value.'''
|
||||
bl_idname = "wm.context_toggle"
|
||||
bl_label = "Context Toggle"
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
if context_path_validate(context, self.data_path) is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
exec("context.%s=not (context.%s)" %
|
||||
(self.data_path, self.data_path))
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class WM_OT_context_toggle_enum(bpy.types.Operator):
|
||||
'''Toggle a context value.'''
|
||||
bl_idname = "wm.context_toggle_enum"
|
||||
bl_label = "Context Toggle Values"
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value_1 = StringProperty(name="Value", \
|
||||
description="Toggle enum", maxlen=1024, default="")
|
||||
|
||||
value_2 = StringProperty(name="Value", \
|
||||
description="Toggle enum", maxlen=1024, default="")
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
if context_path_validate(context, self.data_path) is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
exec("context.%s = ['%s', '%s'][context.%s!='%s']" % \
|
||||
(self.data_path, self.value_1,\
|
||||
self.value_2, self.data_path,
|
||||
self.value_2))
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class WM_OT_context_cycle_int(bpy.types.Operator):
|
||||
'''Set a context value. Useful for cycling active material, '''
|
||||
'''vertex keys, groups' etc.'''
|
||||
bl_idname = "wm.context_cycle_int"
|
||||
bl_label = "Context Int Cycle"
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
reverse = rna_reverse_prop
|
||||
|
||||
def execute(self, context):
|
||||
data_path = self.data_path
|
||||
value = context_path_validate(context, data_path)
|
||||
if value is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
if self.reverse:
|
||||
value -= 1
|
||||
else:
|
||||
value += 1
|
||||
|
||||
exec("context.%s=value" % data_path)
|
||||
|
||||
if value != eval("context.%s" % data_path):
|
||||
# relies on rna clamping int's out of the range
|
||||
if self.reverse:
|
||||
value = (1 << 31) - 1
|
||||
else:
|
||||
value = -1 << 31
|
||||
|
||||
exec("context.%s=value" % data_path)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class WM_OT_context_cycle_enum(bpy.types.Operator):
|
||||
'''Toggle a context value.'''
|
||||
bl_idname = "wm.context_cycle_enum"
|
||||
bl_label = "Context Enum Cycle"
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
reverse = rna_reverse_prop
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
value = context_path_validate(context, self.data_path)
|
||||
if value is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
orig_value = value
|
||||
|
||||
# Have to get rna enum values
|
||||
rna_struct_str, rna_prop_str = self.data_path.rsplit('.', 1)
|
||||
i = rna_prop_str.find('[')
|
||||
|
||||
# just incse we get "context.foo.bar[0]"
|
||||
if i != -1:
|
||||
rna_prop_str = rna_prop_str[0:i]
|
||||
|
||||
rna_struct = eval("context.%s.rna_type" % rna_struct_str)
|
||||
|
||||
rna_prop = rna_struct.properties[rna_prop_str]
|
||||
|
||||
if type(rna_prop) != bpy.types.EnumProperty:
|
||||
raise Exception("expected an enum property")
|
||||
|
||||
enums = rna_struct.properties[rna_prop_str].items.keys()
|
||||
orig_index = enums.index(orig_value)
|
||||
|
||||
# Have the info we need, advance to the next item
|
||||
if self.reverse:
|
||||
if orig_index == 0:
|
||||
advance_enum = enums[-1]
|
||||
else:
|
||||
advance_enum = enums[orig_index - 1]
|
||||
else:
|
||||
if orig_index == len(enums) - 1:
|
||||
advance_enum = enums[0]
|
||||
else:
|
||||
advance_enum = enums[orig_index + 1]
|
||||
|
||||
# set the new value
|
||||
exec("context.%s=advance_enum" % self.data_path)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class WM_OT_context_cycle_array(bpy.types.Operator):
|
||||
'''Set a context array value.
|
||||
Useful for cycling the active mesh edit mode.'''
|
||||
bl_idname = "wm.context_cycle_array"
|
||||
bl_label = "Context Array Cycle"
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
reverse = rna_reverse_prop
|
||||
|
||||
def execute(self, context):
|
||||
data_path = self.data_path
|
||||
value = context_path_validate(context, data_path)
|
||||
if value is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
def cycle(array):
|
||||
if self.reverse:
|
||||
array.insert(0, array.pop())
|
||||
else:
|
||||
array.append(array.pop(0))
|
||||
return array
|
||||
|
||||
exec("context.%s=cycle(context.%s[:])" % (data_path, data_path))
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class WM_MT_context_menu_enum(bpy.types.Menu):
|
||||
bl_label = ""
|
||||
data_path = "" # BAD DESIGN, set from operator below.
|
||||
|
||||
def draw(self, context):
|
||||
data_path = self.data_path
|
||||
value = context_path_validate(bpy.context, data_path)
|
||||
if value is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
base_path, prop_string = data_path.rsplit(".", 1)
|
||||
value_base = context_path_validate(context, base_path)
|
||||
|
||||
values = [(i.name, i.identifier) for i in value_base.bl_rna.properties[prop_string].items]
|
||||
|
||||
for name, identifier in values:
|
||||
prop = self.layout.operator("wm.context_set_enum", text=name)
|
||||
prop.data_path = data_path
|
||||
prop.value = identifier
|
||||
|
||||
|
||||
class WM_OT_context_menu_enum(bpy.types.Operator):
|
||||
bl_idname = "wm.context_menu_enum"
|
||||
bl_label = "Context Enum Menu"
|
||||
bl_options = {'UNDO'}
|
||||
data_path = rna_path_prop
|
||||
|
||||
def execute(self, context):
|
||||
data_path = self.data_path
|
||||
WM_MT_context_menu_enum.data_path = data_path
|
||||
bpy.ops.wm.call_menu(name="WM_MT_context_menu_enum")
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
|
||||
class WM_OT_context_set_id(bpy.types.Operator):
|
||||
'''Toggle a context value.'''
|
||||
bl_idname = "wm.context_set_id"
|
||||
bl_label = "Set Library ID"
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = StringProperty(name="Value",
|
||||
description="Assign value", maxlen=1024, default="")
|
||||
|
||||
def execute(self, context):
|
||||
value = self.value
|
||||
data_path = self.data_path
|
||||
|
||||
# match the pointer type from the target property to bpy.data.*
|
||||
# so we lookup the correct list.
|
||||
data_path_base, data_path_prop = data_path.rsplit(".", 1)
|
||||
data_prop_rna = eval("context.%s" % data_path_base).rna_type.properties[data_path_prop]
|
||||
data_prop_rna_type = data_prop_rna.fixed_type
|
||||
|
||||
id_iter = None
|
||||
|
||||
for prop in bpy.data.rna_type.properties:
|
||||
if prop.rna_type.identifier == "CollectionProperty":
|
||||
if prop.fixed_type == data_prop_rna_type:
|
||||
id_iter = prop.identifier
|
||||
break
|
||||
|
||||
if id_iter:
|
||||
value_id = getattr(bpy.data, id_iter).get(value)
|
||||
exec("context.%s=value_id" % data_path)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
doc_id = StringProperty(name="Doc ID",
|
||||
description="", maxlen=1024, default="", options={'HIDDEN'})
|
||||
|
||||
doc_new = StringProperty(name="Edit Description",
|
||||
description="", maxlen=1024, default="")
|
||||
|
||||
|
||||
class WM_OT_context_modal_mouse(bpy.types.Operator):
|
||||
'''Adjust arbitrary values with mouse input'''
|
||||
bl_idname = "wm.context_modal_mouse"
|
||||
bl_label = "Context Modal Mouse"
|
||||
|
||||
data_path_iter = StringProperty(description="The data path relative to the context, must point to an iterable.")
|
||||
data_path_item = StringProperty(description="The data path from each iterable to the value (int or float)")
|
||||
input_scale = FloatProperty(default=0.01, description="Scale the mouse movement by this value before applying the delta")
|
||||
invert = BoolProperty(default=False, description="Invert the mouse input")
|
||||
initial_x = IntProperty(options={'HIDDEN'})
|
||||
|
||||
def _values_store(self, context):
|
||||
data_path_iter = self.data_path_iter
|
||||
data_path_item = self.data_path_item
|
||||
|
||||
self._values = values = {}
|
||||
|
||||
for item in getattr(context, data_path_iter):
|
||||
try:
|
||||
value_orig = eval("item." + data_path_item)
|
||||
except:
|
||||
continue
|
||||
|
||||
# check this can be set, maybe this is library data.
|
||||
try:
|
||||
exec("item.%s = %s" % (data_path_item, value_orig))
|
||||
except:
|
||||
continue
|
||||
|
||||
values[item] = value_orig
|
||||
|
||||
def _values_delta(self, delta):
|
||||
delta *= self.input_scale
|
||||
if self.invert:
|
||||
delta = - delta
|
||||
|
||||
data_path_item = self.data_path_item
|
||||
for item, value_orig in self._values.items():
|
||||
if type(value_orig) == int:
|
||||
exec("item.%s = int(%d)" % (data_path_item, round(value_orig + delta)))
|
||||
else:
|
||||
exec("item.%s = %f" % (data_path_item, value_orig + delta))
|
||||
|
||||
def _values_restore(self):
|
||||
data_path_item = self.data_path_item
|
||||
for item, value_orig in self._values.items():
|
||||
exec("item.%s = %s" % (data_path_item, value_orig))
|
||||
|
||||
self._values.clear()
|
||||
|
||||
def _values_clear(self):
|
||||
self._values.clear()
|
||||
|
||||
def modal(self, context, event):
|
||||
event_type = event.type
|
||||
|
||||
if event_type == 'MOUSEMOVE':
|
||||
delta = event.mouse_x - self.initial_x
|
||||
self._values_delta(delta)
|
||||
|
||||
elif 'LEFTMOUSE' == event_type:
|
||||
self._values_clear()
|
||||
return {'FINISHED'}
|
||||
|
||||
elif event_type in ('RIGHTMOUSE', 'ESC'):
|
||||
self._values_restore()
|
||||
return {'FINISHED'}
|
||||
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
self._values_store(context)
|
||||
|
||||
if not self._values:
|
||||
self.report({'WARNING'}, "Nothing to operate on: %s[ ].%s" %
|
||||
(self.data_path_iter, self.data_path_item))
|
||||
|
||||
return {'CANCELLED'}
|
||||
else:
|
||||
self.initial_x = event.mouse_x
|
||||
|
||||
context.window_manager.modal_handler_add(self)
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
|
||||
class WM_OT_url_open(bpy.types.Operator):
|
||||
"Open a website in the Webbrowser"
|
||||
bl_idname = "wm.url_open"
|
||||
bl_label = ""
|
||||
|
||||
url = StringProperty(name="URL", description="URL to open")
|
||||
|
||||
def execute(self, context):
|
||||
import webbrowser
|
||||
webbrowser.open(self.url)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class WM_OT_path_open(bpy.types.Operator):
|
||||
"Open a path in a file browser"
|
||||
bl_idname = "wm.path_open"
|
||||
bl_label = ""
|
||||
|
||||
filepath = StringProperty(name="File Path", maxlen=1024, subtype='FILE_PATH')
|
||||
|
||||
def execute(self, context):
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
filepath = bpy.path.abspath(self.filepath)
|
||||
filepath = os.path.normpath(filepath)
|
||||
|
||||
if not os.path.exists(filepath):
|
||||
self.report({'ERROR'}, "File '%s' not found" % filepath)
|
||||
return {'CANCELLED'}
|
||||
|
||||
if sys.platform == 'win32':
|
||||
subprocess.Popen(['start', filepath], shell=True)
|
||||
elif sys.platform == 'darwin':
|
||||
subprocess.Popen(['open', filepath])
|
||||
else:
|
||||
try:
|
||||
subprocess.Popen(['xdg-open', filepath])
|
||||
except OSError:
|
||||
# xdg-open *should* be supported by recent Gnome, KDE, Xfce
|
||||
pass
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class WM_OT_doc_view(bpy.types.Operator):
|
||||
'''Load online reference docs'''
|
||||
bl_idname = "wm.doc_view"
|
||||
bl_label = "View Documentation"
|
||||
|
||||
doc_id = doc_id
|
||||
_prefix = "http://www.blender.org/documentation/blender_python_api_%s" % "_".join(str(v) for v in bpy.app.version)
|
||||
|
||||
def _nested_class_string(self, class_string):
|
||||
ls = []
|
||||
class_obj = getattr(bpy.types, class_string, None).bl_rna
|
||||
while class_obj:
|
||||
ls.insert(0, class_obj)
|
||||
class_obj = class_obj.nested
|
||||
return '.'.join(class_obj.identifier for class_obj in ls)
|
||||
|
||||
def execute(self, context):
|
||||
id_split = self.doc_id.split('.')
|
||||
if len(id_split) == 1: # rna, class
|
||||
url = '%s/bpy.types.%s.html' % (self._prefix, id_split[0])
|
||||
elif len(id_split) == 2: # rna, class.prop
|
||||
class_name, class_prop = id_split
|
||||
|
||||
if hasattr(bpy.types, class_name.upper() + '_OT_' + class_prop):
|
||||
url = '%s/bpy.ops.%s.html#bpy.ops.%s.%s' % \
|
||||
(self._prefix, class_name, class_name, class_prop)
|
||||
else:
|
||||
# It so happens that epydoc nests these, not sphinx
|
||||
# class_name_full = self._nested_class_string(class_name)
|
||||
url = '%s/bpy.types.%s.html#bpy.types.%s.%s' % \
|
||||
(self._prefix, class_name, class_name, class_prop)
|
||||
|
||||
else:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
import webbrowser
|
||||
webbrowser.open(url)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class WM_OT_doc_edit(bpy.types.Operator):
|
||||
'''Load online reference docs'''
|
||||
bl_idname = "wm.doc_edit"
|
||||
bl_label = "Edit Documentation"
|
||||
|
||||
doc_id = doc_id
|
||||
doc_new = doc_new
|
||||
|
||||
_url = "http://www.mindrones.com/blender/svn/xmlrpc.php"
|
||||
|
||||
def _send_xmlrpc(self, data_dict):
|
||||
print("sending data:", data_dict)
|
||||
|
||||
import xmlrpc.client
|
||||
user = 'blenderuser'
|
||||
pwd = 'blender>user'
|
||||
|
||||
docblog = xmlrpc.client.ServerProxy(self._url)
|
||||
docblog.metaWeblog.newPost(1, user, pwd, data_dict, 1)
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
doc_id = self.doc_id
|
||||
doc_new = self.doc_new
|
||||
|
||||
class_name, class_prop = doc_id.split('.')
|
||||
|
||||
if not doc_new:
|
||||
self.report({'ERROR'}, "No input given for '%s'" % doc_id)
|
||||
return {'CANCELLED'}
|
||||
|
||||
# check if this is an operator
|
||||
op_name = class_name.upper() + '_OT_' + class_prop
|
||||
op_class = getattr(bpy.types, op_name, None)
|
||||
|
||||
# Upload this to the web server
|
||||
upload = {}
|
||||
|
||||
if op_class:
|
||||
rna = op_class.bl_rna
|
||||
doc_orig = rna.description
|
||||
if doc_orig == doc_new:
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
print("op - old:'%s' -> new:'%s'" % (doc_orig, doc_new))
|
||||
upload["title"] = 'OPERATOR %s:%s' % (doc_id, doc_orig)
|
||||
else:
|
||||
rna = getattr(bpy.types, class_name).bl_rna
|
||||
doc_orig = rna.properties[class_prop].description
|
||||
if doc_orig == doc_new:
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
print("rna - old:'%s' -> new:'%s'" % (doc_orig, doc_new))
|
||||
upload["title"] = 'RNA %s:%s' % (doc_id, doc_orig)
|
||||
|
||||
upload["description"] = doc_new
|
||||
|
||||
self._send_xmlrpc(upload)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.label(text="Descriptor ID: '%s'" % self.doc_id)
|
||||
layout.prop(self, "doc_new", text="")
|
||||
|
||||
def invoke(self, context, event):
|
||||
wm = context.window_manager
|
||||
return wm.invoke_props_dialog(self, width=600)
|
||||
|
||||
|
||||
from bpy.props import *
|
||||
|
||||
|
||||
rna_path = StringProperty(name="Property Edit",
|
||||
description="Property data_path edit", maxlen=1024, default="", options={'HIDDEN'})
|
||||
|
||||
rna_value = StringProperty(name="Property Value",
|
||||
description="Property value edit", maxlen=1024, default="")
|
||||
|
||||
rna_property = StringProperty(name="Property Name",
|
||||
description="Property name edit", maxlen=1024, default="")
|
||||
|
||||
rna_min = FloatProperty(name="Min", default=0.0, precision=3)
|
||||
rna_max = FloatProperty(name="Max", default=1.0, precision=3)
|
||||
|
||||
|
||||
class WM_OT_properties_edit(bpy.types.Operator):
|
||||
'''Internal use (edit a property data_path)'''
|
||||
bl_idname = "wm.properties_edit"
|
||||
bl_label = "Edit Property"
|
||||
bl_options = {'REGISTER'} # only because invoke_props_popup requires.
|
||||
|
||||
data_path = rna_path
|
||||
property = rna_property
|
||||
value = rna_value
|
||||
min = rna_min
|
||||
max = rna_max
|
||||
description = StringProperty(name="Tip", default="")
|
||||
|
||||
def execute(self, context):
|
||||
data_path = self.data_path
|
||||
value = self.value
|
||||
prop = self.property
|
||||
prop_old = self._last_prop[0]
|
||||
|
||||
try:
|
||||
value_eval = eval(value)
|
||||
except:
|
||||
value_eval = value
|
||||
|
||||
# First remove
|
||||
item = eval("context.%s" % data_path)
|
||||
|
||||
rna_idprop_ui_prop_clear(item, prop_old)
|
||||
exec_str = "del item['%s']" % prop_old
|
||||
# print(exec_str)
|
||||
exec(exec_str)
|
||||
|
||||
# Reassign
|
||||
exec_str = "item['%s'] = %s" % (prop, repr(value_eval))
|
||||
# print(exec_str)
|
||||
exec(exec_str)
|
||||
self._last_prop[:] = [prop]
|
||||
|
||||
prop_type = type(item[prop])
|
||||
|
||||
prop_ui = rna_idprop_ui_prop_get(item, prop)
|
||||
|
||||
if prop_type in (float, int):
|
||||
|
||||
prop_ui['soft_min'] = prop_ui['min'] = prop_type(self.min)
|
||||
prop_ui['soft_max'] = prop_ui['max'] = prop_type(self.max)
|
||||
|
||||
prop_ui['description'] = self.description
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
|
||||
self._last_prop = [self.property]
|
||||
|
||||
item = eval("context.%s" % self.data_path)
|
||||
|
||||
# setup defaults
|
||||
prop_ui = rna_idprop_ui_prop_get(item, self.property, False) # dont create
|
||||
if prop_ui:
|
||||
self.min = prop_ui.get("min", -1000000000)
|
||||
self.max = prop_ui.get("max", 1000000000)
|
||||
self.description = prop_ui.get("description", "")
|
||||
|
||||
wm = context.window_manager
|
||||
return wm.invoke_props_dialog(self)
|
||||
|
||||
|
||||
class WM_OT_properties_add(bpy.types.Operator):
|
||||
'''Internal use (edit a property data_path)'''
|
||||
bl_idname = "wm.properties_add"
|
||||
bl_label = "Add Property"
|
||||
|
||||
data_path = rna_path
|
||||
|
||||
def execute(self, context):
|
||||
item = eval("context.%s" % self.data_path)
|
||||
|
||||
def unique_name(names):
|
||||
prop = 'prop'
|
||||
prop_new = prop
|
||||
i = 1
|
||||
while prop_new in names:
|
||||
prop_new = prop + str(i)
|
||||
i += 1
|
||||
|
||||
return prop_new
|
||||
|
||||
property = unique_name(item.keys())
|
||||
|
||||
item[property] = 1.0
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class WM_OT_properties_remove(bpy.types.Operator):
|
||||
'''Internal use (edit a property data_path)'''
|
||||
bl_idname = "wm.properties_remove"
|
||||
bl_label = "Remove Property"
|
||||
|
||||
data_path = rna_path
|
||||
property = rna_property
|
||||
|
||||
def execute(self, context):
|
||||
item = eval("context.%s" % self.data_path)
|
||||
del item[self.property]
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class WM_OT_keyconfig_activate(bpy.types.Operator):
|
||||
bl_idname = "wm.keyconfig_activate"
|
||||
bl_label = "Activate Keyconfig"
|
||||
|
||||
filepath = StringProperty(name="File Path", maxlen=1024)
|
||||
|
||||
def execute(self, context):
|
||||
bpy.utils.keyconfig_set(self.filepath)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class WM_OT_sysinfo(bpy.types.Operator):
|
||||
'''Generate System Info'''
|
||||
bl_idname = "wm.sysinfo"
|
||||
bl_label = "System Info"
|
||||
|
||||
def execute(self, context):
|
||||
import sys_info
|
||||
sys_info.write_sysinfo(self)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
|
@ -1,382 +1,6 @@
|
|||
# Configuration Maya
|
||||
# Configuration Blender
|
||||
import bpy
|
||||
|
||||
wm = bpy.context.window_manager
|
||||
kc = wm.keyconfigs.new('Maya')
|
||||
|
||||
# Map 3D View
|
||||
km = kc.keymaps.new('3D View', space_type='VIEW_3D', region_type='WINDOW', modal=False)
|
||||
|
||||
kmi = km.items.new('view3d.manipulator', 'LEFTMOUSE', 'PRESS', any=True)
|
||||
kmi.properties.release_confirm = True
|
||||
kmi = km.items.new('view3d.cursor3d', 'ACTIONMOUSE', 'PRESS')
|
||||
kmi = km.items.new('view3d.rotate', 'LEFTMOUSE', 'PRESS', alt=True)
|
||||
kmi = km.items.new('view3d.move', 'MIDDLEMOUSE', 'PRESS', alt=True)
|
||||
kmi = km.items.new('view3d.zoom', 'RIGHTMOUSE', 'PRESS', alt=True)
|
||||
kmi = km.items.new('view3d.view_selected', 'NUMPAD_PERIOD', 'PRESS')
|
||||
kmi = km.items.new('view3d.view_center_cursor', 'NUMPAD_PERIOD', 'PRESS', ctrl=True)
|
||||
kmi = km.items.new('view3d.fly', 'F', 'PRESS', shift=True)
|
||||
kmi = km.items.new('view3d.smoothview', 'TIMER1', 'ANY', any=True)
|
||||
kmi = km.items.new('view3d.rotate', 'TRACKPADPAN', 'ANY', alt=True)
|
||||
kmi = km.items.new('view3d.rotate', 'MOUSEROTATE', 'ANY')
|
||||
kmi = km.items.new('view3d.move', 'TRACKPADPAN', 'ANY')
|
||||
kmi = km.items.new('view3d.zoom', 'TRACKPADZOOM', 'ANY')
|
||||
kmi = km.items.new('view3d.zoom', 'NUMPAD_PLUS', 'PRESS')
|
||||
kmi.properties.delta = 1
|
||||
kmi = km.items.new('view3d.zoom', 'NUMPAD_MINUS', 'PRESS')
|
||||
kmi.properties.delta = -1
|
||||
kmi = km.items.new('view3d.zoom', 'EQUAL', 'PRESS', ctrl=True)
|
||||
kmi.properties.delta = 1
|
||||
kmi = km.items.new('view3d.zoom', 'MINUS', 'PRESS', ctrl=True)
|
||||
kmi.properties.delta = -1
|
||||
kmi = km.items.new('view3d.zoom', 'WHEELINMOUSE', 'PRESS')
|
||||
kmi.properties.delta = 1
|
||||
kmi = km.items.new('view3d.zoom', 'WHEELOUTMOUSE', 'PRESS')
|
||||
kmi.properties.delta = -1
|
||||
kmi = km.items.new('view3d.view_all', 'HOME', 'PRESS')
|
||||
kmi.properties.center = False
|
||||
kmi = km.items.new('view3d.view_all', 'C', 'PRESS', shift=True)
|
||||
kmi.properties.center = True
|
||||
kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_0', 'PRESS')
|
||||
kmi.properties.type = 'CAMERA'
|
||||
kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS')
|
||||
kmi.properties.type = 'FRONT'
|
||||
kmi = km.items.new('view3d.view_orbit', 'NUMPAD_2', 'PRESS')
|
||||
kmi.properties.type = 'ORBITDOWN'
|
||||
kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS')
|
||||
kmi.properties.type = 'RIGHT'
|
||||
kmi = km.items.new('view3d.view_orbit', 'NUMPAD_4', 'PRESS')
|
||||
kmi.properties.type = 'ORBITLEFT'
|
||||
kmi = km.items.new('view3d.view_persportho', 'NUMPAD_5', 'PRESS')
|
||||
kmi = km.items.new('view3d.view_orbit', 'NUMPAD_6', 'PRESS')
|
||||
kmi.properties.type = 'ORBITRIGHT'
|
||||
kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS')
|
||||
kmi.properties.type = 'TOP'
|
||||
kmi = km.items.new('view3d.view_orbit', 'NUMPAD_8', 'PRESS')
|
||||
kmi.properties.type = 'ORBITUP'
|
||||
kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', ctrl=True)
|
||||
kmi.properties.type = 'BACK'
|
||||
kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', ctrl=True)
|
||||
kmi.properties.type = 'LEFT'
|
||||
kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', ctrl=True)
|
||||
kmi.properties.type = 'BOTTOM'
|
||||
kmi = km.items.new('view3d.view_pan', 'NUMPAD_2', 'PRESS', ctrl=True)
|
||||
kmi.properties.type = 'PANDOWN'
|
||||
kmi = km.items.new('view3d.view_pan', 'NUMPAD_4', 'PRESS', ctrl=True)
|
||||
kmi.properties.type = 'PANLEFT'
|
||||
kmi = km.items.new('view3d.view_pan', 'NUMPAD_6', 'PRESS', ctrl=True)
|
||||
kmi.properties.type = 'PANRIGHT'
|
||||
kmi = km.items.new('view3d.view_pan', 'NUMPAD_8', 'PRESS', ctrl=True)
|
||||
kmi.properties.type = 'PANUP'
|
||||
kmi = km.items.new('view3d.view_pan', 'WHEELUPMOUSE', 'PRESS', ctrl=True)
|
||||
kmi.properties.type = 'PANRIGHT'
|
||||
kmi = km.items.new('view3d.view_pan', 'WHEELDOWNMOUSE', 'PRESS', ctrl=True)
|
||||
kmi.properties.type = 'PANLEFT'
|
||||
kmi = km.items.new('view3d.view_pan', 'WHEELUPMOUSE', 'PRESS', shift=True)
|
||||
kmi.properties.type = 'PANUP'
|
||||
kmi = km.items.new('view3d.view_pan', 'WHEELDOWNMOUSE', 'PRESS', shift=True)
|
||||
kmi.properties.type = 'PANDOWN'
|
||||
kmi = km.items.new('view3d.view_orbit', 'WHEELUPMOUSE', 'PRESS', ctrl=True, alt=True)
|
||||
kmi.properties.type = 'ORBITLEFT'
|
||||
kmi = km.items.new('view3d.view_orbit', 'WHEELDOWNMOUSE', 'PRESS', ctrl=True, alt=True)
|
||||
kmi.properties.type = 'ORBITRIGHT'
|
||||
kmi = km.items.new('view3d.view_orbit', 'WHEELUPMOUSE', 'PRESS', shift=True, alt=True)
|
||||
kmi.properties.type = 'ORBITUP'
|
||||
kmi = km.items.new('view3d.view_orbit', 'WHEELDOWNMOUSE', 'PRESS', shift=True, alt=True)
|
||||
kmi.properties.type = 'ORBITDOWN'
|
||||
kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', shift=True)
|
||||
kmi.properties.align_active = True
|
||||
kmi.properties.type = 'FRONT'
|
||||
kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', shift=True)
|
||||
kmi.properties.align_active = True
|
||||
kmi.properties.type = 'RIGHT'
|
||||
kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', shift=True)
|
||||
kmi.properties.align_active = True
|
||||
kmi.properties.type = 'TOP'
|
||||
kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', shift=True, ctrl=True)
|
||||
kmi.properties.align_active = True
|
||||
kmi.properties.type = 'BACK'
|
||||
kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', shift=True, ctrl=True)
|
||||
kmi.properties.align_active = True
|
||||
kmi.properties.type = 'LEFT'
|
||||
kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', shift=True, ctrl=True)
|
||||
kmi.properties.align_active = True
|
||||
kmi.properties.type = 'BOTTOM'
|
||||
kmi = km.items.new('view3d.localview', 'NUMPAD_SLASH', 'PRESS')
|
||||
kmi = km.items.new('view3d.layers', 'ACCENT_GRAVE', 'PRESS')
|
||||
kmi.properties.nr = 0
|
||||
kmi = km.items.new('view3d.layers', 'ONE', 'PRESS', any=True)
|
||||
kmi.properties.nr = 1
|
||||
kmi = km.items.new('view3d.layers', 'TWO', 'PRESS', any=True)
|
||||
kmi.properties.nr = 2
|
||||
kmi = km.items.new('view3d.layers', 'THREE', 'PRESS', any=True)
|
||||
kmi.properties.nr = 3
|
||||
kmi = km.items.new('view3d.layers', 'FOUR', 'PRESS', any=True)
|
||||
kmi.properties.nr = 4
|
||||
kmi = km.items.new('view3d.layers', 'FIVE', 'PRESS', any=True)
|
||||
kmi.properties.nr = 5
|
||||
kmi = km.items.new('view3d.layers', 'SIX', 'PRESS', any=True)
|
||||
kmi.properties.nr = 6
|
||||
kmi = km.items.new('view3d.layers', 'SEVEN', 'PRESS', any=True)
|
||||
kmi.properties.nr = 7
|
||||
kmi = km.items.new('view3d.layers', 'EIGHT', 'PRESS', any=True)
|
||||
kmi.properties.nr = 8
|
||||
kmi = km.items.new('view3d.layers', 'NINE', 'PRESS', any=True)
|
||||
kmi.properties.nr = 9
|
||||
kmi = km.items.new('view3d.layers', 'ZERO', 'PRESS', any=True)
|
||||
kmi.properties.nr = 10
|
||||
kmi = km.items.new('wm.context_toggle_enum', 'Z', 'PRESS')
|
||||
kmi.properties.data_path = 'space_data.viewport_shade'
|
||||
kmi.properties.value_1 = 'SOLID'
|
||||
kmi.properties.value_2 = 'WIREFRAME'
|
||||
kmi = km.items.new('wm.context_toggle_enum', 'Z', 'PRESS', alt=True)
|
||||
kmi.properties.data_path = 'space_data.viewport_shade'
|
||||
kmi.properties.value_1 = 'TEXTURED'
|
||||
kmi.properties.value_2 = 'SOLID'
|
||||
kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS')
|
||||
kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True)
|
||||
kmi.properties.extend = True
|
||||
kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', ctrl=True)
|
||||
kmi.properties.center = True
|
||||
kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', alt=True)
|
||||
kmi.properties.enumerate = True
|
||||
kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True)
|
||||
kmi.properties.center = True
|
||||
kmi.properties.extend = True
|
||||
kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True)
|
||||
kmi.properties.center = True
|
||||
kmi.properties.enumerate = True
|
||||
kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, alt=True)
|
||||
kmi.properties.enumerate = True
|
||||
kmi.properties.extend = True
|
||||
kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True, alt=True)
|
||||
kmi.properties.center = True
|
||||
kmi.properties.enumerate = True
|
||||
kmi.properties.extend = True
|
||||
kmi = km.items.new('view3d.select_border', 'EVT_TWEAK_S', 'ANY')
|
||||
kmi.properties.extend = False
|
||||
kmi = km.items.new('view3d.select_lasso', 'EVT_TWEAK_A', 'ANY', ctrl=True)
|
||||
kmi = km.items.new('view3d.select_lasso', 'EVT_TWEAK_A', 'ANY', shift=True, ctrl=True)
|
||||
kmi.properties.deselect = True
|
||||
kmi = km.items.new('view3d.select_circle', 'C', 'PRESS')
|
||||
kmi = km.items.new('view3d.clip_border', 'B', 'PRESS', alt=True)
|
||||
kmi = km.items.new('view3d.zoom_border', 'B', 'PRESS', shift=True)
|
||||
kmi = km.items.new('view3d.render_border', 'B', 'PRESS', shift=True)
|
||||
kmi = km.items.new('view3d.camera_to_view', 'NUMPAD_0', 'PRESS', ctrl=True, alt=True)
|
||||
kmi = km.items.new('view3d.object_as_camera', 'NUMPAD_0', 'PRESS', ctrl=True)
|
||||
kmi = km.items.new('wm.call_menu', 'S', 'PRESS', shift=True)
|
||||
kmi.properties.name = 'VIEW3D_MT_snap'
|
||||
kmi = km.items.new('wm.context_set_enum', 'COMMA', 'PRESS')
|
||||
kmi.properties.data_path = 'space_data.pivot_point'
|
||||
kmi.properties.value = 'BOUNDING_BOX_CENTER'
|
||||
kmi = km.items.new('wm.context_set_enum', 'COMMA', 'PRESS', ctrl=True)
|
||||
kmi.properties.data_path = 'space_data.pivot_point'
|
||||
kmi.properties.value = 'MEDIAN_POINT'
|
||||
kmi = km.items.new('wm.context_toggle', 'COMMA', 'PRESS', alt=True)
|
||||
kmi.properties.data_path = 'space_data.use_pivot_point_align'
|
||||
kmi = km.items.new('wm.context_toggle', 'Q', 'PRESS')
|
||||
kmi.properties.data_path = 'space_data.show_manipulator'
|
||||
kmi = km.items.new('wm.context_set_enum', 'PERIOD', 'PRESS')
|
||||
kmi.properties.data_path = 'space_data.pivot_point'
|
||||
kmi.properties.value = 'CURSOR'
|
||||
kmi = km.items.new('wm.context_set_enum', 'PERIOD', 'PRESS', ctrl=True)
|
||||
kmi.properties.data_path = 'space_data.pivot_point'
|
||||
kmi.properties.value = 'INDIVIDUAL_ORIGINS'
|
||||
kmi = km.items.new('wm.context_set_enum', 'PERIOD', 'PRESS', alt=True)
|
||||
kmi.properties.data_path = 'space_data.pivot_point'
|
||||
kmi.properties.value = 'ACTIVE_ELEMENT'
|
||||
kmi = km.items.new('transform.translate', 'G', 'PRESS', shift=True)
|
||||
kmi = km.items.new('transform.translate', 'EVT_TWEAK_S', 'ANY')
|
||||
kmi = km.items.new('transform.rotate', 'R', 'PRESS', shift=True)
|
||||
kmi = km.items.new('transform.resize', 'S', 'PRESS', shift=True)
|
||||
kmi = km.items.new('transform.warp', 'W', 'PRESS', shift=True)
|
||||
kmi = km.items.new('transform.tosphere', 'S', 'PRESS', shift=True, alt=True)
|
||||
kmi = km.items.new('transform.shear', 'S', 'PRESS', shift=True, ctrl=True, alt=True)
|
||||
kmi = km.items.new('transform.select_orientation', 'SPACE', 'PRESS', alt=True)
|
||||
kmi = km.items.new('transform.create_orientation', 'SPACE', 'PRESS', ctrl=True, alt=True)
|
||||
kmi.properties.use = True
|
||||
kmi = km.items.new('transform.mirror', 'M', 'PRESS', ctrl=True)
|
||||
kmi = km.items.new('wm.context_toggle', 'TAB', 'PRESS', shift=True)
|
||||
kmi.properties.data_path = 'tool_settings.use_snap'
|
||||
kmi = km.items.new('transform.snap_type', 'TAB', 'PRESS', shift=True, ctrl=True)
|
||||
kmi = km.items.new('view3d.enable_manipulator', 'W', 'PRESS')
|
||||
kmi.properties.translate = True
|
||||
kmi = km.items.new('view3d.enable_manipulator', 'E', 'PRESS')
|
||||
kmi.properties.rotate = True
|
||||
kmi = km.items.new('view3d.enable_manipulator', 'R', 'PRESS')
|
||||
kmi.properties.scale = True
|
||||
kmi = km.items.new('view3d.select_border', 'EVT_TWEAK_S', 'ANY', shift=True)
|
||||
kmi.properties.extend = True
|
||||
|
||||
# Map Object Mode
|
||||
km = kc.keymaps.new('Object Mode', space_type='EMPTY', region_type='WINDOW', modal=False)
|
||||
|
||||
kmi = km.items.new('wm.context_cycle_enum', 'O', 'PRESS', shift=True)
|
||||
kmi.properties.data_path = 'tool_settings.proportional_edit_falloff'
|
||||
kmi = km.items.new('wm.context_toggle_enum', 'O', 'PRESS')
|
||||
kmi.properties.data_path = 'tool_settings.proportional_edit'
|
||||
kmi.properties.value_1 = 'DISABLED'
|
||||
kmi.properties.value_2 = 'ENABLED'
|
||||
kmi = km.items.new('view3d.game_start', 'P', 'PRESS')
|
||||
kmi = km.items.new('object.select_all', 'A', 'PRESS')
|
||||
kmi = km.items.new('object.select_inverse', 'I', 'PRESS', ctrl=True)
|
||||
kmi = km.items.new('object.select_linked', 'L', 'PRESS', shift=True)
|
||||
kmi = km.items.new('object.select_grouped', 'G', 'PRESS', shift=True)
|
||||
kmi = km.items.new('object.select_mirror', 'M', 'PRESS', shift=True, ctrl=True)
|
||||
kmi = km.items.new('object.select_hierarchy', 'LEFT_BRACKET', 'PRESS')
|
||||
kmi.properties.direction = 'PARENT'
|
||||
kmi = km.items.new('object.select_hierarchy', 'LEFT_BRACKET', 'PRESS', shift=True)
|
||||
kmi.properties.direction = 'PARENT'
|
||||
kmi.properties.extend = True
|
||||
kmi = km.items.new('object.select_hierarchy', 'RIGHT_BRACKET', 'PRESS')
|
||||
kmi.properties.direction = 'CHILD'
|
||||
kmi = km.items.new('object.select_hierarchy', 'RIGHT_BRACKET', 'PRESS', shift=True)
|
||||
kmi.properties.direction = 'CHILD'
|
||||
kmi.properties.extend = True
|
||||
kmi = km.items.new('object.parent_set', 'P', 'PRESS', ctrl=True)
|
||||
kmi = km.items.new('object.parent_no_inverse_set', 'P', 'PRESS', shift=True, ctrl=True)
|
||||
kmi = km.items.new('object.parent_clear', 'P', 'PRESS', alt=True)
|
||||
kmi = km.items.new('object.track_set', 'T', 'PRESS', ctrl=True)
|
||||
kmi = km.items.new('object.track_clear', 'T', 'PRESS', alt=True)
|
||||
kmi = km.items.new('object.constraint_add_with_targets', 'C', 'PRESS', shift=True, ctrl=True)
|
||||
kmi = km.items.new('object.constraints_clear', 'C', 'PRESS', ctrl=True, alt=True)
|
||||
kmi = km.items.new('object.location_clear', 'G', 'PRESS', alt=True)
|
||||
kmi = km.items.new('object.rotation_clear', 'R', 'PRESS', alt=True)
|
||||
kmi = km.items.new('object.scale_clear', 'S', 'PRESS', alt=True)
|
||||
kmi = km.items.new('object.origin_clear', 'O', 'PRESS', alt=True)
|
||||
kmi = km.items.new('object.hide_view_clear', 'H', 'PRESS', alt=True)
|
||||
kmi = km.items.new('object.hide_view_set', 'H', 'PRESS')
|
||||
kmi = km.items.new('object.hide_view_set', 'H', 'PRESS', shift=True)
|
||||
kmi.properties.unselected = True
|
||||
kmi = km.items.new('object.move_to_layer', 'M', 'PRESS')
|
||||
kmi = km.items.new('object.delete', 'X', 'PRESS')
|
||||
kmi = km.items.new('object.delete', 'DEL', 'PRESS')
|
||||
kmi = km.items.new('wm.call_menu', 'A', 'PRESS', shift=True)
|
||||
kmi.properties.name = 'INFO_MT_add'
|
||||
kmi = km.items.new('object.duplicates_make_real', 'A', 'PRESS', shift=True, ctrl=True)
|
||||
kmi = km.items.new('wm.call_menu', 'A', 'PRESS', ctrl=True)
|
||||
kmi.properties.name = 'VIEW3D_MT_object_apply'
|
||||
kmi = km.items.new('wm.call_menu', 'U', 'PRESS')
|
||||
kmi.properties.name = 'VIEW3D_MT_make_single_user'
|
||||
kmi = km.items.new('wm.call_menu', 'L', 'PRESS', ctrl=True)
|
||||
kmi.properties.name = 'VIEW3D_MT_make_links'
|
||||
kmi = km.items.new('object.duplicate_move', 'D', 'PRESS', shift=True)
|
||||
kmi = km.items.new('object.duplicate_move_linked', 'D', 'PRESS', alt=True)
|
||||
kmi = km.items.new('object.join', 'J', 'PRESS', ctrl=True)
|
||||
kmi = km.items.new('object.convert', 'C', 'PRESS', alt=True)
|
||||
kmi = km.items.new('object.proxy_make', 'P', 'PRESS', ctrl=True, alt=True)
|
||||
kmi = km.items.new('object.make_local', 'L', 'PRESS')
|
||||
kmi = km.items.new('anim.keyframe_insert_menu', 'I', 'PRESS')
|
||||
kmi = km.items.new('anim.keyframe_delete_v3d', 'I', 'PRESS', alt=True)
|
||||
kmi = km.items.new('anim.keying_set_active_set', 'I', 'PRESS', shift=True, ctrl=True, alt=True)
|
||||
kmi = km.items.new('group.create', 'G', 'PRESS', ctrl=True)
|
||||
kmi = km.items.new('group.objects_remove', 'G', 'PRESS', ctrl=True, alt=True)
|
||||
kmi = km.items.new('group.objects_add_active', 'G', 'PRESS', shift=True, ctrl=True)
|
||||
kmi = km.items.new('group.objects_remove_active', 'G', 'PRESS', shift=True, alt=True)
|
||||
kmi = km.items.new('wm.call_menu', 'W', 'PRESS', ctrl=True)
|
||||
kmi.properties.name = 'VIEW3D_MT_object_specials'
|
||||
kmi = km.items.new('object.subdivision_set', 'ZERO', 'PRESS', ctrl=True)
|
||||
kmi.properties.level = 0
|
||||
kmi = km.items.new('object.subdivision_set', 'ONE', 'PRESS', ctrl=True)
|
||||
kmi.properties.level = 1
|
||||
kmi = km.items.new('object.subdivision_set', 'TWO', 'PRESS', ctrl=True)
|
||||
kmi.properties.level = 2
|
||||
kmi = km.items.new('object.subdivision_set', 'THREE', 'PRESS', ctrl=True)
|
||||
kmi.properties.level = 3
|
||||
kmi = km.items.new('object.subdivision_set', 'FOUR', 'PRESS', ctrl=True)
|
||||
kmi.properties.level = 4
|
||||
kmi = km.items.new('object.subdivision_set', 'FIVE', 'PRESS', ctrl=True)
|
||||
kmi.properties.level = 5
|
||||
kmi = km.items.new('object.select_all', 'SELECTMOUSE', 'CLICK')
|
||||
kmi.properties.action = 'DESELECT'
|
||||
|
||||
# Map Mesh
|
||||
km = kc.keymaps.new('Mesh', space_type='EMPTY', region_type='WINDOW', modal=False)
|
||||
|
||||
kmi = km.items.new('mesh.loopcut_slide', 'R', 'PRESS', ctrl=True)
|
||||
kmi = km.items.new('mesh.loop_select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True)
|
||||
kmi = km.items.new('mesh.loop_select', 'SELECTMOUSE', 'PRESS', shift=True, alt=True)
|
||||
kmi.properties.extend = True
|
||||
kmi = km.items.new('mesh.edgering_select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True)
|
||||
kmi = km.items.new('mesh.edgering_select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True, alt=True)
|
||||
kmi.properties.extend = True
|
||||
kmi = km.items.new('mesh.select_shortest_path', 'SELECTMOUSE', 'PRESS', ctrl=True)
|
||||
kmi = km.items.new('mesh.select_all', 'A', 'PRESS')
|
||||
kmi = km.items.new('mesh.select_more', 'NUMPAD_PLUS', 'PRESS', ctrl=True)
|
||||
kmi = km.items.new('mesh.select_less', 'NUMPAD_MINUS', 'PRESS', ctrl=True)
|
||||
kmi = km.items.new('mesh.select_inverse', 'I', 'PRESS', ctrl=True)
|
||||
kmi = km.items.new('mesh.select_non_manifold', 'M', 'PRESS', shift=True, ctrl=True, alt=True)
|
||||
kmi = km.items.new('mesh.select_linked', 'L', 'PRESS', ctrl=True)
|
||||
kmi = km.items.new('mesh.select_linked_pick', 'L', 'PRESS')
|
||||
kmi = km.items.new('mesh.select_linked_pick', 'L', 'PRESS', shift=True)
|
||||
kmi.properties.deselect = True
|
||||
kmi = km.items.new('mesh.faces_select_linked_flat', 'F', 'PRESS', shift=True, ctrl=True, alt=True)
|
||||
kmi.properties.sharpness = 135.0
|
||||
kmi = km.items.new('mesh.select_similar', 'G', 'PRESS', shift=True)
|
||||
kmi = km.items.new('wm.call_menu', 'TAB', 'PRESS', ctrl=True)
|
||||
kmi.properties.name = 'VIEW3D_MT_edit_mesh_selection_mode'
|
||||
kmi = km.items.new('mesh.hide', 'H', 'PRESS')
|
||||
kmi = km.items.new('mesh.hide', 'H', 'PRESS', shift=True)
|
||||
kmi.properties.unselected = True
|
||||
kmi = km.items.new('mesh.reveal', 'H', 'PRESS', alt=True)
|
||||
kmi = km.items.new('mesh.normals_make_consistent', 'N', 'PRESS', ctrl=True)
|
||||
kmi = km.items.new('mesh.normals_make_consistent', 'N', 'PRESS', shift=True, ctrl=True)
|
||||
kmi.properties.inside = True
|
||||
kmi = km.items.new('view3d.edit_mesh_extrude_move_normal', 'E', 'PRESS', ctrl=True)
|
||||
kmi = km.items.new('view3d.edit_mesh_extrude_individual_move', 'E', 'PRESS', shift=True)
|
||||
kmi = km.items.new('wm.call_menu', 'E', 'PRESS', alt=True)
|
||||
kmi.properties.name = 'VIEW3D_MT_edit_mesh_extrude'
|
||||
kmi = km.items.new('mesh.spin', 'R', 'PRESS', alt=True)
|
||||
kmi = km.items.new('mesh.fill', 'F', 'PRESS', alt=True)
|
||||
kmi = km.items.new('mesh.beautify_fill', 'F', 'PRESS', shift=True, alt=True)
|
||||
kmi = km.items.new('mesh.quads_convert_to_tris', 'T', 'PRESS', ctrl=True)
|
||||
kmi = km.items.new('mesh.tris_convert_to_quads', 'J', 'PRESS', alt=True)
|
||||
kmi = km.items.new('mesh.edge_flip', 'F', 'PRESS', shift=True, ctrl=True)
|
||||
kmi = km.items.new('mesh.rip_move', 'V', 'PRESS')
|
||||
kmi = km.items.new('mesh.merge', 'M', 'PRESS', alt=True)
|
||||
kmi = km.items.new('transform.shrink_fatten', 'S', 'PRESS', ctrl=True, alt=True)
|
||||
kmi = km.items.new('mesh.edge_face_add', 'F', 'PRESS')
|
||||
kmi = km.items.new('mesh.duplicate_move', 'D', 'PRESS', shift=True)
|
||||
kmi = km.items.new('wm.call_menu', 'A', 'PRESS', shift=True)
|
||||
kmi.properties.name = 'INFO_MT_mesh_add'
|
||||
kmi = km.items.new('mesh.separate', 'P', 'PRESS')
|
||||
kmi = km.items.new('mesh.split', 'Y', 'PRESS')
|
||||
kmi = km.items.new('mesh.dupli_extrude_cursor', 'ACTIONMOUSE', 'CLICK', ctrl=True)
|
||||
kmi = km.items.new('mesh.delete', 'X', 'PRESS')
|
||||
kmi = km.items.new('mesh.delete', 'DEL', 'PRESS')
|
||||
kmi = km.items.new('mesh.knife_cut', 'LEFTMOUSE', 'PRESS', key_modifier='K')
|
||||
kmi = km.items.new('mesh.knife_cut', 'LEFTMOUSE', 'PRESS', shift=True, key_modifier='K')
|
||||
kmi.properties.type = 'MIDPOINTS'
|
||||
kmi = km.items.new('object.vertex_parent_set', 'P', 'PRESS', ctrl=True)
|
||||
kmi = km.items.new('wm.call_menu', 'W', 'PRESS', ctrl=True)
|
||||
kmi.properties.name = 'VIEW3D_MT_edit_mesh_specials'
|
||||
kmi = km.items.new('wm.call_menu', 'F', 'PRESS', ctrl=True)
|
||||
kmi.properties.name = 'VIEW3D_MT_edit_mesh_faces'
|
||||
kmi = km.items.new('wm.call_menu', 'E', 'PRESS', ctrl=True)
|
||||
kmi.properties.name = 'VIEW3D_MT_edit_mesh_edges'
|
||||
kmi = km.items.new('wm.call_menu', 'V', 'PRESS', ctrl=True)
|
||||
kmi.properties.name = 'VIEW3D_MT_edit_mesh_vertices'
|
||||
kmi = km.items.new('wm.call_menu', 'H', 'PRESS', ctrl=True)
|
||||
kmi.properties.name = 'VIEW3D_MT_hook'
|
||||
kmi = km.items.new('wm.call_menu', 'U', 'PRESS')
|
||||
kmi.properties.name = 'VIEW3D_MT_uv_map'
|
||||
kmi = km.items.new('wm.call_menu', 'G', 'PRESS', ctrl=True)
|
||||
kmi.properties.name = 'VIEW3D_MT_vertex_group'
|
||||
kmi = km.items.new('wm.context_cycle_enum', 'O', 'PRESS', shift=True)
|
||||
kmi.properties.data_path = 'tool_settings.proportional_edit_falloff'
|
||||
kmi = km.items.new('wm.context_toggle_enum', 'O', 'PRESS')
|
||||
kmi.properties.data_path = 'tool_settings.proportional_edit'
|
||||
kmi.properties.value_1 = 'DISABLED'
|
||||
kmi.properties.value_2 = 'ENABLED'
|
||||
kmi = km.items.new('wm.context_toggle_enum', 'O', 'PRESS', alt=True)
|
||||
kmi.properties.data_path = 'tool_settings.proportional_edit'
|
||||
kmi.properties.value_1 = 'DISABLED'
|
||||
kmi.properties.value_2 = 'CONNECTED'
|
||||
kmi = km.items.new('mesh.select_all', 'SELECTMOUSE', 'CLICK')
|
||||
kmi.properties.action = 'DESELECT'
|
||||
|
||||
wm.keyconfigs.active = kc
|
||||
|
||||
bpy.context.user_preferences.edit.use_drag_immediately = True
|
||||
bpy.context.user_preferences.edit.use_insertkey_xyz_to_rgb = False
|
||||
bpy.context.user_preferences.inputs.select_mouse = 'LEFT'
|
||||
|
|
|
@ -164,8 +164,6 @@ class INFO_MT_file_export(bpy.types.Menu):
|
|||
bl_label = "Export"
|
||||
|
||||
def draw(self, context):
|
||||
self.layout.operator("export_mesh.wavefront", text="Wavefront (.obj)")
|
||||
|
||||
if hasattr(bpy.types, "WM_OT_collada_export"):
|
||||
self.layout.operator("wm.collada_export", text="COLLADA (.dae)")
|
||||
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
import bpy
|
||||
|
||||
def write_some_data(context, filepath, use_some_setting):
|
||||
print("running write_some_data...")
|
||||
pass
|
||||
|
||||
from bpy.props import *
|
||||
|
||||
class ExportSomeData(bpy.types.Operator):
|
||||
'''This appiers in the tooltip of the operator and in the generated docs.'''
|
||||
bl_idname = "export.some_data" # this is important since its how bpy.ops.export.some_data is constructed
|
||||
bl_label = "Export Some Data"
|
||||
|
||||
# List of operator properties, the attributes will be assigned
|
||||
# to the class instance from the operator settings before calling.
|
||||
|
||||
# TODO, add better example props
|
||||
filepath = StringProperty(name="File Path", description="File path used for exporting the PLY file", maxlen= 1024, default= "")
|
||||
use_setting = BoolProperty(name="Example Boolean", description="Example Tooltip", default= True)
|
||||
|
||||
type = bpy.props.EnumProperty(items=(('OPT_A', "First Option", "Description one"), ('OPT_B', "Second Option", "Description two.")),
|
||||
name="Example Enum",
|
||||
description="Choose between two items",
|
||||
default='OPT_A')
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.active_object != None
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
# # Bug, currently isnt working
|
||||
#if not self.is_property_set("filepath"):
|
||||
# raise Exception("filename not set")
|
||||
|
||||
write_some_data(self.properties.filepath, context, self.properties.use_setting)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
wm = context.window_manager
|
||||
|
||||
if True:
|
||||
# File selector
|
||||
wm.add_fileselect(self) # will run self.execute()
|
||||
return {'RUNNING_MODAL'}
|
||||
elif True:
|
||||
# search the enum
|
||||
wm.invoke_search_popup(self)
|
||||
return {'RUNNING_MODAL'}
|
||||
elif False:
|
||||
# Redo popup
|
||||
return wm.invoke_props_popup(self, event) #
|
||||
elif False:
|
||||
return self.execute(context)
|
||||
|
||||
|
||||
# Only needed if you want to add into a dynamic menu
|
||||
menu_func = lambda self, context: self.layout.operator("export.some_data", text="Example Exporter...")
|
||||
bpy.types.INFO_MT_file_export.append(menu_func)
|
||||
|
||||
if __name__ == "__main__":
|
||||
bpy.ops.export.some_data('INVOKE_DEFAULT', filepath="/tmp/test.ply")
|
|
@ -1,129 +0,0 @@
|
|||
#!BPY
|
||||
"""
|
||||
Name: 'UVs from unselected adjacent'
|
||||
Blender: 242
|
||||
Group: 'UVCalculation'
|
||||
Tooltip: 'Assign UVs to selected faces from surrounding unselected faces.'
|
||||
"""
|
||||
__author__ = "Campbell Barton"
|
||||
__url__ = ("blender", "elysiun")
|
||||
__version__ = "1.0 2006/02/07"
|
||||
|
||||
__bpydoc__ = """\
|
||||
This script sets the UV mapping and image of selected faces from adjacent unselected faces.
|
||||
|
||||
Use this script in face select mode for texturing between textured faces.
|
||||
"""
|
||||
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# Script copyright (C) Campbell J Barton
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# ***** END GPL LICENCE BLOCK *****
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
|
||||
from Blender import *
|
||||
import bpy
|
||||
|
||||
def mostUsedImage(imageList): # Returns the image most used in the list.
|
||||
if not imageList:
|
||||
return None
|
||||
elif len(imageList) < 3:
|
||||
return imageList[0]
|
||||
|
||||
# 3+ Images, Get the most used image for surrounding faces.
|
||||
imageCount = {}
|
||||
for image in imageList:
|
||||
if image:
|
||||
image_key= image.name
|
||||
else:
|
||||
image_key = None
|
||||
|
||||
try:
|
||||
imageCount[image_key]['imageCount'] +=1 # an extra user of this image
|
||||
except:
|
||||
imageCount[image_key] = {'imageCount':1, 'blenderImage':image} # start with 1 user.
|
||||
|
||||
# Now a list of tuples, (imageName, {imageCount, image})
|
||||
imageCount = imageCount.items()
|
||||
|
||||
try: imageCount.sort(key=lambda a: a[1])
|
||||
except: imageCount.sort(lambda a,b: cmp(a[1], b[1]))
|
||||
|
||||
|
||||
return imageCount[-1][1]['blenderImage']
|
||||
|
||||
|
||||
def main():
|
||||
sce = bpy.data.scenes.active
|
||||
ob = sce.objects.active
|
||||
|
||||
if ob == None or ob.type != 'Mesh':
|
||||
Draw.PupMenu('ERROR: No mesh object in face select mode.')
|
||||
return
|
||||
me = ob.getData(mesh=1)
|
||||
|
||||
if not me.faceUV:
|
||||
Draw.PupMenu('ERROR: No mesh object in face select mode.')
|
||||
return
|
||||
|
||||
selfaces = [f for f in me.faces if f.sel]
|
||||
unselfaces = [f for f in me.faces if not f.sel]
|
||||
|
||||
|
||||
# Gather per Vert UV and Image, store in vertUvAverage
|
||||
vertUvAverage = [[[],[]] for i in xrange(len(me.verts))]
|
||||
|
||||
for f in unselfaces: # Unselected faces only.
|
||||
fuv = f.uv
|
||||
for i,v in enumerate(f):
|
||||
vertUvAverage[v.index][0].append(fuv[i])
|
||||
vertUvAverage[v.index][1].append(f.image)
|
||||
|
||||
# Average per vectex UV coords
|
||||
for vertUvData in vertUvAverage:
|
||||
uvList = vertUvData[0]
|
||||
if uvList:
|
||||
# Convert from a list of vectors into 1 vector.
|
||||
vertUvData[0] = reduce(lambda a,b: a+b, uvList, Mathutils.Vector(0,0)) * (1.0/len(uvList))
|
||||
else:
|
||||
vertUvData[0] = None
|
||||
|
||||
# Assign to selected faces
|
||||
TEX_FLAG = Mesh.FaceModes['TEX']
|
||||
for f in selfaces:
|
||||
uvlist = []
|
||||
imageList = []
|
||||
for i,v in enumerate(f):
|
||||
uv, vImages = vertUvAverage[v.index]
|
||||
uvlist.append( uv )
|
||||
imageList.extend(vImages)
|
||||
|
||||
if None not in uvlist:
|
||||
# all the faces images used by this faces vert. some faces will be added twice but thats ok.
|
||||
# Get the most used image and assign to the face.
|
||||
image = mostUsedImage(imageList)
|
||||
f.uv = uvlist
|
||||
|
||||
if image:
|
||||
f.image = image
|
||||
f.mode |= TEX_FLAG
|
||||
Window.RedrawAll()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Binary file not shown.
After Width: | Height: | Size: 151 KiB |
|
@ -1339,9 +1339,9 @@ static int pose_group_assign_exec (bContext *C, wmOperator *op)
|
|||
/* add selected bones to group then */
|
||||
CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
|
||||
{
|
||||
pchan->agrp_index= pose->active_group;
|
||||
done= 1;
|
||||
}
|
||||
pchan->agrp_index= pose->active_group;
|
||||
done= 1;
|
||||
}
|
||||
CTX_DATA_END;
|
||||
|
||||
/* notifiers for updates */
|
||||
|
|
|
@ -4455,9 +4455,9 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
|
|||
/* RMB has two options now */
|
||||
if (ui_but_menu(C, but)) {
|
||||
return WM_UI_HANDLER_BREAK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* verify if we can edit this button */
|
||||
if(ELEM(event->type, LEFTMOUSE, RETKEY)) {
|
||||
|
|
|
@ -40,16 +40,17 @@ set(SRC
|
|||
loopcut.c
|
||||
mesh_ops.c
|
||||
editbmesh_bvh.c
|
||||
editbmesh_bvh.h
|
||||
editbmesh_add.c
|
||||
bmeshutils.c
|
||||
mesh_intern.h
|
||||
bmesh_selecthistory.c
|
||||
bmesh_select.c
|
||||
mesh_data.c
|
||||
bmesh_tools.c
|
||||
knifetool.c
|
||||
editface.c
|
||||
|
||||
editbmesh_bvh.h
|
||||
mesh_intern.h
|
||||
)
|
||||
|
||||
blender_add_lib(bf_editor_mesh "${SRC}" "${INC}")
|
||||
|
|
|
@ -4474,6 +4474,7 @@ struct facesort {
|
|||
struct EditFace *efa;
|
||||
};
|
||||
|
||||
#if 0 /* UNUSED */
|
||||
static int vergface(const void *v1, const void *v2)
|
||||
{
|
||||
const struct facesort *x1=v1, *x2=v2;
|
||||
|
@ -4482,15 +4483,18 @@ static int vergface(const void *v1, const void *v2)
|
|||
else if( x1->x < x2->x) return -1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
// XXX is this needed?
|
||||
/* called from buttons */
|
||||
#if 0 /* UNUSED */
|
||||
static void xsortvert_flag__doSetX(void *userData, EditVert *UNUSED(eve), int x, int UNUSED(y), int index)
|
||||
{
|
||||
xvertsort *sortblock = userData;
|
||||
|
||||
sortblock[index].x = x;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* all verts with (flag & 'flag') are sorted */
|
||||
static void xsortvert_flag(bContext *UNUSED(C), int UNUSED(flag))
|
||||
|
|
|
@ -1809,6 +1809,7 @@ static int join_poll(bContext *C)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int join_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
|
@ -1822,7 +1823,7 @@ static int join_exec(bContext *C, wmOperator *op)
|
|||
BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata.");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
|
||||
if(ob->type == OB_MESH)
|
||||
return join_mesh_exec(C, op);
|
||||
else if(ELEM(ob->type, OB_CURVE, OB_SURF))
|
||||
|
|
|
@ -388,7 +388,7 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
|
|||
}
|
||||
else if (curcon->type == CONSTRAINT_TYPE_SPLINEIK) {
|
||||
bSplineIKConstraint *data = curcon->data;
|
||||
|
||||
|
||||
/* if the number of points does not match the amount required by the chain length,
|
||||
* free the points array and request a rebind...
|
||||
*/
|
||||
|
|
|
@ -415,7 +415,7 @@ void ED_object_enter_editmode(bContext *C, int flag)
|
|||
|
||||
if(base==NULL) return;
|
||||
else if(v3d && (base->lay & v3d->lay)==0) return;
|
||||
else if(!v3d && (base->lay & scene->lay)==0) return;
|
||||
else if(!v3d && (base->lay & scene->lay)==0) return;
|
||||
}
|
||||
else {
|
||||
base= scene->basact;
|
||||
|
@ -1847,7 +1847,7 @@ static void ofs_timeoffs(Scene *scene, View3D *v3d)
|
|||
ob->sf += offset;
|
||||
if (ob->sf < -MAXFRAMEF) ob->sf = -MAXFRAMEF;
|
||||
else if (ob->sf > MAXFRAMEF) ob->sf = MAXFRAMEF;
|
||||
}
|
||||
}
|
||||
CTX_DATA_END;
|
||||
|
||||
}
|
||||
|
|
|
@ -954,7 +954,7 @@ static int track_set_exec(bContext *C, wmOperator *op)
|
|||
Object *obact= ED_object_active_context(C);
|
||||
|
||||
int type= RNA_enum_get(op->ptr, "type");
|
||||
|
||||
|
||||
if(type == 1) {
|
||||
bConstraint *con;
|
||||
bDampTrackConstraint *data;
|
||||
|
@ -1194,7 +1194,7 @@ static int make_links_scene_exec(bContext *C, wmOperator *op)
|
|||
if(scene_to == CTX_data_scene(C)) {
|
||||
BKE_report(op->reports, RPT_ERROR, "Can't link objects into the same scene");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
if(scene_to->id.lib) {
|
||||
BKE_report(op->reports, RPT_ERROR, "Can't link objects into a linked scene");
|
||||
|
@ -1205,11 +1205,11 @@ static int make_links_scene_exec(bContext *C, wmOperator *op)
|
|||
{
|
||||
if(!object_in_scene(base->object, scene_to)) {
|
||||
Base *nbase= MEM_mallocN( sizeof(Base), "newbase");
|
||||
*nbase= *base;
|
||||
*nbase= *base;
|
||||
BLI_addhead( &(scene_to->base), nbase);
|
||||
id_us_plus((ID *)base->object);
|
||||
}
|
||||
}
|
||||
id_us_plus((ID *)base->object);
|
||||
}
|
||||
}
|
||||
CTX_DATA_END;
|
||||
|
||||
DAG_ids_flush_update(bmain, 0);
|
||||
|
@ -1299,7 +1299,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
|
|||
object_link_modifiers(obt, ob);
|
||||
obt->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -661,12 +661,13 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
|
|||
if(v3d && !RNA_property_is_set(op->ptr, "around"))
|
||||
around= v3d->around;
|
||||
}
|
||||
|
||||
zero_v3(cent);
|
||||
|
||||
if(obedit) {
|
||||
INIT_MINMAX(min, max);
|
||||
|
||||
if(obedit->type==OB_MESH) {
|
||||
INIT_MINMAX(min, max);
|
||||
|
||||
if(obedit->type==OB_MESH) {
|
||||
Mesh *me= obedit->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMVert *eve;
|
||||
|
@ -694,7 +695,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
|
|||
BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
|
||||
sub_v3_v3(eve->co, cent);
|
||||
}
|
||||
|
||||
|
||||
EDBM_RecalcNormals(em);
|
||||
tot_change++;
|
||||
DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
|
||||
|
|
|
@ -510,7 +510,6 @@ void ED_vgroup_vert_remove(Object *ob, bDeformGroup *dg, int vertnum)
|
|||
ED_vgroup_nr_vert_remove(ob, def_nr, vertnum);
|
||||
}
|
||||
|
||||
|
||||
static float get_vert_def_nr(Object *ob, int def_nr, int vertnum)
|
||||
{
|
||||
MDeformVert *dvert= NULL;
|
||||
|
@ -1173,6 +1172,7 @@ static void vgroup_delete_object_mode(Object *ob, bDeformGroup *dg)
|
|||
ob->actdef= 1;
|
||||
|
||||
}
|
||||
|
||||
/* only in editmode */
|
||||
/* removes from active defgroup, if allverts==0 only selected vertices */
|
||||
static void vgroup_active_remove_verts(Object *ob, const int allverts, bDeformGroup *dg)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue