forked from bartvdbraak/blender
Merging trunk up to r38329.
This commit is contained in:
commit
d9cf985730
@ -789,11 +789,8 @@ elseif(WIN32)
|
||||
if(WITH_IMAGE_OPENEXR)
|
||||
set(OPENEXR ${LIBDIR}/gcc/openexr)
|
||||
set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
|
||||
set(OPENEXR_LIBRARIES Half IlmImf Imath IlmThread)
|
||||
set(OPENEXR_LIBRARIES Half IlmImf Imath IlmThread Iex)
|
||||
set(OPENEXR_LIBPATH ${OPENEXR}/lib)
|
||||
|
||||
# TODO, gives linking errors, force off
|
||||
set(WITH_IMAGE_OPENEXR OFF)
|
||||
endif()
|
||||
|
||||
if(WITH_IMAGE_TIFF)
|
||||
|
37
doc/python_api/examples/bge.constraints.py
Normal file
37
doc/python_api/examples/bge.constraints.py
Normal file
@ -0,0 +1,37 @@
|
||||
"""
|
||||
Basic Physics Constraint
|
||||
++++++++++++++++++++++
|
||||
Example of how to create a hinge Physics Constraint between two objects.
|
||||
"""
|
||||
from bge import logic
|
||||
from bge import constraints
|
||||
|
||||
# get object list
|
||||
objects = logic.getCurrentScene().objects
|
||||
|
||||
# get object named Object1 and Object 2
|
||||
object_1 = objects["Object1"]
|
||||
object_2 = objects["Object2"]
|
||||
|
||||
# want to use Edge constraint type
|
||||
constraint_type = 2
|
||||
|
||||
# get Object1 and Object2 physics IDs
|
||||
physics_id_1 = object_1.getPhysicsId()
|
||||
physics_id_2 = object_2.getPhysicsId()
|
||||
|
||||
# Use bottom right edge of Object1 for hinge position
|
||||
edge_position_x = 1.0
|
||||
edge_position_y = 0.0
|
||||
edge_position_z = -1.0
|
||||
|
||||
# use Object1 y axis for angle to point hinge
|
||||
edge_angle_x = 0.0
|
||||
edge_angle_y = 1.0
|
||||
edge_angle_z = 0.0
|
||||
|
||||
# create an edge constraint
|
||||
constraints.createConstraint( physics_id_1, physics_id_2,
|
||||
constraint_type,
|
||||
edge_position_x, edge_position_y, edge_position_z,
|
||||
edge_angle_x, edge_angle_y, edge_angle_z )
|
@ -5,7 +5,6 @@ Example of how to replace a texture in game with an external image.
|
||||
createTexture() and removeTexture() are to be called from a module Python
|
||||
Controller.
|
||||
"""
|
||||
import bge
|
||||
from bge import logic
|
||||
from bge import texture
|
||||
|
||||
@ -14,7 +13,7 @@ def createTexture(cont):
|
||||
object = cont.owner
|
||||
|
||||
# get the reference pointer (ID) of the internal texture
|
||||
ID = VT.materialID(obj, 'IMoriginal.png')
|
||||
ID = texture.materialID(obj, 'IMoriginal.png')
|
||||
|
||||
# create a texture object
|
||||
object_texture = texture.Texture(object, ID)
|
||||
|
@ -5,7 +5,6 @@ Blender Game Engine example of using the blf module. For this module to work we
|
||||
need to use the OpenGL wrapper :class:`~bgl` as well.
|
||||
"""
|
||||
# import game engine modules
|
||||
import bge
|
||||
from bge import render
|
||||
from bge import logic
|
||||
# import stand alone modules
|
||||
|
@ -61,10 +61,10 @@ bpy.utils.register_class(CustomRenderEngine)
|
||||
# Otherwise most of the UI will be empty when the engine is selected.
|
||||
# In this example, we need to see the main render image button and
|
||||
# the material preview panel.
|
||||
import properties_render
|
||||
from bl_ui import properties_render
|
||||
properties_render.RENDER_PT_render.COMPAT_ENGINES.add('custom_renderer')
|
||||
del properties_render
|
||||
|
||||
import properties_material
|
||||
from bl_ui import properties_material
|
||||
properties_material.MATERIAL_PT_preview.COMPAT_ENGINES.add('custom_renderer')
|
||||
del properties_material
|
||||
|
199
doc/python_api/rst/bge.constraints.rst
Normal file
199
doc/python_api/rst/bge.constraints.rst
Normal file
@ -0,0 +1,199 @@
|
||||
|
||||
Game Engine bge.constraints Module
|
||||
==================================
|
||||
|
||||
.. note::
|
||||
This documentation is still very weak, and needs some help!
|
||||
|
||||
.. function:: createConstraint([obj1, [obj2, [restLength, [restitution, [damping]]]]])
|
||||
|
||||
Creates a constraint.
|
||||
|
||||
:arg obj1: first object on Constraint
|
||||
:type obj1: :class:'bge.types.KX_GameObject' #I think, there is no error when I use one
|
||||
|
||||
:arg obj2: second object on Constraint
|
||||
:type obj2: :class:'bge.types.KX_GameObject' #too
|
||||
|
||||
:arg restLength: #to be filled
|
||||
:type restLength: float
|
||||
|
||||
:arg restitution: #to be filled
|
||||
:type restitution: float
|
||||
|
||||
:arg damping: #to be filled
|
||||
:type damping: float
|
||||
|
||||
.. attribute:: error
|
||||
|
||||
Simbolic constant string that indicates error.
|
||||
|
||||
.. function:: exportBulletFile(filename)
|
||||
|
||||
export a .bullet file
|
||||
|
||||
:arg filename: File name
|
||||
:type filename: string
|
||||
|
||||
.. function:: getAppliedImpulse(constraintId)
|
||||
|
||||
:arg constraintId: The id of the constraint.
|
||||
:type constraintId: int
|
||||
|
||||
:return: the most recent applied impulse.
|
||||
:rtype: float
|
||||
|
||||
.. function:: getVehicleConstraint(constraintId)
|
||||
|
||||
:arg constraintId: The id of the vehicle constraint.
|
||||
:type constraintId: int
|
||||
|
||||
:return: a vehicle constraint object.
|
||||
:rtype: :class:'KX_VehicleWrapper'
|
||||
|
||||
.. function:: removeConstraint(constraintId)
|
||||
|
||||
Removes a constraint.
|
||||
|
||||
:arg constraintId: The id of the constraint to be removed.
|
||||
:type constraintId: int
|
||||
|
||||
.. function:: setCcdMode(ccdMode)
|
||||
|
||||
..note::
|
||||
Very experimental, not recommended
|
||||
|
||||
Sets the CCD mode in the Physics Environment.
|
||||
|
||||
:arg ccdMode: The new CCD mode.
|
||||
:type ccdMode: int
|
||||
|
||||
.. function:: setContactBreakingTreshold(breakingTreshold)
|
||||
|
||||
.. note::
|
||||
Reasonable default is 0.02 (if units are meters)
|
||||
|
||||
Sets the contact breaking treshold in the Physics Environment.
|
||||
|
||||
:arg breakingTreshold: The new contact breaking treshold.
|
||||
:type breakingTreshold: float
|
||||
|
||||
.. function:: setDeactivationAngularTreshold(angularTreshold)
|
||||
|
||||
Sets the deactivation angular treshold.
|
||||
|
||||
:arg angularTreshold: New deactivation angular treshold.
|
||||
:type angularTreshold: float
|
||||
|
||||
.. function:: setDeactivationLinearTreshold(linearTreshold)
|
||||
|
||||
Sets the deactivation linear treshold.
|
||||
|
||||
:arg linearTreshold: New deactivation linear treshold.
|
||||
:type linearTreshold: float
|
||||
|
||||
.. function:: setDeactivationTime(time)
|
||||
|
||||
Sets the time after which a resting rigidbody gets deactived.
|
||||
|
||||
:arg time: The deactivation time.
|
||||
:type time: float
|
||||
|
||||
.. function:: setDebugMode(mode)
|
||||
|
||||
Sets the debug mode.
|
||||
|
||||
Debug modes:
|
||||
- No debug: 0
|
||||
- Draw wireframe: 1
|
||||
- Draw Aabb: 2 #What's Aabb?
|
||||
- Draw freatures text: 4
|
||||
- Draw contact points: 8
|
||||
- No deactivation: 16
|
||||
- No help text: 32
|
||||
- Draw text: 64
|
||||
- Profile timings: 128
|
||||
- Enable sat comparision: 256
|
||||
- Disable Bullet LCP: 512
|
||||
- Enable CCD: 1024
|
||||
- Draw Constraints: #(1 << 11) = ?
|
||||
- Draw Constraint Limits: #(1 << 12) = ?
|
||||
- Fast Wireframe: #(1 << 13) = ?
|
||||
|
||||
:arg mode: The new debug mode.
|
||||
:type mode: int
|
||||
|
||||
.. function:: setGravity(x, y, z)
|
||||
|
||||
Sets the gravity force.
|
||||
|
||||
:arg x: Gravity X force.
|
||||
:type x: float
|
||||
|
||||
:arg y: Gravity Y force.
|
||||
:type y: float
|
||||
|
||||
:arg z: Gravity Z force.
|
||||
:type z: float
|
||||
|
||||
.. function:: setLinearAirDamping(damping)
|
||||
|
||||
Not implemented.
|
||||
|
||||
.. function:: setNumIterations(numiter)
|
||||
|
||||
Sets the number of iterations for an iterative constraint solver.
|
||||
|
||||
:arg numiter: New number of iterations.
|
||||
:type numiter: int
|
||||
|
||||
.. function:: setNumTimeSubSteps(numsubstep)
|
||||
|
||||
Sets the number of substeps for each physics proceed. Tradeoff quality for performance.
|
||||
|
||||
:arg numsubstep: New number of substeps.
|
||||
:type numsubstep: int
|
||||
|
||||
.. function:: setSolverDamping(damping)
|
||||
|
||||
..note::
|
||||
Very experimental, not recommended
|
||||
|
||||
Sets the solver damping.
|
||||
|
||||
:arg damping: New damping for the solver.
|
||||
:type damping: float
|
||||
|
||||
.. function:: setSolverTau(tau)
|
||||
|
||||
.. note::
|
||||
Very experimental, not recommended
|
||||
|
||||
Sets the solver tau.
|
||||
|
||||
:arg tau: New tau for the solver.
|
||||
:type tau: float
|
||||
|
||||
.. function:: setSolverType(solverType)
|
||||
|
||||
.. note::
|
||||
Very experimental, not recommended
|
||||
|
||||
Sets the solver type.
|
||||
|
||||
:arg solverType: The new type of the solver.
|
||||
:type solverType: int
|
||||
|
||||
.. function:: setSorConstant(sor)
|
||||
|
||||
.. note::
|
||||
Very experimental, not recommended
|
||||
|
||||
Sets the sor constant.
|
||||
|
||||
:arg sor: New sor value.
|
||||
:type sor: float
|
||||
|
||||
.. function:: setUseEpa(epa)
|
||||
|
||||
Not implemented.
|
@ -1,5 +1,5 @@
|
||||
|
||||
Game Engine bge.events module
|
||||
Game Engine bge.events Module
|
||||
=============================
|
||||
|
||||
*****
|
||||
|
@ -3,8 +3,8 @@ Game Engine bge.texture Module
|
||||
==============================
|
||||
|
||||
.. note::
|
||||
This documentation is still very weak, and needs some help! Right now they are mostly a collection
|
||||
of the docstrings found in the bge.texture source code + some random places filled with text.
|
||||
This documentation is still very weak, and needs some help! Right now they are mostly a collection
|
||||
of the docstrings found in the bge.texture source code + some random places filled with text.
|
||||
|
||||
*****
|
||||
Intro
|
||||
@ -20,20 +20,20 @@ In addition, you can apply filters on the images before sending them to the GPU,
|
||||
|
||||
bge.texture uses FFmpeg to load images and videos. All the formats and codecs that FFmpeg supports are supported by this module, including but not limited to::
|
||||
|
||||
* AVI
|
||||
* Ogg
|
||||
* Xvid
|
||||
* Theora
|
||||
* dv1394 camera
|
||||
* video4linux capture card (this includes many webcams)
|
||||
* videoForWindows capture card (this includes many webcams)
|
||||
* JPG
|
||||
* AVI
|
||||
* Ogg
|
||||
* Xvid
|
||||
* Theora
|
||||
* dv1394 camera
|
||||
* video4linux capture card (this includes many webcams)
|
||||
* videoForWindows capture card (this includes many webcams)
|
||||
* JPG
|
||||
|
||||
The principle is simple: first you identify a texture on an existing object using
|
||||
The principle is simple: first you identify a texture on an existing object using
|
||||
the :materialID: function, then you create a new texture with dynamic content
|
||||
and swap the two textures in the GPU.
|
||||
|
||||
The GE is not aware of the substitution and continues to display the object as always,
|
||||
The GE is not aware of the substitution and continues to display the object as always,
|
||||
except that you are now in control of the texture.
|
||||
|
||||
When the texture object is deleted, the new texture is deleted and the old texture restored.
|
||||
@ -42,410 +42,508 @@ When the texture object is deleted, the new texture is deleted and the old textu
|
||||
|
||||
.. class:: VideoFFmpeg(file [, capture=-1, rate=25.0, width=0, height=0])
|
||||
|
||||
FFmpeg video source
|
||||
|
||||
.. attribute:: status
|
||||
video status
|
||||
|
||||
.. attribute:: range
|
||||
replay range
|
||||
|
||||
.. attribute:: repeat
|
||||
repeat count, -1 for infinite repeat
|
||||
|
||||
:type: int
|
||||
|
||||
.. attribute:: framerate
|
||||
frame rate
|
||||
|
||||
:type: float
|
||||
|
||||
.. attribute:: valid
|
||||
Tells if an image is available
|
||||
|
||||
:type: bool
|
||||
|
||||
.. attribute:: image
|
||||
image data
|
||||
|
||||
.. attribute:: size
|
||||
image size
|
||||
|
||||
.. attribute:: scale
|
||||
fast scale of image (near neighbour)
|
||||
|
||||
.. attribute:: flip
|
||||
flip image vertically
|
||||
|
||||
.. attribute:: filter
|
||||
pixel filter
|
||||
|
||||
.. attribute:: preseek
|
||||
number of frames of preseek
|
||||
|
||||
:type: int
|
||||
|
||||
.. attribute:: deinterlace
|
||||
deinterlace image
|
||||
|
||||
:type: bool
|
||||
|
||||
.. method:: play()
|
||||
Play (restart) video
|
||||
|
||||
.. method:: pause()
|
||||
pause video
|
||||
|
||||
.. method:: stop()
|
||||
stop video (play will replay it from start)
|
||||
|
||||
.. method:: refresh()
|
||||
Refresh video - get its status
|
||||
FFmpeg video source
|
||||
|
||||
.. attribute:: status
|
||||
|
||||
video status
|
||||
|
||||
.. attribute:: range
|
||||
|
||||
replay range
|
||||
|
||||
.. attribute:: repeat
|
||||
|
||||
repeat count, -1 for infinite repeat
|
||||
|
||||
:type: int
|
||||
|
||||
.. attribute:: framerate
|
||||
|
||||
frame rate
|
||||
|
||||
:type: float
|
||||
|
||||
.. attribute:: valid
|
||||
|
||||
Tells if an image is available
|
||||
|
||||
:type: bool
|
||||
|
||||
.. attribute:: image
|
||||
|
||||
image data
|
||||
|
||||
.. attribute:: size
|
||||
|
||||
image size
|
||||
|
||||
.. attribute:: scale
|
||||
|
||||
fast scale of image (near neighbour)
|
||||
|
||||
.. attribute:: flip
|
||||
|
||||
flip image vertically
|
||||
|
||||
.. attribute:: filter
|
||||
|
||||
pixel filter
|
||||
|
||||
.. attribute:: preseek
|
||||
|
||||
number of frames of preseek
|
||||
|
||||
:type: int
|
||||
|
||||
.. attribute:: deinterlace
|
||||
|
||||
deinterlace image
|
||||
|
||||
:type: bool
|
||||
|
||||
.. method:: play()
|
||||
|
||||
Play (restart) video
|
||||
|
||||
.. method:: pause()
|
||||
|
||||
pause video
|
||||
|
||||
.. method:: stop()
|
||||
|
||||
stop video (play will replay it from start)
|
||||
|
||||
.. method:: refresh()
|
||||
|
||||
Refresh video - get its status
|
||||
|
||||
.. class:: ImageFFmpeg(file)
|
||||
|
||||
FFmpeg image source
|
||||
|
||||
.. attribute:: status
|
||||
video status
|
||||
|
||||
.. attribute:: valid
|
||||
Tells if an image is available
|
||||
|
||||
:type: bool
|
||||
|
||||
.. attribute:: image
|
||||
image data
|
||||
|
||||
.. attribute:: size
|
||||
image size
|
||||
|
||||
.. attribute:: scale
|
||||
fast scale of image (near neighbour)
|
||||
|
||||
.. attribute:: flip
|
||||
flip image vertically
|
||||
|
||||
.. attribute:: filter
|
||||
pixel filter
|
||||
|
||||
.. method:: refresh()
|
||||
Refresh image, i.e. load it
|
||||
|
||||
.. method:: reload([newname])
|
||||
Reload image, i.e. reopen it
|
||||
|
||||
FFmpeg image source
|
||||
|
||||
.. attribute:: status
|
||||
|
||||
video status
|
||||
|
||||
.. attribute:: valid
|
||||
|
||||
Tells if an image is available
|
||||
|
||||
:type: bool
|
||||
|
||||
.. attribute:: image
|
||||
|
||||
image data
|
||||
|
||||
.. attribute:: size
|
||||
|
||||
image size
|
||||
|
||||
.. attribute:: scale
|
||||
|
||||
fast scale of image (near neighbour)
|
||||
|
||||
.. attribute:: flip
|
||||
|
||||
flip image vertically
|
||||
|
||||
.. attribute:: filter
|
||||
|
||||
pixel filter
|
||||
|
||||
.. method:: refresh()
|
||||
|
||||
Refresh image, i.e. load it
|
||||
|
||||
.. method:: reload([newname])
|
||||
|
||||
Reload image, i.e. reopen it
|
||||
|
||||
.. class:: ImageBuff()
|
||||
|
||||
Image source from image buffer
|
||||
|
||||
.. attribute:: filter
|
||||
pixel filter
|
||||
|
||||
.. attribute:: flip
|
||||
flip image vertically
|
||||
|
||||
.. attribute:: image
|
||||
image data
|
||||
|
||||
.. method:: load(imageBuffer, width, height)
|
||||
Load image from buffer
|
||||
|
||||
.. method:: plot(imageBuffer, width, height, positionX, positionY)
|
||||
update image buffer
|
||||
|
||||
.. attribute:: scale
|
||||
fast scale of image (near neighbour)
|
||||
|
||||
.. attribute:: size
|
||||
image size
|
||||
|
||||
.. attribute:: valid
|
||||
bool to tell if an image is available
|
||||
|
||||
Image source from image buffer
|
||||
|
||||
.. attribute:: filter
|
||||
|
||||
pixel filter
|
||||
|
||||
.. attribute:: flip
|
||||
|
||||
flip image vertically
|
||||
|
||||
.. attribute:: image
|
||||
|
||||
image data
|
||||
|
||||
.. method:: load(imageBuffer, width, height)
|
||||
|
||||
Load image from buffer
|
||||
|
||||
.. method:: plot(imageBuffer, width, height, positionX, positionY)
|
||||
|
||||
update image buffer
|
||||
|
||||
.. attribute:: scale
|
||||
|
||||
fast scale of image (near neighbour)
|
||||
|
||||
.. attribute:: size
|
||||
|
||||
image size
|
||||
|
||||
.. attribute:: valid
|
||||
|
||||
bool to tell if an image is available
|
||||
|
||||
.. class:: ImageMirror(scene)
|
||||
|
||||
Image source from mirror
|
||||
|
||||
.. attribute:: alpha
|
||||
use alpha in texture
|
||||
|
||||
.. attribute:: background
|
||||
background color
|
||||
|
||||
.. attribute:: capsize
|
||||
size of render area
|
||||
|
||||
.. attribute:: clip
|
||||
clipping distance
|
||||
|
||||
.. attribute:: filter
|
||||
pixel filter
|
||||
|
||||
.. attribute:: flip
|
||||
flip image vertically
|
||||
|
||||
.. attribute:: image
|
||||
image data
|
||||
|
||||
.. method:: refresh(imageMirror)
|
||||
Refresh image - invalidate its current content
|
||||
|
||||
.. attribute:: scale
|
||||
fast scale of image (near neighbour)
|
||||
|
||||
.. attribute:: size
|
||||
image size
|
||||
|
||||
.. attribute:: valid
|
||||
bool to tell if an image is available
|
||||
|
||||
.. attribute:: whole
|
||||
use whole viewport to render
|
||||
|
||||
Image source from mirror
|
||||
|
||||
.. attribute:: alpha
|
||||
|
||||
use alpha in texture
|
||||
|
||||
.. attribute:: background
|
||||
|
||||
background color
|
||||
|
||||
.. attribute:: capsize
|
||||
|
||||
size of render area
|
||||
|
||||
.. attribute:: clip
|
||||
|
||||
clipping distance
|
||||
|
||||
.. attribute:: filter
|
||||
|
||||
pixel filter
|
||||
|
||||
.. attribute:: flip
|
||||
|
||||
flip image vertically
|
||||
|
||||
.. attribute:: image
|
||||
|
||||
image data
|
||||
|
||||
.. method:: refresh(imageMirror)
|
||||
|
||||
Refresh image - invalidate its current content
|
||||
|
||||
.. attribute:: scale
|
||||
|
||||
fast scale of image (near neighbour)
|
||||
|
||||
.. attribute:: size
|
||||
|
||||
image size
|
||||
|
||||
.. attribute:: valid
|
||||
|
||||
bool to tell if an image is available
|
||||
|
||||
.. attribute:: whole
|
||||
|
||||
use whole viewport to render
|
||||
|
||||
.. class:: ImageMix()
|
||||
|
||||
Image mixer
|
||||
|
||||
.. attribute:: filter
|
||||
pixel filter
|
||||
|
||||
.. attribute:: flip
|
||||
flip image vertically
|
||||
|
||||
.. method:: getSource(imageMix)
|
||||
get image source
|
||||
|
||||
.. method:: getWeight(imageMix)
|
||||
get image source weight
|
||||
|
||||
.. attribute:: image
|
||||
image data
|
||||
|
||||
.. method:: refresh(imageMix)
|
||||
Refresh image - invalidate its current content
|
||||
|
||||
.. attribute:: scale
|
||||
fast scale of image (near neighbour)
|
||||
|
||||
.. method:: setSource(imageMix)
|
||||
set image source
|
||||
|
||||
.. method:: setWeight(imageMix)
|
||||
set image source weight
|
||||
|
||||
.. attribute:: valid
|
||||
bool to tell if an image is available
|
||||
|
||||
Image mixer
|
||||
|
||||
.. attribute:: filter
|
||||
|
||||
pixel filter
|
||||
|
||||
.. attribute:: flip
|
||||
|
||||
flip image vertically
|
||||
|
||||
.. method:: getSource(imageMix)
|
||||
|
||||
get image source
|
||||
|
||||
.. method:: getWeight(imageMix)
|
||||
|
||||
get image source weight
|
||||
|
||||
|
||||
.. attribute:: image
|
||||
|
||||
image data
|
||||
|
||||
.. method:: refresh(imageMix)
|
||||
|
||||
Refresh image - invalidate its current content
|
||||
|
||||
.. attribute:: scale
|
||||
|
||||
fast scale of image (near neighbour)
|
||||
|
||||
.. method:: setSource(imageMix)
|
||||
|
||||
set image source
|
||||
|
||||
.. method:: setWeight(imageMix)
|
||||
|
||||
set image source weight
|
||||
|
||||
.. attribute:: valid
|
||||
|
||||
bool to tell if an image is available
|
||||
|
||||
.. class:: ImageRender(scene, camera)
|
||||
|
||||
Image source from render
|
||||
|
||||
.. attribute:: alpha
|
||||
use alpha in texture
|
||||
|
||||
.. attribute:: background
|
||||
background color
|
||||
|
||||
.. attribute:: capsize
|
||||
size of render area
|
||||
|
||||
.. attribute:: filter
|
||||
pixel filter
|
||||
|
||||
.. attribute:: flip
|
||||
flip image vertically
|
||||
|
||||
.. attribute:: image
|
||||
image data
|
||||
|
||||
.. method:: refresh(imageRender)
|
||||
Refresh image - invalidate its current content
|
||||
|
||||
.. attribute:: scale
|
||||
fast scale of image (near neighbour)
|
||||
|
||||
.. attribute:: size
|
||||
image size
|
||||
|
||||
.. attribute:: valid
|
||||
bool to tell if an image is available
|
||||
|
||||
.. attribute:: whole
|
||||
use whole viewport to render
|
||||
|
||||
Image source from render
|
||||
|
||||
.. attribute:: alpha
|
||||
|
||||
use alpha in texture
|
||||
|
||||
.. attribute:: background
|
||||
|
||||
background color
|
||||
|
||||
.. attribute:: capsize
|
||||
|
||||
size of render area
|
||||
|
||||
.. attribute:: filter
|
||||
|
||||
pixel filter
|
||||
|
||||
.. attribute:: flip
|
||||
|
||||
flip image vertically
|
||||
|
||||
.. attribute:: image
|
||||
|
||||
image data
|
||||
|
||||
.. method:: refresh(imageRender)
|
||||
|
||||
Refresh image - invalidate its current content
|
||||
|
||||
.. attribute:: scale
|
||||
|
||||
fast scale of image (near neighbour)
|
||||
|
||||
.. attribute:: size
|
||||
|
||||
image size
|
||||
|
||||
.. attribute:: valid
|
||||
|
||||
bool to tell if an image is available
|
||||
|
||||
.. attribute:: whole
|
||||
|
||||
use whole viewport to render
|
||||
|
||||
.. class:: ImageViewport()
|
||||
|
||||
Image source from viewport
|
||||
|
||||
.. attribute:: alpha
|
||||
use alpha in texture
|
||||
|
||||
.. attribute:: capsize
|
||||
size of viewport area being captured
|
||||
|
||||
.. attribute:: filter
|
||||
pixel filter
|
||||
|
||||
.. attribute:: flip
|
||||
flip image vertically
|
||||
|
||||
.. attribute:: image
|
||||
image data
|
||||
|
||||
.. attribute:: position
|
||||
upper left corner of captured area
|
||||
|
||||
.. method:: refresh(imageViewport)
|
||||
Refresh image - invalidate its current content
|
||||
|
||||
.. attribute:: scale
|
||||
fast scale of image (near neighbour)
|
||||
|
||||
.. attribute:: size
|
||||
image size
|
||||
|
||||
.. attribute:: valid
|
||||
bool to tell if an image is available
|
||||
|
||||
.. attribute:: whole
|
||||
use whole viewport to capture
|
||||
|
||||
Image source from viewport
|
||||
|
||||
.. attribute:: alpha
|
||||
|
||||
use alpha in texture
|
||||
|
||||
.. attribute:: capsize
|
||||
|
||||
size of viewport area being captured
|
||||
|
||||
.. attribute:: filter
|
||||
|
||||
pixel filter
|
||||
|
||||
.. attribute:: flip
|
||||
|
||||
flip image vertically
|
||||
|
||||
.. attribute:: image
|
||||
|
||||
image data
|
||||
|
||||
.. attribute:: position
|
||||
|
||||
upper left corner of captured area
|
||||
|
||||
.. method:: refresh(imageViewport)
|
||||
|
||||
Refresh image - invalidate its current content
|
||||
|
||||
.. attribute:: scale
|
||||
|
||||
fast scale of image (near neighbour)
|
||||
|
||||
.. attribute:: size
|
||||
|
||||
image size
|
||||
|
||||
.. attribute:: valid
|
||||
|
||||
bool to tell if an image is available
|
||||
|
||||
.. attribute:: whole
|
||||
|
||||
use whole viewport to capture
|
||||
|
||||
.. class:: Texture(gameObj)
|
||||
|
||||
Texture objects
|
||||
|
||||
.. attribute:: bindId
|
||||
OpenGL Bind Name
|
||||
|
||||
.. method:: close(texture)
|
||||
Close dynamic texture and restore original
|
||||
|
||||
.. attribute:: mipmap
|
||||
mipmap texture
|
||||
|
||||
.. method:: refresh(texture)
|
||||
Refresh texture from source
|
||||
|
||||
.. attribute:: source
|
||||
source of texture
|
||||
|
||||
Texture objects
|
||||
|
||||
.. attribute:: bindId
|
||||
|
||||
OpenGL Bind Name
|
||||
|
||||
.. method:: close(texture)
|
||||
|
||||
Close dynamic texture and restore original
|
||||
|
||||
.. attribute:: mipmap
|
||||
|
||||
mipmap texture
|
||||
|
||||
.. method:: refresh(texture)
|
||||
|
||||
Refresh texture from source
|
||||
|
||||
.. attribute:: source
|
||||
|
||||
source of texture
|
||||
|
||||
.. class:: FilterBGR24()
|
||||
|
||||
Source filter BGR24 objects
|
||||
|
||||
Source filter BGR24 objects
|
||||
|
||||
.. class:: FilterBlueScreen()
|
||||
|
||||
Filter for Blue Screen objects
|
||||
|
||||
.. attribute:: color
|
||||
blue screen color
|
||||
|
||||
.. attribute:: limits
|
||||
blue screen color limits
|
||||
|
||||
.. attribute:: previous
|
||||
previous pixel filter
|
||||
|
||||
Filter for Blue Screen objects
|
||||
|
||||
.. attribute:: color
|
||||
|
||||
blue screen color
|
||||
|
||||
.. attribute:: limits
|
||||
|
||||
blue screen color limits
|
||||
|
||||
.. attribute:: previous
|
||||
|
||||
previous pixel filter
|
||||
|
||||
.. class:: FilterColor()
|
||||
|
||||
Filter for color calculations
|
||||
|
||||
.. attribute:: matrix
|
||||
matrix [4][5] for color calculation
|
||||
|
||||
.. attribute:: previous
|
||||
previous pixel filter
|
||||
|
||||
Filter for color calculations
|
||||
|
||||
.. attribute:: matrix
|
||||
|
||||
matrix [4][5] for color calculation
|
||||
|
||||
.. attribute:: previous
|
||||
|
||||
previous pixel filter
|
||||
|
||||
.. class:: FilterGray()
|
||||
|
||||
Filter for gray scale effect
|
||||
|
||||
.. attribute:: previous
|
||||
previous pixel filter
|
||||
|
||||
Filter for gray scale effect
|
||||
|
||||
.. attribute:: previous
|
||||
|
||||
previous pixel filter
|
||||
|
||||
.. class:: FilterLevel()
|
||||
|
||||
Filter for levels calculations
|
||||
|
||||
.. attribute:: levels
|
||||
levels matrix [4] (min, max)
|
||||
|
||||
.. attribute:: previous
|
||||
previous pixel filter
|
||||
|
||||
Filter for levels calculations
|
||||
|
||||
.. attribute:: levels
|
||||
|
||||
levels matrix [4] (min, max)
|
||||
|
||||
.. attribute:: previous
|
||||
|
||||
previous pixel filter
|
||||
|
||||
.. class:: FilterNormal()
|
||||
|
||||
Filter for Blue Screen objects
|
||||
|
||||
.. attribute:: colorIdx
|
||||
index of color used to calculate normal (0 - red, 1 - green, 2 - blue)
|
||||
|
||||
.. attribute:: depth
|
||||
depth of relief
|
||||
|
||||
.. attribute:: previous
|
||||
previous pixel filter
|
||||
|
||||
Filter for Blue Screen objects
|
||||
|
||||
.. attribute:: colorIdx
|
||||
|
||||
index of color used to calculate normal (0 - red, 1 - green, 2 - blue)
|
||||
|
||||
.. attribute:: depth
|
||||
|
||||
depth of relief
|
||||
|
||||
.. attribute:: previous
|
||||
|
||||
previous pixel filter
|
||||
|
||||
.. class:: FilterRGB24()
|
||||
|
||||
Returns a new input filter object to be used with :class:'ImageBuff' object when the image passed
|
||||
to the ImageBuff.load() function has the 3-bytes pixel format BGR.
|
||||
|
||||
Returns a new input filter object to be used with :class:`ImageBuff` object when the image passed
|
||||
to the ImageBuff.load() function has the 3-bytes pixel format BGR.
|
||||
|
||||
.. class:: FilterRGBA32()
|
||||
|
||||
Source filter RGBA32 objects
|
||||
|
||||
Source filter RGBA32 objects
|
||||
|
||||
.. function:: getLastError()
|
||||
Last error that occurred in a bge.texture function.
|
||||
|
||||
:return: the description of the last error occurred in a bge.texture function.
|
||||
:rtype: string
|
||||
|
||||
|
||||
Last error that occurred in a bge.texture function.
|
||||
|
||||
:return: the description of the last error occurred in a bge.texture function.
|
||||
:rtype: string
|
||||
|
||||
.. function:: imageToArray(image,mode)
|
||||
Returns a :class:`~bgl.buffer` corresponding to the current image stored in a texture source object.
|
||||
|
||||
:arg image: Image source object.
|
||||
:type image: object of type :class:'VideoFFmpeg', :class:'ImageFFmpeg', :class:'ImageBuff', :class:'ImageMix', :class:'ImageRender', :class:'ImageMirror' or :class:'ImageViewport'
|
||||
:arg mode: optional argument representing the pixel format.
|
||||
| You can use the characters R, G, B for the 3 color channels, A for the alpha channel,
|
||||
| 0 to force a fixed 0 color channel and 1 to force a fixed 255 color channel.
|
||||
| Example: "BGR" will return 3 bytes per pixel with the Blue, Green and Red channels in that order.
|
||||
| "RGB1" will return 4 bytes per pixel with the Red, Green, Blue channels in that order and the alpha channel forced to 255.
|
||||
| The default mode is "RGBA".
|
||||
Returns a :class:`~bgl.buffer` corresponding to the current image stored in a texture source object.
|
||||
|
||||
:arg image: Image source object.
|
||||
:type image: object of type :class:`VideoFFmpeg`, :class:`ImageFFmpeg`, :class:`ImageBuff`, :class:`ImageMix`, :class:`ImageRender`, :class:`ImageMirror` or :class:`ImageViewport`
|
||||
:arg mode: optional argument representing the pixel format.
|
||||
You can use the characters R, G, B for the 3 color channels, A for the alpha channel,
|
||||
0 to force a fixed 0 color channel and 1 to force a fixed 255 color channel.
|
||||
Example: "BGR" will return 3 bytes per pixel with the Blue, Green and Red channels in that order.
|
||||
"RGB1" will return 4 bytes per pixel with the Red, Green, Blue channels in that order and the alpha channel forced to 255.
|
||||
The default mode is "RGBA".
|
||||
|
||||
:type mode: string
|
||||
:rtype: :class:`~bgl.buffer`
|
||||
:return: A object representing the image as one dimensional array of bytes of size (pixel_size*width*height),
|
||||
line by line starting from the bottom of the image. The pixel size and format is determined by the mode
|
||||
parameter.
|
||||
|
||||
:type mode: string
|
||||
:rtype: :class:`~bgl.buffer`
|
||||
:return: A object representing the image as one dimensional array of bytes of size (pixel_size*width*height),
|
||||
line by line starting from the bottom of the image. The pixel size and format is determined by the mode
|
||||
parameter.
|
||||
|
||||
.. function materialID(object,name)
|
||||
Returns a numeric value that can be used in :class:'Texture' to create a dynamic texture.
|
||||
|
||||
The value corresponds to an internal material number that uses the texture identified
|
||||
by name. name is a string representing a texture name with IM prefix if you want to
|
||||
identify the texture directly. This method works for basic tex face and for material,
|
||||
provided the material has a texture channel using that particular texture in first
|
||||
position of the texture stack. name can also have MA prefix if you want to identify
|
||||
the texture by material. In that case the material must have a texture channel in first
|
||||
position.
|
||||
|
||||
If the object has no material that matches name, it generates a runtime error. Use try/except to catch the exception.
|
||||
|
||||
Ex: bge.texture.materialID(obj, 'IMvideo.png')
|
||||
|
||||
:arg object: the game object that uses the texture you want to make dynamic
|
||||
:type object: game object
|
||||
:arg name: name of the texture/material you want to make dynamic.
|
||||
:type name: string
|
||||
:rtype: integer
|
||||
Returns a numeric value that can be used in :class:`Texture` to create a dynamic texture.
|
||||
|
||||
The value corresponds to an internal material number that uses the texture identified
|
||||
by name. name is a string representing a texture name with IM prefix if you want to
|
||||
identify the texture directly. This method works for basic tex face and for material,
|
||||
provided the material has a texture channel using that particular texture in first
|
||||
position of the texture stack. name can also have MA prefix if you want to identify
|
||||
the texture by material. In that case the material must have a texture channel in first
|
||||
position.
|
||||
|
||||
If the object has no material that matches name, it generates a runtime error. Use try/except to catch the exception.
|
||||
|
||||
Ex: bge.texture.materialID(obj, 'IMvideo.png')
|
||||
|
||||
:arg object: the game object that uses the texture you want to make dynamic
|
||||
:type object: game object
|
||||
:arg name: name of the texture/material you want to make dynamic.
|
||||
:type name: string
|
||||
:rtype: integer
|
||||
|
||||
.. function setLogFile(filename)
|
||||
Sets the name of a text file in which runtime error messages will be written, in addition to the printing
|
||||
of the messages on the Python console. Only the runtime errors specific to the VideoTexture module
|
||||
are written in that file, ordinary runtime time errors are not written.
|
||||
|
||||
:arg filename: name of error log file
|
||||
:type filename: string
|
||||
:rtype: integer
|
||||
Sets the name of a text file in which runtime error messages will be written, in addition to the printing
|
||||
of the messages on the Python console. Only the runtime errors specific to the VideoTexture module
|
||||
are written in that file, ordinary runtime time errors are not written.
|
||||
|
||||
:arg filename: name of error log file
|
||||
:type filename: string
|
||||
:rtype: integer
|
||||
|
@ -77,9 +77,9 @@ else:
|
||||
"bpy.types", # supports filtering
|
||||
"bpy.ops", # supports filtering
|
||||
"bpy_extras",
|
||||
"bge",
|
||||
# "bge",
|
||||
"aud",
|
||||
#"bgl",
|
||||
"bgl",
|
||||
"blf",
|
||||
"mathutils",
|
||||
"mathutils.geometry",
|
||||
@ -989,6 +989,7 @@ def rna2sphinx(BASEPATH):
|
||||
fw("\n")
|
||||
fw("* `Quickstart Intro <http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro>`_ if you are new to scripting in blender and want to get you're feet wet!\n")
|
||||
fw("* `Blender/Python Overview <http://wiki.blender.org/index.php/Dev:2.5/Py/API/Overview>`_ for a more complete explanation of python integration in blender\n")
|
||||
fw("\n")
|
||||
|
||||
fw("===================\n")
|
||||
fw("Application Modules\n")
|
||||
@ -1048,7 +1049,9 @@ def rna2sphinx(BASEPATH):
|
||||
fw(" bge.types.rst\n\n")
|
||||
fw(" bge.logic.rst\n\n")
|
||||
fw(" bge.render.rst\n\n")
|
||||
fw(" bge.texture.rst\n\n")
|
||||
fw(" bge.events.rst\n\n")
|
||||
fw(" bge.constraints.rst\n\n")
|
||||
|
||||
# rna generated change log
|
||||
fw("========\n")
|
||||
@ -1182,7 +1185,9 @@ def rna2sphinx(BASEPATH):
|
||||
shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.types.rst"), BASEPATH)
|
||||
shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.logic.rst"), BASEPATH)
|
||||
shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.render.rst"), BASEPATH)
|
||||
shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.texture.rst"), BASEPATH)
|
||||
shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.events.rst"), BASEPATH)
|
||||
shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.constraints.rst"), BASEPATH)
|
||||
|
||||
shutil.copy2(os.path.join(BASEPATH, "..", "rst", "change_log.rst"), BASEPATH)
|
||||
|
||||
|
@ -218,8 +218,9 @@ typedef enum {
|
||||
GHOST_kStandardCursorBottomLeftCorner,
|
||||
GHOST_kStandardCursorCopy,
|
||||
GHOST_kStandardCursorCustom,
|
||||
GHOST_kStandardCursorNumCursors,
|
||||
GHOST_kStandardCursorPencil
|
||||
GHOST_kStandardCursorPencil,
|
||||
|
||||
GHOST_kStandardCursorNumCursors
|
||||
} GHOST_TStandardCursor;
|
||||
|
||||
|
||||
|
@ -76,6 +76,9 @@
|
||||
#include <stdio.h> // for fprintf only
|
||||
#include <cstdlib> // for exit
|
||||
|
||||
static GHOST_TKey
|
||||
convertXKey(KeySym key);
|
||||
|
||||
typedef struct NDOFPlatformInfo {
|
||||
Display *display;
|
||||
Window window;
|
||||
@ -923,35 +926,20 @@ getButtons(
|
||||
int rx,ry,wx,wy;
|
||||
unsigned int mask_return;
|
||||
|
||||
if (XQueryPointer(
|
||||
m_display,
|
||||
RootWindow(m_display,DefaultScreen(m_display)),
|
||||
&root_return,
|
||||
&child_return,
|
||||
&rx,&ry,
|
||||
&wx,&wy,
|
||||
&mask_return
|
||||
) == False) {
|
||||
if (XQueryPointer(m_display,
|
||||
RootWindow(m_display,DefaultScreen(m_display)),
|
||||
&root_return,
|
||||
&child_return,
|
||||
&rx,&ry,
|
||||
&wx,&wy,
|
||||
&mask_return) == True)
|
||||
{
|
||||
buttons.set(GHOST_kButtonMaskLeft, (mask_return & Button1Mask) != 0);
|
||||
buttons.set(GHOST_kButtonMaskMiddle, (mask_return & Button2Mask) != 0);
|
||||
buttons.set(GHOST_kButtonMaskRight, (mask_return & Button3Mask) != 0);
|
||||
}
|
||||
else {
|
||||
return GHOST_kFailure;
|
||||
} else {
|
||||
|
||||
if (mask_return & Button1Mask) {
|
||||
buttons.set(GHOST_kButtonMaskLeft,true);
|
||||
} else {
|
||||
buttons.set(GHOST_kButtonMaskLeft,false);
|
||||
}
|
||||
|
||||
if (mask_return & Button2Mask) {
|
||||
buttons.set(GHOST_kButtonMaskMiddle,true);
|
||||
} else {
|
||||
buttons.set(GHOST_kButtonMaskMiddle,false);
|
||||
}
|
||||
|
||||
if (mask_return & Button3Mask) {
|
||||
buttons.set(GHOST_kButtonMaskRight,true);
|
||||
} else {
|
||||
buttons.set(GHOST_kButtonMaskRight,false);
|
||||
}
|
||||
}
|
||||
|
||||
return GHOST_kSuccess;
|
||||
@ -1056,11 +1044,9 @@ generateWindowExposeEvents(
|
||||
|
||||
#define GXMAP(k,x,y) case x: k = y; break;
|
||||
|
||||
GHOST_TKey
|
||||
GHOST_SystemX11::
|
||||
convertXKey(
|
||||
KeySym key
|
||||
){
|
||||
static GHOST_TKey
|
||||
convertXKey(KeySym key)
|
||||
{
|
||||
GHOST_TKey type;
|
||||
|
||||
if ((key >= XK_A) && (key <= XK_Z)) {
|
||||
|
@ -300,12 +300,6 @@ private :
|
||||
bool
|
||||
generateWindowExposeEvents(
|
||||
);
|
||||
|
||||
GHOST_TKey
|
||||
convertXKey(
|
||||
KeySym key
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -58,11 +58,39 @@ suffix_relpaths(SRC_NEW "${SRC}" "../../guardedalloc/")
|
||||
include_directories(${INC_NEW})
|
||||
add_library(guardedalloc_lib ${SRC_NEW})
|
||||
|
||||
# blenfont
|
||||
include(${CMAKE_SOURCE_DIR}/../../../source/blender/blenfont/CMakeLists.txt)
|
||||
suffix_relpaths(INC_NEW "${INC}" "../../../source/blender/blenfont/")
|
||||
suffix_relpaths(SRC_NEW "${SRC}" "../../../source/blender/blenfont/")
|
||||
include_directories(${INC_NEW})
|
||||
add_library(blenfont_lib ${SRC_NEW})
|
||||
|
||||
# grr, blenfont needs BLI
|
||||
include_directories(
|
||||
"../../../source/blender/blenlib"
|
||||
"../../../source/blender/blenloader"
|
||||
)
|
||||
add_library(bli_lib
|
||||
"../../../source/blender/blenlib/intern/fileops.c"
|
||||
"../../../source/blender/blenlib/intern/rct.c"
|
||||
"../../../source/blender/blenlib/intern/string.c"
|
||||
"../../../source/blender/blenlib/intern/listbase.c"
|
||||
"../../../source/blender/blenlib/intern/storage.c"
|
||||
"../../../source/blender/blenlib/intern/path_util.c"
|
||||
"../../../source/blender/blenlib/intern/BLI_dynstr.c"
|
||||
"../../../source/blender/blenlib/intern/BLI_linklist.c"
|
||||
"../../../source/blender/blenlib/intern/BLI_memarena.c"
|
||||
)
|
||||
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
find_package(Freetype REQUIRED)
|
||||
|
||||
include_directories(${CMAKE_SOURCE_DIR}/../)
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
include_directories(${FREETYPE_INCLUDE_DIRS})
|
||||
include_directories(${CMAKE_SOURCE_DIR}/../../../source/blender/blenfont)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
find_package(X11 REQUIRED)
|
||||
@ -105,6 +133,7 @@ target_link_libraries(gears_cpp
|
||||
|
||||
# MultiTest (C)
|
||||
add_executable(multitest_c
|
||||
${CMAKE_SOURCE_DIR}/../../../source/blender/editors/datafiles/bfont.ttf.c
|
||||
${CMAKE_SOURCE_DIR}/multitest/Basic.c
|
||||
${CMAKE_SOURCE_DIR}/multitest/EventToBuf.c
|
||||
${CMAKE_SOURCE_DIR}/multitest/MultiTest.c
|
||||
@ -114,10 +143,13 @@ add_executable(multitest_c
|
||||
)
|
||||
|
||||
target_link_libraries(multitest_c
|
||||
blenfont_lib
|
||||
bli_lib
|
||||
ghost_lib
|
||||
string_lib
|
||||
guardedalloc_lib
|
||||
${OPENGL_gl_LIBRARY}
|
||||
${OPENGL_glu_LIBRARY}
|
||||
${FREETYPE_LIBRARY}
|
||||
${PLATFORM_LINKLIBS}
|
||||
)
|
||||
|
@ -42,7 +42,18 @@
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "GHOST_C-api.h"
|
||||
#include "BMF_Api.h"
|
||||
|
||||
#ifdef USE_BMF
|
||||
# include "BMF_Api.h"
|
||||
#else
|
||||
# include "BLF_api.h"
|
||||
extern int datatoc_bfont_ttf_size;
|
||||
extern char datatoc_bfont_ttf[];
|
||||
|
||||
// XXX, bad, but BLI uses these
|
||||
char bprogname[160]= "";
|
||||
char U[1024]= {0};
|
||||
#endif
|
||||
|
||||
#include "Util.h"
|
||||
#include "Basic.h"
|
||||
@ -291,7 +302,7 @@ MainWindow *mainwindow_new(MultiTestApp *app) {
|
||||
|
||||
win= GHOST_CreateWindow(sys, "MultiTest:Main", 40, 40, 400, 400,
|
||||
GHOST_kWindowStateNormal, GHOST_kDrawingContextTypeOpenGL,
|
||||
FALSE);
|
||||
FALSE, FALSE);
|
||||
|
||||
if (win) {
|
||||
MainWindow *mw= MEM_callocN(sizeof(*mw), "mainwindow_new");
|
||||
@ -324,8 +335,12 @@ struct _LoggerWindow {
|
||||
MultiTestApp *app;
|
||||
|
||||
GHOST_WindowHandle win;
|
||||
|
||||
|
||||
#ifdef USE_BMF
|
||||
BMF_Font *font;
|
||||
#else
|
||||
int font;
|
||||
#endif
|
||||
int fonttexid;
|
||||
int fontheight;
|
||||
|
||||
@ -429,18 +444,26 @@ static void loggerwindow_do_draw(LoggerWindow *lw) {
|
||||
char *line= lw->loglines[(lw->nloglines-1)-(i+startline)];
|
||||
int x_pos= lw->textarea[0][0] + 4;
|
||||
int y_pos= lw->textarea[0][1] + 4 + i*lw->fontheight;
|
||||
|
||||
|
||||
#ifdef USE_BMF
|
||||
if (lw->fonttexid==-1) {
|
||||
glRasterPos2i(x_pos, y_pos);
|
||||
BMF_DrawString(lw->font, line);
|
||||
} else {
|
||||
BMF_DrawStringTexture(lw->font, line, x_pos, y_pos, 0.0);
|
||||
}
|
||||
#else
|
||||
BLF_position(lw->font, x_pos, y_pos, 0.0);
|
||||
BLF_draw(lw->font, line, 256); // XXX
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef USE_BMF
|
||||
if (lw->fonttexid!=-1) {
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
#endif
|
||||
|
||||
GHOST_SwapWindowBuffers(lw->win);
|
||||
}
|
||||
@ -531,19 +554,25 @@ LoggerWindow *loggerwindow_new(MultiTestApp *app) {
|
||||
GHOST_GetMainDisplayDimensions(sys, &screensize[0], &screensize[1]);
|
||||
win= GHOST_CreateWindow(sys, "MultiTest:Logger", 40, screensize[1]-432,
|
||||
800, 300, GHOST_kWindowStateNormal,
|
||||
GHOST_kDrawingContextTypeOpenGL, FALSE);
|
||||
GHOST_kDrawingContextTypeOpenGL, FALSE, FALSE);
|
||||
|
||||
if (win) {
|
||||
LoggerWindow *lw= MEM_callocN(sizeof(*lw), "loggerwindow_new");
|
||||
int bbox[2][2];
|
||||
lw->app= app;
|
||||
lw->win= win;
|
||||
|
||||
|
||||
#ifdef USE_BMF
|
||||
lw->font= BMF_GetFont(BMF_kScreen12);
|
||||
lw->fonttexid= BMF_GetFontTexture(lw->font);
|
||||
|
||||
BMF_GetBoundingBox(lw->font, &bbox[0][0], &bbox[0][1], &bbox[1][0], &bbox[1][1]);
|
||||
lw->fontheight= rect_height(bbox);
|
||||
#else
|
||||
lw->font= BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
|
||||
BLF_size(lw->font, 11, 72);
|
||||
lw->fontheight= BLF_height(lw->font, "A_");
|
||||
#endif
|
||||
|
||||
lw->nloglines= lw->logsize= 0;
|
||||
lw->loglines= MEM_mallocN(sizeof(*lw->loglines)*lw->nloglines, "loglines");
|
||||
@ -711,7 +740,7 @@ ExtraWindow *extrawindow_new(MultiTestApp *app) {
|
||||
|
||||
win= GHOST_CreateWindow(sys, "MultiTest:Extra", 500, 40, 400, 400,
|
||||
GHOST_kWindowStateNormal, GHOST_kDrawingContextTypeOpenGL,
|
||||
FALSE);
|
||||
FALSE, FALSE);
|
||||
|
||||
if (win) {
|
||||
ExtraWindow *ew= MEM_callocN(sizeof(*ew), "mainwindow_new");
|
||||
@ -786,7 +815,7 @@ static int multitest_event_handler(GHOST_EventHandle evt, GHOST_TUserDataPtr dat
|
||||
MultiTestApp *multitestapp_new(void) {
|
||||
MultiTestApp *app= MEM_mallocN(sizeof(*app), "multitestapp_new");
|
||||
GHOST_EventConsumerHandle consumer= GHOST_CreateEventConsumer(multitest_event_handler, app);
|
||||
|
||||
|
||||
app->sys= GHOST_CreateSystem();
|
||||
if (!app->sys)
|
||||
fatal("Unable to create ghost system");
|
||||
@ -850,6 +879,10 @@ void multitestapp_free(MultiTestApp *app) {
|
||||
/***/
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#ifndef USE_BMF
|
||||
BLF_init(11, 72);
|
||||
#endif
|
||||
|
||||
MultiTestApp *app= multitestapp_new();
|
||||
|
||||
multitestapp_run(app);
|
||||
|
@ -59,6 +59,7 @@ void IK_QJacobian::ArmMatrices(int dof, int task_size)
|
||||
|
||||
m_d_theta.newsize(dof);
|
||||
m_d_theta_tmp.newsize(dof);
|
||||
m_d_norm_weight.newsize(dof);
|
||||
|
||||
m_norm.newsize(dof);
|
||||
m_norm = 0.0;
|
||||
@ -111,11 +112,13 @@ void IK_QJacobian::SetBetas(int id, int, const MT_Vector3& v)
|
||||
m_beta[id+2] = v.z();
|
||||
}
|
||||
|
||||
void IK_QJacobian::SetDerivatives(int id, int dof_id, const MT_Vector3& v)
|
||||
void IK_QJacobian::SetDerivatives(int id, int dof_id, const MT_Vector3& v, MT_Scalar norm_weight)
|
||||
{
|
||||
m_jacobian[id][dof_id] = v.x()*m_weight_sqrt[dof_id];
|
||||
m_jacobian[id+1][dof_id] = v.y()*m_weight_sqrt[dof_id];
|
||||
m_jacobian[id+2][dof_id] = v.z()*m_weight_sqrt[dof_id];
|
||||
|
||||
m_d_norm_weight[dof_id] = norm_weight;
|
||||
}
|
||||
|
||||
void IK_QJacobian::Invert()
|
||||
@ -429,7 +432,7 @@ MT_Scalar IK_QJacobian::AngleUpdateNorm() const
|
||||
MT_Scalar mx = 0.0, dtheta_abs;
|
||||
|
||||
for (i = 0; i < m_d_theta.size(); i++) {
|
||||
dtheta_abs = MT_abs(m_d_theta[i]);
|
||||
dtheta_abs = MT_abs(m_d_theta[i]*m_d_norm_weight[i]);
|
||||
if (dtheta_abs > mx)
|
||||
mx = dtheta_abs;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
|
||||
// Iteratively called
|
||||
void SetBetas(int id, int size, const MT_Vector3& v);
|
||||
void SetDerivatives(int id, int dof_id, const MT_Vector3& v);
|
||||
void SetDerivatives(int id, int dof_id, const MT_Vector3& v, MT_Scalar norm_weight);
|
||||
|
||||
void Invert();
|
||||
|
||||
@ -89,6 +89,7 @@ private:
|
||||
|
||||
/// the vector of computed angle changes
|
||||
TVector m_d_theta;
|
||||
TVector m_d_norm_weight;
|
||||
|
||||
/// space required for SVD computation
|
||||
|
||||
|
@ -95,10 +95,10 @@ void IK_QPositionTask::ComputeJacobian(IK_QJacobian& jacobian)
|
||||
MT_Vector3 axis = seg->Axis(i)*m_weight;
|
||||
|
||||
if (seg->Translational())
|
||||
jacobian.SetDerivatives(m_id, seg->DoFId()+i, axis);
|
||||
jacobian.SetDerivatives(m_id, seg->DoFId()+i, axis, 1e2);
|
||||
else {
|
||||
MT_Vector3 pa = p.cross(axis);
|
||||
jacobian.SetDerivatives(m_id, seg->DoFId()+i, pa);
|
||||
jacobian.SetDerivatives(m_id, seg->DoFId()+i, pa, 1e0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -147,10 +147,10 @@ void IK_QOrientationTask::ComputeJacobian(IK_QJacobian& jacobian)
|
||||
for (i = 0; i < seg->NumberOfDoF(); i++) {
|
||||
|
||||
if (seg->Translational())
|
||||
jacobian.SetDerivatives(m_id, seg->DoFId()+i, MT_Vector3(0, 0, 0));
|
||||
jacobian.SetDerivatives(m_id, seg->DoFId()+i, MT_Vector3(0, 0, 0), 1e2);
|
||||
else {
|
||||
MT_Vector3 axis = seg->Axis(i)*m_weight;
|
||||
jacobian.SetDerivatives(m_id, seg->DoFId()+i, axis);
|
||||
jacobian.SetDerivatives(m_id, seg->DoFId()+i, axis, 1e0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -202,10 +202,10 @@ void IK_QCenterOfMassTask::JacobianSegment(IK_QJacobian& jacobian, MT_Vector3& c
|
||||
axis *= /*segment->Mass()**/m_total_mass_inv;
|
||||
|
||||
if (segment->Translational())
|
||||
jacobian.SetDerivatives(m_id, segment->DoFId()+i, axis);
|
||||
jacobian.SetDerivatives(m_id, segment->DoFId()+i, axis, 1e2);
|
||||
else {
|
||||
MT_Vector3 pa = axis.cross(p);
|
||||
jacobian.SetDerivatives(m_id, segment->DoFId()+i, pa);
|
||||
jacobian.SetDerivatives(m_id, segment->DoFId()+i, pa, 1e0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,8 +48,6 @@ def paths():
|
||||
|
||||
def modules(module_cache):
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
path_list = paths()
|
||||
|
||||
@ -173,11 +171,9 @@ def enable(module_name, default_set=True):
|
||||
:return: the loaded module or None on failier.
|
||||
:rtype: module
|
||||
"""
|
||||
# note, this still gets added to _bpy_types.TypeMap
|
||||
|
||||
import os
|
||||
import sys
|
||||
import bpy_types as _bpy_types
|
||||
import imp
|
||||
|
||||
def handle_error():
|
||||
@ -246,8 +242,6 @@ def disable(module_name, default_set=True):
|
||||
:type module_name: string
|
||||
"""
|
||||
import sys
|
||||
import bpy_types as _bpy_types
|
||||
|
||||
mod = sys.modules.get(module_name)
|
||||
|
||||
# possible this addon is from a previous session and didnt load a module this time.
|
||||
|
@ -29,7 +29,7 @@ op_as_string = ops_module.as_string
|
||||
op_get_rna = ops_module.get_rna
|
||||
|
||||
|
||||
class bpy_ops(object):
|
||||
class BPyOps(object):
|
||||
'''
|
||||
Fake module like class.
|
||||
|
||||
@ -42,7 +42,7 @@ class bpy_ops(object):
|
||||
'''
|
||||
if module.startswith('__'):
|
||||
raise AttributeError(module)
|
||||
return bpy_ops_submodule(module)
|
||||
return BPyOpsSubMod(module)
|
||||
|
||||
def __dir__(self):
|
||||
|
||||
@ -67,7 +67,7 @@ class bpy_ops(object):
|
||||
return "<module like class 'bpy.ops'>"
|
||||
|
||||
|
||||
class bpy_ops_submodule(object):
|
||||
class BPyOpsSubMod(object):
|
||||
'''
|
||||
Utility class to fake submodules.
|
||||
|
||||
@ -84,7 +84,7 @@ class bpy_ops_submodule(object):
|
||||
'''
|
||||
if func.startswith('__'):
|
||||
raise AttributeError(func)
|
||||
return bpy_ops_submodule_op(self.module, func)
|
||||
return BPyOpsSubModOp(self.module, func)
|
||||
|
||||
def __dir__(self):
|
||||
|
||||
@ -103,7 +103,7 @@ class bpy_ops_submodule(object):
|
||||
return "<module like class 'bpy.ops.%s'>" % self.module
|
||||
|
||||
|
||||
class bpy_ops_submodule_op(object):
|
||||
class BPyOpsSubModOp(object):
|
||||
'''
|
||||
Utility class to fake submodule operators.
|
||||
|
||||
@ -151,7 +151,7 @@ class bpy_ops_submodule_op(object):
|
||||
self.func = func
|
||||
|
||||
def poll(self, *args):
|
||||
C_dict, C_exec = __class__._parse_args(args)
|
||||
C_dict, C_exec = BPyOpsSubModOp._parse_args(args)
|
||||
return op_poll(self.idname_py(), C_dict, C_exec)
|
||||
|
||||
def idname(self):
|
||||
@ -170,16 +170,16 @@ class bpy_ops_submodule_op(object):
|
||||
wm = context.window_manager
|
||||
|
||||
# run to account for any rna values the user changes.
|
||||
__class__._scene_update(context)
|
||||
BPyOpsSubModOp._scene_update(context)
|
||||
|
||||
if args:
|
||||
C_dict, C_exec = __class__._parse_args(args)
|
||||
C_dict, C_exec = BPyOpsSubModOp._parse_args(args)
|
||||
ret = op_call(self.idname_py(), C_dict, kw, C_exec)
|
||||
else:
|
||||
ret = op_call(self.idname_py(), None, kw)
|
||||
|
||||
if 'FINISHED' in ret and context.window_manager == wm:
|
||||
__class__._scene_update(context)
|
||||
BPyOpsSubModOp._scene_update(context)
|
||||
|
||||
return ret
|
||||
|
||||
@ -208,4 +208,4 @@ class bpy_ops_submodule_op(object):
|
||||
return "<function bpy.ops.%s.%s at 0x%x'>" % \
|
||||
(self.module, self.func, id(self))
|
||||
|
||||
ops_fake_module = bpy_ops()
|
||||
ops_fake_module = BPyOps()
|
||||
|
@ -99,7 +99,7 @@ def load_image(imagepath,
|
||||
return _image_load(nfilepath)
|
||||
|
||||
if place_holder:
|
||||
image = bpy.data.images.new(os.path.basename(filepath), 128, 128)
|
||||
image = bpy.data.images.new(os.path.basename(imagepath), 128, 128)
|
||||
# allow the path to be resolved later
|
||||
image.filepath = imagepath
|
||||
return image
|
||||
|
@ -262,7 +262,7 @@ def path_reference(filepath, base_src, base_dst, mode='AUTO', copy_subdir="", co
|
||||
filepath_abs = filepath_cpy
|
||||
mode = 'RELATIVE'
|
||||
else:
|
||||
Excaption("invalid mode given %r" % mode)
|
||||
raise Exception("invalid mode given %r" % mode)
|
||||
|
||||
if mode == 'ABSOLUTE':
|
||||
return filepath_abs
|
||||
|
@ -212,8 +212,6 @@ def edge_loops_from_edges(mesh, edges=None):
|
||||
if not hasattr(edges, "pop"):
|
||||
edges = edges[:]
|
||||
|
||||
edge_dict = {ed.key: ed for ed in mesh.edges if ed.select}
|
||||
|
||||
while edges:
|
||||
current_edge = edges.pop()
|
||||
vert_end, vert_start = current_edge.vertices[:]
|
||||
@ -300,7 +298,7 @@ def ngon_tesselate(from_data, indices, fix_loops=True):
|
||||
if verts[i][1] == verts[i - 1][0]:
|
||||
verts.pop(i - 1)
|
||||
|
||||
fill = fill_polygon([verts])
|
||||
fill = tesselate_polygon([verts])
|
||||
|
||||
else:
|
||||
'''
|
||||
|
@ -22,7 +22,6 @@ __all__ = (
|
||||
"region_2d_to_vector_3d",
|
||||
"region_2d_to_location_3d",
|
||||
"location_3d_to_region_2d",
|
||||
"location_3d_to_region_2d",
|
||||
)
|
||||
|
||||
|
||||
|
@ -241,7 +241,7 @@ class _GenericBone:
|
||||
chain.append(child)
|
||||
else:
|
||||
if len(children_basename):
|
||||
print("multiple basenames found, this is probably not what you want!", bone.name, children_basename)
|
||||
print("multiple basenames found, this is probably not what you want!", self.name, children_basename)
|
||||
|
||||
break
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
import bpy as _bpy
|
||||
import bpyml
|
||||
from bpyml import TAG, ARGS, CHILDREN
|
||||
from types import ModuleType
|
||||
|
||||
_uilayout_rna = _bpy.types.UILayout.bl_rna
|
||||
|
||||
|
@ -114,7 +114,7 @@ def draw(layout, context, context_member, property_type, use_edit=True):
|
||||
to_dict = getattr(val, "to_dict", None)
|
||||
to_list = getattr(val, "to_list", None)
|
||||
|
||||
val_orig = val
|
||||
# val_orig = val # UNUSED
|
||||
if to_dict:
|
||||
val = to_dict()
|
||||
val_draw = str(val)
|
||||
|
@ -121,7 +121,6 @@ class ProjectEdit(bpy.types.Operator):
|
||||
|
||||
def execute(self, context):
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
EXT = "png" # could be made an option but for now ok
|
||||
|
||||
|
@ -87,8 +87,6 @@ class MeshMirrorUV(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
DIR = (self.direction == 'NEGATIVE')
|
||||
|
||||
from mathutils import Vector
|
||||
|
||||
ob = context.active_object
|
||||
is_editmode = (ob.mode == 'EDIT')
|
||||
if is_editmode:
|
||||
|
@ -98,8 +98,6 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to):
|
||||
# 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]
|
||||
|
@ -315,7 +315,7 @@ class AddPresetOperator(AddPresetBase, bpy.types.Operator):
|
||||
|
||||
@property
|
||||
def preset_subdir(self):
|
||||
return __class__.operator_path(self.operator)
|
||||
return AddPresetOperator.operator_path(self.operator)
|
||||
|
||||
@property
|
||||
def preset_values(self):
|
||||
|
@ -78,7 +78,7 @@ class PlayRenderedAnim(bpy.types.Operator):
|
||||
|
||||
preset = prefs.filepaths.animation_player_preset
|
||||
player_path = prefs.filepaths.animation_player
|
||||
file_path = bpy.path.abspath(rd.filepath)
|
||||
# file_path = bpy.path.abspath(rd.filepath) # UNUSED
|
||||
is_movie = rd.is_movie_format
|
||||
|
||||
# try and guess a command line if it doesn't exist
|
||||
|
@ -42,7 +42,6 @@ def extend(obj, operator, EXTEND_MODE):
|
||||
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):
|
||||
'''
|
||||
|
@ -406,7 +406,7 @@ def lightmap_uvpack(meshes,
|
||||
ok = False
|
||||
|
||||
# Tall boxes in groups of 2
|
||||
for d, boxes in odd_dict.items():
|
||||
for d, boxes in list(odd_dict.items()):
|
||||
if d[1] < max_int_dimension:
|
||||
#\boxes.sort(key = lambda a: len(a.children))
|
||||
while len(boxes) >= 2:
|
||||
@ -427,7 +427,7 @@ def lightmap_uvpack(meshes,
|
||||
odd_dict.setdefault((w, h), []).append(pf_parent)
|
||||
|
||||
# Even boxes in groups of 4
|
||||
for d, boxes in even_dict.items():
|
||||
for d, boxes in list(even_dict.items()):
|
||||
if d < max_int_dimension:
|
||||
boxes.sort(key=lambda a: len(a.children))
|
||||
|
||||
@ -444,7 +444,7 @@ def lightmap_uvpack(meshes,
|
||||
del even_dict
|
||||
del odd_dict
|
||||
|
||||
orig = len(pretty_faces)
|
||||
# orig = len(pretty_faces)
|
||||
|
||||
pretty_faces = [pf for pf in pretty_faces if not pf.has_parent]
|
||||
|
||||
@ -489,7 +489,10 @@ def lightmap_uvpack(meshes,
|
||||
|
||||
if PREF_APPLY_IMAGE:
|
||||
if not PREF_PACK_IN_ONE:
|
||||
image = Image.New("lightmap", PREF_IMG_PX_SIZE, PREF_IMG_PX_SIZE, 24)
|
||||
image = bpy.data.images.new(name="lightmap",
|
||||
width=PREF_IMG_PX_SIZE,
|
||||
height=PREF_IMG_PX_SIZE,
|
||||
)
|
||||
|
||||
for f in face_sel:
|
||||
# f.image = image
|
||||
@ -530,7 +533,7 @@ def unwrap(operator, context, **kwargs):
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
from bpy.props import BoolProperty, FloatProperty, IntProperty, EnumProperty
|
||||
from bpy.props import BoolProperty, FloatProperty, IntProperty
|
||||
|
||||
|
||||
class LightMapPack(bpy.types.Operator):
|
||||
|
@ -94,4 +94,5 @@ class OnionSkinButtonsPanel():
|
||||
col.prop(arm, "show_only_ghost_selected", text="Selected Only")
|
||||
|
||||
if __name__ == "__main__": # only for live edit.
|
||||
import bpy
|
||||
bpy.utils.register_module(__name__)
|
||||
|
@ -317,10 +317,7 @@ class DATA_PT_onion_skinning(OnionSkinButtonsPanel): # , bpy.types.Panel): # in
|
||||
return (context.object) and (context.armature)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
ob = context.object
|
||||
|
||||
self.draw_settings(context, ob.pose.animation_visualisation, bones=True)
|
||||
|
||||
|
||||
|
@ -122,7 +122,6 @@ class DATA_PT_curve_texture_space(CurveButtonsPanel, bpy.types.Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
ob = context.object
|
||||
curve = context.curve
|
||||
|
||||
row = layout.row()
|
||||
|
@ -34,7 +34,6 @@ class OBJECT_PT_context_object(ObjectButtonsPanel, bpy.types.Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
space = context.space_data
|
||||
ob = context.object
|
||||
|
||||
if space.use_pin_id:
|
||||
layout.template_ID(space, "pin_id")
|
||||
|
@ -208,7 +208,7 @@ class TextureSlotPanel(TextureButtonsPanel):
|
||||
return False
|
||||
|
||||
engine = context.scene.render.engine
|
||||
return TextureButtonsPanel.poll(self, context) and (engine in cls.COMPAT_ENGINES)
|
||||
return TextureButtonsPanel.poll(cls, context) and (engine in cls.COMPAT_ENGINES)
|
||||
|
||||
|
||||
# Texture Type Panels #
|
||||
|
@ -434,7 +434,6 @@ class IMAGE_PT_game_properties(bpy.types.Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
rd = context.scene.render
|
||||
sima = context.space_data
|
||||
# display even when not in game mode because these settings effect the 3d view
|
||||
return (sima and sima.image) # and (rd.engine == 'BLENDER_GAME')
|
||||
|
@ -126,7 +126,7 @@ class USERPREF_MT_appconfigs(bpy.types.Menu):
|
||||
preset_operator = "wm.appconfig_activate"
|
||||
|
||||
def draw(self, context):
|
||||
props = self.layout.operator("wm.appconfig_default", text="Blender (default)")
|
||||
self.layout.operator("wm.appconfig_default", text="Blender (default)")
|
||||
|
||||
# now draw the presets
|
||||
bpy.types.Menu.draw_preset(self, context)
|
||||
@ -987,7 +987,7 @@ class USERPREF_PT_addons(bpy.types.Panel):
|
||||
split.label(text="Warning:")
|
||||
split.label(text=' ' + info["warning"], icon='ERROR')
|
||||
|
||||
user_addon = __class__.is_user_addon(mod, user_addon_paths)
|
||||
user_addon = USERPREF_PT_addons.is_user_addon(mod, user_addon_paths)
|
||||
tot_row = bool(info["wiki_url"]) + bool(info["tracker_url"]) + bool(user_addon)
|
||||
|
||||
if tot_row:
|
||||
@ -1125,7 +1125,6 @@ class WM_OT_addon_install(bpy.types.Operator):
|
||||
del pyfile_dir
|
||||
# done checking for exceptional case
|
||||
|
||||
addon_files_old = set(os.listdir(path_addons))
|
||||
addons_old = {mod.__name__ for mod in addon_utils.modules(USERPREF_PT_addons._addons_fake_modules)}
|
||||
|
||||
#check to see if the file is in compressed format (.zip)
|
||||
@ -1138,7 +1137,7 @@ class WM_OT_addon_install(bpy.types.Operator):
|
||||
|
||||
if self.overwrite:
|
||||
for f in file_to_extract.namelist():
|
||||
__class__._module_remove(path_addons, f)
|
||||
WM_OT_addon_install._module_remove(path_addons, f)
|
||||
else:
|
||||
for f in file_to_extract.namelist():
|
||||
path_dest = os.path.join(path_addons, os.path.basename(f))
|
||||
@ -1162,7 +1161,7 @@ class WM_OT_addon_install(bpy.types.Operator):
|
||||
path_dest = os.path.join(path_addons, os.path.basename(pyfile))
|
||||
|
||||
if self.overwrite:
|
||||
__class__._module_remove(path_addons, os.path.basename(pyfile))
|
||||
WM_OT_addon_install._module_remove(path_addons, os.path.basename(pyfile))
|
||||
elif os.path.exists(path_dest):
|
||||
self.report({'WARNING'}, "File already installed to %r\n" % path_dest)
|
||||
return {'CANCELLED'}
|
||||
@ -1227,7 +1226,7 @@ class WM_OT_addon_remove(bpy.types.Operator):
|
||||
return None, False
|
||||
|
||||
def execute(self, context):
|
||||
path, isdir = __class__.path_from_addon(self.module)
|
||||
path, isdir = WM_OT_addon_remove.path_from_addon(self.module)
|
||||
if path is None:
|
||||
self.report('WARNING', "Addon path %r could not be found" % path)
|
||||
return {'CANCELLED'}
|
||||
@ -1247,7 +1246,7 @@ class WM_OT_addon_remove(bpy.types.Operator):
|
||||
# lame confirmation check
|
||||
def draw(self, context):
|
||||
self.layout.label(text="Remove Addon: %r?" % self.module)
|
||||
path, isdir = __class__.path_from_addon(self.module)
|
||||
path, isdir = WM_OT_addon_remove.path_from_addon(self.module)
|
||||
self.layout.label(text="Path: %r" % path)
|
||||
|
||||
def invoke(self, context, event):
|
||||
|
@ -189,9 +189,9 @@ class InputKeyMapPanel:
|
||||
if km.is_modal:
|
||||
row.label(text="", icon='LINKED')
|
||||
if km.is_user_defined:
|
||||
op = row.operator("wm.keymap_restore", text="Restore")
|
||||
row.operator("wm.keymap_restore", text="Restore")
|
||||
else:
|
||||
op = row.operator("wm.keymap_edit", text="Edit")
|
||||
row.operator("wm.keymap_edit", text="Edit")
|
||||
|
||||
if km.show_expanded_children:
|
||||
if children:
|
||||
@ -213,7 +213,7 @@ class InputKeyMapPanel:
|
||||
col = self.indented_layout(col, level + 1)
|
||||
subcol = col.split(percentage=0.2).column()
|
||||
subcol.enabled = km.is_user_defined
|
||||
op = subcol.operator("wm.keyitem_add", text="Add New", icon='ZOOMIN')
|
||||
subcol.operator("wm.keyitem_add", text="Add New", icon='ZOOMIN')
|
||||
|
||||
col.separator()
|
||||
|
||||
@ -234,7 +234,7 @@ class InputKeyMapPanel:
|
||||
for pname, value in properties.bl_rna.properties.items():
|
||||
if pname != "rna_type" and not properties.is_property_hidden(pname):
|
||||
if isinstance(value, bpy.types.OperatorProperties):
|
||||
__class__.draw_kmi_properties(box, value, title=pname)
|
||||
InputKeyMapPanel.draw_kmi_properties(box, value, title=pname)
|
||||
else:
|
||||
flow.prop(properties, pname)
|
||||
|
||||
@ -325,7 +325,7 @@ class InputKeyMapPanel:
|
||||
# Operator properties
|
||||
props = kmi.properties
|
||||
if props is not None:
|
||||
__class__.draw_kmi_properties(box, props)
|
||||
InputKeyMapPanel.draw_kmi_properties(box, props)
|
||||
|
||||
# Modal key maps attached to this operator
|
||||
if not km.is_modal:
|
||||
@ -351,9 +351,9 @@ class InputKeyMapPanel:
|
||||
row.label()
|
||||
|
||||
if km.is_user_defined:
|
||||
op = row.operator("wm.keymap_restore", text="Restore")
|
||||
row.operator("wm.keymap_restore", text="Restore")
|
||||
else:
|
||||
op = row.operator("wm.keymap_edit", text="Edit")
|
||||
row.operator("wm.keymap_edit", text="Edit")
|
||||
|
||||
for kmi in filtered_items:
|
||||
self.draw_kmi(display_keymaps, kc, km, kmi, col, 1)
|
||||
@ -362,7 +362,7 @@ class InputKeyMapPanel:
|
||||
col = self.indented_layout(layout, 1)
|
||||
subcol = col.split(percentage=0.2).column()
|
||||
subcol.enabled = km.is_user_defined
|
||||
op = subcol.operator("wm.keyitem_add", text="Add New", icon='ZOOMIN')
|
||||
subcol.operator("wm.keyitem_add", text="Add New", icon='ZOOMIN')
|
||||
|
||||
def draw_hierarchy(self, display_keymaps, layout):
|
||||
for entry in KM_HIERARCHY:
|
||||
@ -723,9 +723,7 @@ class WM_OT_keyitem_add(bpy.types.Operator):
|
||||
bl_label = "Add Key Map Item"
|
||||
|
||||
def execute(self, context):
|
||||
wm = context.window_manager
|
||||
km = context.keymap
|
||||
kc = wm.keyconfigs.default
|
||||
|
||||
if km.is_modal:
|
||||
km.keymap_items.new_modal("", 'A', 'PRESS') # kmi
|
||||
|
@ -2414,7 +2414,7 @@ class VIEW3D_PT_context_properties(bpy.types.Panel):
|
||||
|
||||
def draw(self, context):
|
||||
import rna_prop_ui
|
||||
member = __class__._active_context_member(context)
|
||||
member = VIEW3D_PT_context_properties._active_context_member(context)
|
||||
|
||||
if member:
|
||||
# Draw with no edit button
|
||||
|
@ -60,7 +60,6 @@ def draw_gpencil_tools(context, layout):
|
||||
|
||||
# ********** default tools for objectmode ****************
|
||||
|
||||
|
||||
class VIEW3D_PT_tools_objectmode(View3DPanel, bpy.types.Panel):
|
||||
bl_context = "objectmode"
|
||||
bl_label = "Object Tools"
|
||||
@ -466,7 +465,7 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
settings = __class__.paint_settings(context)
|
||||
settings = self.paint_settings(context)
|
||||
brush = settings.brush
|
||||
|
||||
if not context.particle_edit_object:
|
||||
@ -687,7 +686,7 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
settings = __class__.paint_settings(context)
|
||||
settings = self.paint_settings(context)
|
||||
brush = settings.brush
|
||||
tex_slot = brush.texture_slot
|
||||
|
||||
@ -786,7 +785,7 @@ class VIEW3D_PT_tools_brush_tool(PaintPanel, bpy.types.Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
settings = __class__.paint_settings(context)
|
||||
settings = self.paint_settings(context)
|
||||
brush = settings.brush
|
||||
|
||||
col = layout.column(align=True)
|
||||
@ -821,7 +820,7 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel, bpy.types.Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
settings = __class__.paint_settings(context)
|
||||
settings = self.paint_settings(context)
|
||||
brush = settings.brush
|
||||
image_paint = context.image_paint_object
|
||||
|
||||
@ -944,7 +943,6 @@ class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel):
|
||||
|
||||
tool_settings = context.tool_settings
|
||||
sculpt = tool_settings.sculpt
|
||||
settings = __class__.paint_settings(context)
|
||||
|
||||
layout.label(text="Lock:")
|
||||
row = layout.row(align=True)
|
||||
@ -974,7 +972,6 @@ class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel):
|
||||
layout = self.layout
|
||||
|
||||
sculpt = context.tool_settings.sculpt
|
||||
settings = __class__.paint_settings(context)
|
||||
|
||||
split = layout.split()
|
||||
|
||||
@ -1006,7 +1003,7 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
settings = __class__.paint_settings(context)
|
||||
settings = self.paint_settings(context)
|
||||
brush = settings.brush
|
||||
|
||||
if brush is None: # unlikely but can happen
|
||||
|
@ -407,7 +407,7 @@ class BUILTIN_KSI_DeltaRotation(bpy.types.KeyingSetInfo):
|
||||
# add the property name to the base path
|
||||
# rotation mode affects the property used
|
||||
if data.rotation_mode == 'QUATERNION':
|
||||
path = path_add_property(base_path, "delta_rotation_quaternion")
|
||||
path = keyingsets_utils.path_add_property(base_path, "delta_rotation_quaternion")
|
||||
elif data.rotation_mode == 'AXIS_ANGLE':
|
||||
# XXX: for now, this is not available yet
|
||||
#path = path_add_property(base_path, "delta_rotation_axis_angle")
|
||||
|
@ -60,7 +60,7 @@
|
||||
|
||||
typedef struct _AviChunk {
|
||||
int fcc;
|
||||
int64_t size;
|
||||
int size;
|
||||
} AviChunk;
|
||||
|
||||
typedef struct _AviList {
|
||||
|
@ -937,6 +937,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
|
||||
BoidValues val;
|
||||
BoidState *state = get_boid_state(boids, pa);
|
||||
BoidParticle *bpa = pa->boid;
|
||||
ParticleSystem *psys = bbd->sim->psys;
|
||||
int rand;
|
||||
//BoidCondition *cond;
|
||||
|
||||
@ -959,9 +960,8 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
|
||||
bbd->wanted_co[0]=bbd->wanted_co[1]=bbd->wanted_co[2]=bbd->wanted_speed=0.0f;
|
||||
|
||||
/* create random seed for every particle & frame */
|
||||
BLI_srandom(bbd->sim->psys->seed + p);
|
||||
rand = BLI_rand();
|
||||
BLI_srandom((int)bbd->cfra + rand);
|
||||
rand = (int)(PSYS_FRAND(psys->seed + p) * 1000);
|
||||
rand = (int)(PSYS_FRAND((int)bbd->cfra + rand) * 1000);
|
||||
|
||||
set_boid_values(&val, bbd->part->boids, pa);
|
||||
|
||||
|
@ -284,8 +284,10 @@ static void cdDM_drawVerts(DerivedMesh *dm)
|
||||
else { /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */
|
||||
GPU_vertex_setup(dm);
|
||||
if( !GPU_buffer_legacy(dm) ) {
|
||||
if(dm->drawObject->nelements) glDrawArrays(GL_POINTS,0, dm->drawObject->nelements);
|
||||
else glDrawArrays(GL_POINTS,0, dm->drawObject->nlooseverts);
|
||||
if(dm->drawObject->tot_triangle_point)
|
||||
glDrawArrays(GL_POINTS,0, dm->drawObject->tot_triangle_point);
|
||||
else
|
||||
glDrawArrays(GL_POINTS,0, dm->drawObject->tot_loose_point);
|
||||
}
|
||||
GPU_buffer_unbind();
|
||||
}
|
||||
@ -547,9 +549,10 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm,
|
||||
GPU_normal_setup( dm );
|
||||
if( !GPU_buffer_legacy(dm) ) {
|
||||
glShadeModel(GL_SMOOTH);
|
||||
for( a = 0; a < dm->drawObject->nmaterials; a++ ) {
|
||||
for( a = 0; a < dm->drawObject->totmaterial; a++ ) {
|
||||
if( setMaterial(dm->drawObject->materials[a].mat_nr+1, NULL) )
|
||||
glDrawArrays(GL_TRIANGLES, dm->drawObject->materials[a].start, dm->drawObject->materials[a].end-dm->drawObject->materials[a].start);
|
||||
glDrawArrays(GL_TRIANGLES, dm->drawObject->materials[a].start,
|
||||
dm->drawObject->materials[a].totpoint);
|
||||
}
|
||||
}
|
||||
GPU_buffer_unbind( );
|
||||
@ -629,13 +632,13 @@ static void cdDM_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned cha
|
||||
GPU_color_setup(dm);
|
||||
if( !GPU_buffer_legacy(dm) ) {
|
||||
glShadeModel(GL_SMOOTH);
|
||||
glDrawArrays(GL_TRIANGLES, 0, dm->drawObject->nelements);
|
||||
glDrawArrays(GL_TRIANGLES, 0, dm->drawObject->tot_triangle_point);
|
||||
|
||||
if( useTwoSided ) {
|
||||
GPU_color4_upload(dm,cp2);
|
||||
GPU_color_setup(dm);
|
||||
glCullFace(GL_FRONT);
|
||||
glDrawArrays(GL_TRIANGLES, 0, dm->drawObject->nelements);
|
||||
glDrawArrays(GL_TRIANGLES, 0, dm->drawObject->tot_triangle_point);
|
||||
glCullFace(GL_BACK);
|
||||
}
|
||||
}
|
||||
@ -787,8 +790,8 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
|
||||
|
||||
glShadeModel( GL_SMOOTH );
|
||||
lastFlag = 0;
|
||||
for(i = 0; i < dm->drawObject->nelements/3; i++) {
|
||||
int actualFace = dm->drawObject->faceRemap[i];
|
||||
for(i = 0; i < dm->drawObject->tot_triangle_point/3; i++) {
|
||||
int actualFace = dm->drawObject->triangle_to_mface[i];
|
||||
int flag = 1;
|
||||
|
||||
if(drawParams) {
|
||||
@ -819,13 +822,13 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
|
||||
startFace = i;
|
||||
}
|
||||
}
|
||||
if( startFace < dm->drawObject->nelements/3 ) {
|
||||
if( startFace < dm->drawObject->tot_triangle_point/3 ) {
|
||||
if( lastFlag != 0 ) { /* if the flag is 0 it means the face is hidden or invisible */
|
||||
if (lastFlag==1 && col)
|
||||
GPU_color_switch(1);
|
||||
else
|
||||
GPU_color_switch(0);
|
||||
glDrawArrays(GL_TRIANGLES,startFace*3,dm->drawObject->nelements-startFace*3);
|
||||
glDrawArrays(GL_TRIANGLES, startFace*3, dm->drawObject->tot_triangle_point - startFace*3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -935,7 +938,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us
|
||||
if( useColors && mc )
|
||||
GPU_color_setup(dm);
|
||||
if( !GPU_buffer_legacy(dm) ) {
|
||||
int tottri = dm->drawObject->nelements/3;
|
||||
int tottri = dm->drawObject->tot_triangle_point/3;
|
||||
glShadeModel(GL_SMOOTH);
|
||||
|
||||
if(tottri == 0) {
|
||||
@ -947,17 +950,17 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us
|
||||
}
|
||||
else {
|
||||
/* we need to check if the next material changes */
|
||||
int next_actualFace= dm->drawObject->faceRemap[0];
|
||||
int next_actualFace= dm->drawObject->triangle_to_mface[0];
|
||||
|
||||
for( i = 0; i < tottri; i++ ) {
|
||||
//int actualFace = dm->drawObject->faceRemap[i];
|
||||
//int actualFace = dm->drawObject->triangle_to_mface[i];
|
||||
int actualFace = next_actualFace;
|
||||
MFace *mface= mf + actualFace;
|
||||
int drawSmooth= (mface->flag & ME_SMOOTH);
|
||||
int draw = 1;
|
||||
|
||||
if(i != tottri-1)
|
||||
next_actualFace= dm->drawObject->faceRemap[i+1];
|
||||
next_actualFace= dm->drawObject->triangle_to_mface[i+1];
|
||||
|
||||
orig= (index==NULL) ? actualFace : index[actualFace];
|
||||
|
||||
@ -1129,9 +1132,9 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, vo
|
||||
GPU_normal_setup(dm);
|
||||
|
||||
if( !GPU_buffer_legacy(dm) ) {
|
||||
for( i = 0; i < dm->drawObject->nelements/3; i++ ) {
|
||||
for( i = 0; i < dm->drawObject->tot_triangle_point/3; i++ ) {
|
||||
|
||||
a = dm->drawObject->faceRemap[i];
|
||||
a = dm->drawObject->triangle_to_mface[i];
|
||||
|
||||
mface = mf + a;
|
||||
new_matnr = mface->mat_nr + 1;
|
||||
@ -1153,7 +1156,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, vo
|
||||
|
||||
if( numdata != 0 ) {
|
||||
|
||||
GPU_buffer_free(buffer, NULL);
|
||||
GPU_buffer_free(buffer);
|
||||
|
||||
buffer = NULL;
|
||||
}
|
||||
@ -1193,7 +1196,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, vo
|
||||
}
|
||||
if( numdata != 0 ) {
|
||||
elementsize = GPU_attrib_element_size( datatypes, numdata );
|
||||
buffer = GPU_buffer_alloc( elementsize*dm->drawObject->nelements, NULL );
|
||||
buffer = GPU_buffer_alloc( elementsize*dm->drawObject->tot_triangle_point);
|
||||
if( buffer == NULL ) {
|
||||
GPU_buffer_unbind();
|
||||
dm->drawObject->legacy = 1;
|
||||
@ -1202,7 +1205,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, vo
|
||||
varray = GPU_buffer_lock_stream(buffer);
|
||||
if( varray == NULL ) {
|
||||
GPU_buffer_unbind();
|
||||
GPU_buffer_free(buffer, NULL);
|
||||
GPU_buffer_free(buffer);
|
||||
dm->drawObject->legacy = 1;
|
||||
return;
|
||||
}
|
||||
@ -1341,7 +1344,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, vo
|
||||
}
|
||||
GPU_buffer_unbind();
|
||||
}
|
||||
GPU_buffer_free( buffer, NULL );
|
||||
GPU_buffer_free(buffer);
|
||||
}
|
||||
|
||||
glShadeModel(GL_FLAT);
|
||||
|
@ -2431,6 +2431,7 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
|
||||
{
|
||||
float *p1,*p2,*p3, pt[3];
|
||||
float dx1,dy1,dz1,dx,dy,dz,vx,vy,vz,len,len1,len2;
|
||||
const float eps= 1e-5;
|
||||
|
||||
if(bezt->h1==0 && bezt->h2==0) return;
|
||||
|
||||
@ -2587,30 +2588,38 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
|
||||
|
||||
if(bezt->f1 & SELECT) { /* order of calculation */
|
||||
if(bezt->h2==HD_ALIGN) { /* aligned */
|
||||
len= len2/len1;
|
||||
p2[3]= p2[0]+len*(p2[0]-p2[-3]);
|
||||
p2[4]= p2[1]+len*(p2[1]-p2[-2]);
|
||||
p2[5]= p2[2]+len*(p2[2]-p2[-1]);
|
||||
if(len1>eps) {
|
||||
len= len2/len1;
|
||||
p2[3]= p2[0]+len*(p2[0]-p2[-3]);
|
||||
p2[4]= p2[1]+len*(p2[1]-p2[-2]);
|
||||
p2[5]= p2[2]+len*(p2[2]-p2[-1]);
|
||||
}
|
||||
}
|
||||
if(bezt->h1==HD_ALIGN) {
|
||||
len= len1/len2;
|
||||
p2[-3]= p2[0]+len*(p2[0]-p2[3]);
|
||||
p2[-2]= p2[1]+len*(p2[1]-p2[4]);
|
||||
p2[-1]= p2[2]+len*(p2[2]-p2[5]);
|
||||
if(len2>eps) {
|
||||
len= len1/len2;
|
||||
p2[-3]= p2[0]+len*(p2[0]-p2[3]);
|
||||
p2[-2]= p2[1]+len*(p2[1]-p2[4]);
|
||||
p2[-1]= p2[2]+len*(p2[2]-p2[5]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(bezt->h1==HD_ALIGN) {
|
||||
len= len1/len2;
|
||||
p2[-3]= p2[0]+len*(p2[0]-p2[3]);
|
||||
p2[-2]= p2[1]+len*(p2[1]-p2[4]);
|
||||
p2[-1]= p2[2]+len*(p2[2]-p2[5]);
|
||||
if(len2>eps) {
|
||||
len= len1/len2;
|
||||
p2[-3]= p2[0]+len*(p2[0]-p2[3]);
|
||||
p2[-2]= p2[1]+len*(p2[1]-p2[4]);
|
||||
p2[-1]= p2[2]+len*(p2[2]-p2[5]);
|
||||
}
|
||||
}
|
||||
if(bezt->h2==HD_ALIGN) { /* aligned */
|
||||
len= len2/len1;
|
||||
p2[3]= p2[0]+len*(p2[0]-p2[-3]);
|
||||
p2[4]= p2[1]+len*(p2[1]-p2[-2]);
|
||||
p2[5]= p2[2]+len*(p2[2]-p2[-1]);
|
||||
if(len1>eps) {
|
||||
len= len2/len1;
|
||||
p2[3]= p2[0]+len*(p2[0]-p2[-3]);
|
||||
p2[4]= p2[1]+len*(p2[1]-p2[-2]);
|
||||
p2[5]= p2[2]+len*(p2[2]-p2[-1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -599,7 +599,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
|
||||
if(part->ren_as == PART_DRAW_GR && part->dup_group) {
|
||||
for(go=part->dup_group->gobject.first; go; go=go->next) {
|
||||
node2 = dag_get_node(dag, go->ob);
|
||||
dag_add_relation(dag, node, node2, DAG_RL_OB_OB, "Particle Group Visualisation");
|
||||
dag_add_relation(dag, node2, node, DAG_RL_OB_OB, "Particle Group Visualisation");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -550,7 +550,7 @@ Material *material_pop_id(ID *id, int index)
|
||||
Material **mat;
|
||||
|
||||
if(index + 1 != (*totcol))
|
||||
memmove((*matar), (*matar) + 1, (*totcol) - (index + 1));
|
||||
memmove((*matar), (*matar) + 1, sizeof(void *) * ((*totcol) - (index + 1)));
|
||||
|
||||
(*totcol)--;
|
||||
|
||||
|
@ -2418,6 +2418,11 @@ void ntreeBeginExecTree(bNodeTree *ntree)
|
||||
|
||||
if(ntree->type==NTREE_COMPOSIT)
|
||||
composit_begin_exec(ntree, ntree->stack);
|
||||
|
||||
/* ensures only a single output node is enabled, texnode allows multiple though */
|
||||
if(ntree->type!=NTREE_TEXTURE)
|
||||
ntreeSetOutput(ntree);
|
||||
|
||||
}
|
||||
|
||||
ntree->init |= NTREE_EXEC_INIT;
|
||||
@ -2765,9 +2770,6 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
|
||||
/* fixed seed, for example noise texture */
|
||||
BLI_srandom(rd->cfra);
|
||||
|
||||
/* ensures only a single output node is enabled */
|
||||
ntreeSetOutput(ntree);
|
||||
|
||||
/* sets need_exec tags in nodes */
|
||||
curnode = totnode= setExecutableNodes(ntree, &thdata);
|
||||
|
||||
|
@ -2889,8 +2889,6 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
|
||||
if(psys_in_edit_mode(sim->scene, psys))
|
||||
if(psys->renderdata==0 && (psys->edit==NULL || pset->flag & PE_DRAW_PART)==0)
|
||||
return;
|
||||
|
||||
BLI_srandom(psys->seed);
|
||||
|
||||
keyed = psys->flag & PSYS_KEYED;
|
||||
baked = psys->pointcache->mem_cache.first && psys->part->type != PART_HAIR;
|
||||
@ -4374,58 +4372,45 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa
|
||||
Object *ob = sim->ob;
|
||||
ParticleSystem *psys = sim->psys;
|
||||
ParticleSystemModifierData *psmd = sim->psmd;
|
||||
float loc[3], nor[3], vec[3], side[3], len, obrotmat[4][4], qmat[4][4];
|
||||
float xvec[3] = {-1.0, 0.0, 0.0}, q[4], nmat[3][3];
|
||||
float loc[3], nor[3], vec[3], side[3], len;
|
||||
float xvec[3] = {-1.0, 0.0, 0.0}, nmat[3][3];
|
||||
|
||||
sub_v3_v3v3(vec, (cache+cache->steps)->co, cache->co);
|
||||
len= normalize_v3(vec);
|
||||
|
||||
if(psys->part->rotmode) {
|
||||
if(pa == NULL)
|
||||
pa= psys->particles+cpa->pa[0];
|
||||
if(pa == NULL && psys->part->childflat != PART_CHILD_FACES)
|
||||
pa = psys->particles + cpa->pa[0];
|
||||
|
||||
vec_to_quat( q,xvec, ob->trackflag, ob->upflag);
|
||||
quat_to_mat4( obrotmat,q);
|
||||
obrotmat[3][3]= 1.0f;
|
||||
|
||||
quat_to_mat4( qmat,pa->state.rot);
|
||||
mul_m4_m4m4(mat, obrotmat, qmat);
|
||||
}
|
||||
else {
|
||||
if(pa == NULL && psys->part->childflat != PART_CHILD_FACES)
|
||||
pa = psys->particles + cpa->pa[0];
|
||||
|
||||
if(pa)
|
||||
psys_particle_on_emitter(psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,nor,0,0,0,0);
|
||||
else
|
||||
psys_particle_on_emitter(psmd,PART_FROM_FACE,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,loc,nor,0,0,0,0);
|
||||
if(pa)
|
||||
psys_particle_on_emitter(psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,nor,0,0,0,0);
|
||||
else
|
||||
psys_particle_on_emitter(psmd,PART_FROM_FACE,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,loc,nor,0,0,0,0);
|
||||
|
||||
copy_m3_m4(nmat, ob->imat);
|
||||
transpose_m3(nmat);
|
||||
mul_m3_v3(nmat, nor);
|
||||
copy_m3_m4(nmat, ob->imat);
|
||||
transpose_m3(nmat);
|
||||
mul_m3_v3(nmat, nor);
|
||||
|
||||
/* make sure that we get a proper side vector */
|
||||
if(fabs(dot_v3v3(nor,vec))>0.999999) {
|
||||
if(fabs(dot_v3v3(nor,xvec))>0.999999) {
|
||||
nor[0] = 0.0f;
|
||||
nor[1] = 1.0f;
|
||||
nor[2] = 0.0f;
|
||||
}
|
||||
else {
|
||||
nor[0] = 1.0f;
|
||||
nor[1] = 0.0f;
|
||||
nor[2] = 0.0f;
|
||||
}
|
||||
/* make sure that we get a proper side vector */
|
||||
if(fabs(dot_v3v3(nor,vec))>0.999999) {
|
||||
if(fabs(dot_v3v3(nor,xvec))>0.999999) {
|
||||
nor[0] = 0.0f;
|
||||
nor[1] = 1.0f;
|
||||
nor[2] = 0.0f;
|
||||
}
|
||||
else {
|
||||
nor[0] = 1.0f;
|
||||
nor[1] = 0.0f;
|
||||
nor[2] = 0.0f;
|
||||
}
|
||||
cross_v3_v3v3(side, nor, vec);
|
||||
normalize_v3(side);
|
||||
cross_v3_v3v3(nor, vec, side);
|
||||
|
||||
unit_m4(mat);
|
||||
VECCOPY(mat[0], vec);
|
||||
VECCOPY(mat[1], side);
|
||||
VECCOPY(mat[2], nor);
|
||||
}
|
||||
cross_v3_v3v3(side, nor, vec);
|
||||
normalize_v3(side);
|
||||
cross_v3_v3v3(nor, vec, side);
|
||||
|
||||
unit_m4(mat);
|
||||
VECCOPY(mat[0], vec);
|
||||
VECCOPY(mat[1], side);
|
||||
VECCOPY(mat[2], nor);
|
||||
|
||||
*scale= len;
|
||||
}
|
||||
|
@ -3510,13 +3510,15 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
|
||||
static void hair_step(ParticleSimulationData *sim, float cfra)
|
||||
{
|
||||
ParticleSystem *psys = sim->psys;
|
||||
/* ParticleSettings *part = psys->part; */
|
||||
ParticleSettings *part = psys->part;
|
||||
PARTICLE_P;
|
||||
float disp = (float)psys_get_current_display_percentage(psys)/100.0f;
|
||||
|
||||
BLI_srandom(psys->seed);
|
||||
|
||||
LOOP_PARTICLES {
|
||||
pa->size = part->size;
|
||||
if(part->randsize > 0.0f)
|
||||
pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1);
|
||||
|
||||
if(PSYS_FRAND(p) > disp)
|
||||
pa->flag |= PARS_NO_DISP;
|
||||
else
|
||||
@ -3801,8 +3803,6 @@ static void cached_step(ParticleSimulationData *sim, float cfra)
|
||||
PARTICLE_P;
|
||||
float disp, dietime;
|
||||
|
||||
BLI_srandom(psys->seed);
|
||||
|
||||
psys_update_effectors(sim);
|
||||
|
||||
disp= (float)psys_get_current_display_percentage(psys)/100.0f;
|
||||
@ -4054,7 +4054,6 @@ static void system_step(ParticleSimulationData *sim, float cfra)
|
||||
/* set particles to be not calculated TODO: can't work with pointcache */
|
||||
disp= (float)psys_get_current_display_percentage(psys)/100.0f;
|
||||
|
||||
BLI_srandom(psys->seed);
|
||||
LOOP_PARTICLES {
|
||||
if(PSYS_FRAND(p) > disp)
|
||||
pa->flag |= PARS_NO_DISP;
|
||||
|
@ -75,6 +75,7 @@ variables on the UI for now
|
||||
#include "BKE_curve.h"
|
||||
#include "BKE_effect.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_softbody.h"
|
||||
#include "BKE_DerivedMesh.h"
|
||||
#include "BKE_pointcache.h"
|
||||
@ -289,21 +290,24 @@ typedef struct ccd_Mesh {
|
||||
|
||||
|
||||
|
||||
static ccd_Mesh *ccd_mesh_make(Object *ob, DerivedMesh *dm)
|
||||
static ccd_Mesh *ccd_mesh_make(Object *ob)
|
||||
{
|
||||
CollisionModifierData *cmd;
|
||||
ccd_Mesh *pccd_M = NULL;
|
||||
ccdf_minmax *mima =NULL;
|
||||
MFace *mface=NULL;
|
||||
float v[3],hull;
|
||||
int i;
|
||||
|
||||
cmd =(CollisionModifierData *)modifiers_findByType(ob, eModifierType_Collision);
|
||||
|
||||
/* first some paranoia checks */
|
||||
if (!dm) return NULL;
|
||||
if (!dm->getNumVerts(dm) || !dm->getNumFaces(dm)) return NULL;
|
||||
if (!cmd) return NULL;
|
||||
if (!cmd->numverts || !cmd->numfaces) return NULL;
|
||||
|
||||
pccd_M = MEM_mallocN(sizeof(ccd_Mesh),"ccd_Mesh");
|
||||
pccd_M->totvert = dm->getNumVerts(dm);
|
||||
pccd_M->totface = dm->getNumFaces(dm);
|
||||
pccd_M->totvert = cmd->numverts;
|
||||
pccd_M->totface = cmd->numfaces;
|
||||
pccd_M->savety = CCD_SAVETY;
|
||||
pccd_M->bbmin[0]=pccd_M->bbmin[1]=pccd_M->bbmin[2]=1e30f;
|
||||
pccd_M->bbmax[0]=pccd_M->bbmax[1]=pccd_M->bbmax[2]=-1e30f;
|
||||
@ -314,12 +318,10 @@ static ccd_Mesh *ccd_mesh_make(Object *ob, DerivedMesh *dm)
|
||||
hull = MAX2(ob->pd->pdef_sbift,ob->pd->pdef_sboft);
|
||||
|
||||
/* alloc and copy verts*/
|
||||
pccd_M->mvert = dm->dupVertArray(dm);
|
||||
/* ah yeah, put the verices to global coords once */
|
||||
/* and determine the ortho BB on the fly */
|
||||
pccd_M->mvert = MEM_dupallocN(cmd->xnew);
|
||||
/* note that xnew coords are already in global space, */
|
||||
/* determine the ortho BB */
|
||||
for(i=0; i < pccd_M->totvert; i++){
|
||||
mul_m4_v3(ob->obmat, pccd_M->mvert[i].co);
|
||||
|
||||
/* evaluate limits */
|
||||
VECCOPY(v,pccd_M->mvert[i].co);
|
||||
pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0],v[0]-hull);
|
||||
@ -332,7 +334,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob, DerivedMesh *dm)
|
||||
|
||||
}
|
||||
/* alloc and copy faces*/
|
||||
pccd_M->mface = dm->dupFaceArray(dm);
|
||||
pccd_M->mface = MEM_dupallocN(cmd->mfaces);
|
||||
|
||||
/* OBBs for idea1 */
|
||||
pccd_M->mima = MEM_mallocN(sizeof(ccdf_minmax)*pccd_M->totface,"ccd_Mesh_Faces_mima");
|
||||
@ -386,19 +388,22 @@ static ccd_Mesh *ccd_mesh_make(Object *ob, DerivedMesh *dm)
|
||||
}
|
||||
return pccd_M;
|
||||
}
|
||||
static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M, DerivedMesh *dm)
|
||||
static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
|
||||
{
|
||||
ccdf_minmax *mima =NULL;
|
||||
CollisionModifierData *cmd;
|
||||
ccdf_minmax *mima =NULL;
|
||||
MFace *mface=NULL;
|
||||
float v[3],hull;
|
||||
int i;
|
||||
|
||||
/* first some paranoia checks */
|
||||
if (!dm) return ;
|
||||
if (!dm->getNumVerts(dm) || !dm->getNumFaces(dm)) return ;
|
||||
cmd =(CollisionModifierData *)modifiers_findByType(ob, eModifierType_Collision);
|
||||
|
||||
if ((pccd_M->totvert != dm->getNumVerts(dm)) ||
|
||||
(pccd_M->totface != dm->getNumFaces(dm))) return;
|
||||
/* first some paranoia checks */
|
||||
if (!cmd) return ;
|
||||
if (!cmd->numverts || !cmd->numfaces) return ;
|
||||
|
||||
if ((pccd_M->totvert != cmd->numverts) ||
|
||||
(pccd_M->totface != cmd->numfaces)) return;
|
||||
|
||||
pccd_M->bbmin[0]=pccd_M->bbmin[1]=pccd_M->bbmin[2]=1e30f;
|
||||
pccd_M->bbmax[0]=pccd_M->bbmax[1]=pccd_M->bbmax[2]=-1e30f;
|
||||
@ -411,12 +416,10 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M, DerivedMesh *dm)
|
||||
if(pccd_M->mprevvert) MEM_freeN(pccd_M->mprevvert);
|
||||
pccd_M->mprevvert = pccd_M->mvert;
|
||||
/* alloc and copy verts*/
|
||||
pccd_M->mvert = dm->dupVertArray(dm);
|
||||
/* ah yeah, put the verices to global coords once */
|
||||
/* and determine the ortho BB on the fly */
|
||||
pccd_M->mvert = MEM_dupallocN(cmd->xnew);
|
||||
/* note that xnew coords are already in global space, */
|
||||
/* determine the ortho BB */
|
||||
for(i=0; i < pccd_M->totvert; i++){
|
||||
mul_m4_v3(ob->obmat, pccd_M->mvert[i].co);
|
||||
|
||||
/* evaluate limits */
|
||||
VECCOPY(v,pccd_M->mvert[i].co);
|
||||
pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0],v[0]-hull);
|
||||
@ -555,21 +558,8 @@ static void ccd_build_deflector_hash(Scene *scene, Object *vertexowner, GHash *h
|
||||
|
||||
/*+++ only with deflecting set */
|
||||
if(ob->pd && ob->pd->deflect && BLI_ghash_lookup(hash, ob) == NULL) {
|
||||
DerivedMesh *dm= NULL;
|
||||
|
||||
if(ob->softflag & OB_SB_COLLFINAL) /* so maybe someone wants overkill to collide with subsurfed */
|
||||
dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
|
||||
else
|
||||
dm = mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
|
||||
|
||||
if(dm){
|
||||
ccd_Mesh *ccdmesh = ccd_mesh_make(ob, dm);
|
||||
BLI_ghash_insert(hash, ob, ccdmesh);
|
||||
|
||||
/* we did copy & modify all we need so give 'em away again */
|
||||
dm->release(dm);
|
||||
|
||||
}
|
||||
ccd_Mesh *ccdmesh = ccd_mesh_make(ob);
|
||||
BLI_ghash_insert(hash, ob, ccdmesh);
|
||||
}/*--- only with deflecting set */
|
||||
|
||||
}/* mesh && layer*/
|
||||
@ -595,21 +585,9 @@ static void ccd_update_deflector_hash(Scene *scene, Object *vertexowner, GHash *
|
||||
|
||||
/*+++ only with deflecting set */
|
||||
if(ob->pd && ob->pd->deflect) {
|
||||
DerivedMesh *dm= NULL;
|
||||
|
||||
if(ob->softflag & OB_SB_COLLFINAL) { /* so maybe someone wants overkill to collide with subsurfed */
|
||||
dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
|
||||
} else {
|
||||
dm = mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
|
||||
}
|
||||
if(dm){
|
||||
ccd_Mesh *ccdmesh = BLI_ghash_lookup(hash,ob);
|
||||
if (ccdmesh)
|
||||
ccd_mesh_update(ob,ccdmesh,dm);
|
||||
|
||||
/* we did copy & modify all we need so give 'em away again */
|
||||
dm->release(dm);
|
||||
}
|
||||
ccd_Mesh *ccdmesh = BLI_ghash_lookup(hash,ob);
|
||||
if (ccdmesh)
|
||||
ccd_mesh_update(ob,ccdmesh);
|
||||
}/*--- only with deflecting set */
|
||||
|
||||
}/* mesh && layer*/
|
||||
|
@ -1176,7 +1176,8 @@ static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(draw
|
||||
CCGSubSurf *ss = ccgdm->ss;
|
||||
CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss);
|
||||
CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss);
|
||||
int i, edgeSize = ccgSubSurf_getEdgeSize(ss);
|
||||
int i, j, edgeSize = ccgSubSurf_getEdgeSize(ss);
|
||||
int totedge = ccgSubSurf_getNumEdges(ss);
|
||||
int gridSize = ccgSubSurf_getGridSize(ss);
|
||||
int useAging;
|
||||
|
||||
@ -1184,13 +1185,16 @@ static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(draw
|
||||
|
||||
ccgSubSurf_getUseAgeCounts(ss, &useAging, NULL, NULL, NULL);
|
||||
|
||||
for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) {
|
||||
CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
|
||||
for (j=0; j< totedge; j++) {
|
||||
CCGEdge *e = ccgdm->edgeMap[j].edge;
|
||||
DMGridData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e);
|
||||
|
||||
if (!drawLooseEdges && !ccgSubSurf_getEdgeNumFaces(e))
|
||||
continue;
|
||||
|
||||
if(ccgdm->edgeFlags && !(ccgdm->edgeFlags[j] & ME_EDGEDRAW))
|
||||
continue;
|
||||
|
||||
if (useAging && !(G.f&G_BACKBUFSEL)) {
|
||||
int ageCol = 255-ccgSubSurf_getEdgeAge(ss, e)*4;
|
||||
glColor3ub(0, ageCol>0?ageCol:0, 0);
|
||||
|
@ -1486,6 +1486,10 @@ int BKE_texture_dependsOnTime(const struct Tex *texture)
|
||||
// assume anything in adt means the texture is animated
|
||||
return 1;
|
||||
}
|
||||
else if(texture->type == TEX_NOISE) {
|
||||
// noise always varies with time
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1189,8 +1189,9 @@ void BLI_pbvh_node_get_verts(PBVH *bvh, PBVHNode *node, int **vert_indices, MVer
|
||||
void BLI_pbvh_node_num_verts(PBVH *bvh, PBVHNode *node, int *uniquevert, int *totvert)
|
||||
{
|
||||
if(bvh->grids) {
|
||||
if(totvert) *totvert= node->totprim*bvh->gridsize*bvh->gridsize;
|
||||
if(uniquevert) *uniquevert= *totvert;
|
||||
const int tot= node->totprim*bvh->gridsize*bvh->gridsize;
|
||||
if(totvert) *totvert= tot;
|
||||
if(uniquevert) *uniquevert= tot;
|
||||
}
|
||||
else {
|
||||
if(totvert) *totvert= node->uniq_verts + node->face_verts;
|
||||
|
@ -4836,7 +4836,6 @@ static void lib_link_screen(FileData *fd, Main *main)
|
||||
else if(sl->spacetype==SPACE_FILE) {
|
||||
SpaceFile *sfile= (SpaceFile *)sl;
|
||||
sfile->files= NULL;
|
||||
sfile->params= NULL;
|
||||
sfile->op= NULL;
|
||||
sfile->layout= NULL;
|
||||
sfile->folders_prev= NULL;
|
||||
@ -5449,7 +5448,7 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
|
||||
sfile->files= NULL;
|
||||
sfile->layout= NULL;
|
||||
sfile->op= NULL;
|
||||
sfile->params= NULL;
|
||||
sfile->params= newdataadr(fd, sfile->params);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2106,7 +2106,11 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
|
||||
writestruct(wd, DATA, "SpaceButs", 1, sl);
|
||||
}
|
||||
else if(sl->spacetype==SPACE_FILE) {
|
||||
SpaceFile *sfile= (SpaceFile *)sl;
|
||||
|
||||
writestruct(wd, DATA, "SpaceFile", 1, sl);
|
||||
if(sfile->params)
|
||||
writestruct(wd, DATA, "FileSelectParams", 1, sfile->params);
|
||||
}
|
||||
else if(sl->spacetype==SPACE_SEQ) {
|
||||
writestruct(wd, DATA, "SpaceSeq", 1, sl);
|
||||
|
@ -121,7 +121,7 @@ static void fcurves_to_pchan_links_get (ListBase *pfLinks, Object *ob, bAction *
|
||||
pfl->oldangle = pchan->rotAngle;
|
||||
|
||||
/* make copy of custom properties */
|
||||
if (transFlags & ACT_TRANS_PROP)
|
||||
if (pchan->prop && (transFlags & ACT_TRANS_PROP))
|
||||
pfl->oldprops = IDP_CopyProperty(pchan->prop);
|
||||
}
|
||||
}
|
||||
|
@ -1319,7 +1319,7 @@ void OBJECT_OT_make_links_scene(wmOperatorType *ot)
|
||||
|
||||
/* identifiers */
|
||||
ot->name= "Link Objects to Scene";
|
||||
ot->description = "Make linked data local to each object";
|
||||
ot->description = "Link selection to another scene";
|
||||
ot->idname= "OBJECT_OT_make_links_scene";
|
||||
|
||||
/* api callbacks */
|
||||
|
@ -468,8 +468,9 @@ void VIEW3D_OT_object_as_camera(wmOperatorType *ot)
|
||||
|
||||
void ED_view3d_calc_clipping(BoundBox *bb, float planes[4][4], bglMats *mats, rcti *rect)
|
||||
{
|
||||
float modelview[4][4];
|
||||
double xs, ys, p[3];
|
||||
short val;
|
||||
int val, flip_sign, a;
|
||||
|
||||
/* near zero floating point values can give issues with gluUnProject
|
||||
in side view on some implementations */
|
||||
@ -493,11 +494,21 @@ void ED_view3d_calc_clipping(BoundBox *bb, float planes[4][4], bglMats *mats, rc
|
||||
VECCOPY(bb->vec[4+val], p);
|
||||
}
|
||||
|
||||
/* verify if we have negative scale. doing the transform before cross
|
||||
product flips the sign of the vector compared to doing cross product
|
||||
before transform then, so we correct for that. */
|
||||
for(a=0; a<16; a++)
|
||||
((float*)modelview)[a] = mats->modelview[a];
|
||||
flip_sign = is_negative_m4(modelview);
|
||||
|
||||
/* then plane equations */
|
||||
for(val=0; val<4; val++) {
|
||||
|
||||
normal_tri_v3(planes[val], bb->vec[val], bb->vec[val==3?0:val+1], bb->vec[val+4]);
|
||||
|
||||
if(flip_sign)
|
||||
negate_v3(planes[val]);
|
||||
|
||||
planes[val][3]= - planes[val][0]*bb->vec[val][0]
|
||||
- planes[val][1]*bb->vec[val][1]
|
||||
- planes[val][2]*bb->vec[val][2];
|
||||
|
@ -4988,6 +4988,10 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
|
||||
where_is_pose(t->scene, pose_ob);
|
||||
}
|
||||
|
||||
/* set BONE_TRANSFORM flags for autokey, manipulator draw might have changed them */
|
||||
if (!cancelled && (t->mode != TFM_DUMMY))
|
||||
count_set_pose_transflags(&t->mode, t->around, ob);
|
||||
|
||||
/* if target-less IK grabbing, we calculate the pchan transforms and clear flag */
|
||||
if (!cancelled && t->mode==TFM_TRANSLATION)
|
||||
targetless_ik= apply_targetless_ik(ob);
|
||||
|
@ -37,8 +37,6 @@
|
||||
#ifndef __GPU_BUFFERS_H__
|
||||
#define __GPU_BUFFERS_H__
|
||||
|
||||
#define MAX_FREE_GPU_BUFFERS 8
|
||||
|
||||
#ifdef _DEBUG
|
||||
/*#define DEBUG_VBO(X) printf(X)*/
|
||||
#define DEBUG_VBO(X)
|
||||
@ -46,112 +44,92 @@
|
||||
#define DEBUG_VBO(X)
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define ERROR_VBO(X) printf(X)
|
||||
#else
|
||||
#define ERROR_VBO(X)
|
||||
#endif
|
||||
|
||||
struct DerivedMesh;
|
||||
struct DMGridData;
|
||||
struct GHash;
|
||||
struct DMGridData;
|
||||
struct GPUVertPointLink;
|
||||
|
||||
/* V - vertex, N - normal, T - uv, C - color
|
||||
F - float, UB - unsigned byte */
|
||||
#define GPU_BUFFER_INTER_V3F 1
|
||||
#define GPU_BUFFER_INTER_N3F 2
|
||||
#define GPU_BUFFER_INTER_T2F 3
|
||||
#define GPU_BUFFER_INTER_C3UB 4
|
||||
#define GPU_BUFFER_INTER_C4UB 5
|
||||
#define GPU_BUFFER_INTER_END -1
|
||||
|
||||
typedef struct GPUBuffer
|
||||
{
|
||||
typedef struct GPUBuffer {
|
||||
int size; /* in bytes */
|
||||
void *pointer; /* used with vertex arrays */
|
||||
unsigned int id; /* used with vertex buffer objects */
|
||||
} GPUBuffer;
|
||||
|
||||
/* stores deleted buffers so that new buffers wouldn't have to
|
||||
be recreated that often. */
|
||||
typedef struct GPUBufferPool
|
||||
{
|
||||
int size; /* number of allocated buffers stored */
|
||||
int maxsize; /* size of the array */
|
||||
GPUBuffer **buffers;
|
||||
} GPUBufferPool;
|
||||
typedef struct GPUBufferMaterial {
|
||||
/* range of points used for this material */
|
||||
int start;
|
||||
int totpoint;
|
||||
|
||||
typedef struct GPUBufferMaterial
|
||||
{
|
||||
int start; /* at which vertex in the buffer the material starts */
|
||||
int end; /* at which vertex it ends */
|
||||
char mat_nr;
|
||||
/* original material index */
|
||||
short mat_nr;
|
||||
} GPUBufferMaterial;
|
||||
|
||||
typedef struct IndexLink {
|
||||
int element;
|
||||
struct IndexLink *next;
|
||||
} IndexLink;
|
||||
/* meshes are split up by material since changing materials requires
|
||||
GL state changes that can't occur in the middle of drawing an
|
||||
array.
|
||||
|
||||
typedef struct GPUDrawObject
|
||||
{
|
||||
GPUBuffer *vertices;
|
||||
some simplifying assumptions are made:
|
||||
* all quads are treated as two triangles.
|
||||
* no vertex sharing is used; each triangle gets its own copy of the
|
||||
vertices it uses (this makes it easy to deal with a vertex used
|
||||
by faces with different properties, such as smooth/solid shading,
|
||||
different MCols, etc.)
|
||||
|
||||
to avoid confusion between the original MVert vertices and the
|
||||
arrays of OpenGL vertices, the latter are referred to here and in
|
||||
the source as `points'. similarly, the OpenGL triangles generated
|
||||
for MFaces are referred to as triangles rather than faces.
|
||||
*/
|
||||
typedef struct GPUDrawObject {
|
||||
GPUBuffer *points;
|
||||
GPUBuffer *normals;
|
||||
GPUBuffer *uv;
|
||||
GPUBuffer *colors;
|
||||
GPUBuffer *edges;
|
||||
GPUBuffer *uvedges;
|
||||
|
||||
int *faceRemap; /* at what index was the face originally in DerivedMesh */
|
||||
IndexLink *indices; /* given an index, find all elements using it */
|
||||
IndexLink *indexMem; /* for faster memory allocation/freeing */
|
||||
int indexMemUsage; /* how many are already allocated */
|
||||
/* for each triangle, the original MFace index */
|
||||
int *triangle_to_mface;
|
||||
|
||||
/* for each original vertex, the list of related points */
|
||||
struct GPUVertPointLink *vert_points;
|
||||
/* storage for the vert_points lists */
|
||||
struct GPUVertPointLink *vert_points_mem;
|
||||
int vert_points_usage;
|
||||
|
||||
int colType;
|
||||
|
||||
GPUBufferMaterial *materials;
|
||||
int totmaterial;
|
||||
|
||||
int tot_triangle_point;
|
||||
int tot_loose_point;
|
||||
|
||||
/* caches of the original DerivedMesh values */
|
||||
int totvert;
|
||||
int totedge;
|
||||
|
||||
int nmaterials;
|
||||
int nelements; /* (number of faces) * 3 */
|
||||
int nlooseverts;
|
||||
int nedges;
|
||||
int nindices;
|
||||
int legacy; /* if there was a failure allocating some buffer, use old rendering code */
|
||||
|
||||
/* if there was a failure allocating some buffer, use old
|
||||
rendering code */
|
||||
int legacy;
|
||||
} GPUDrawObject;
|
||||
|
||||
/* used for GLSL materials */
|
||||
typedef struct GPUAttrib
|
||||
{
|
||||
typedef struct GPUAttrib {
|
||||
int index;
|
||||
int size;
|
||||
int type;
|
||||
} GPUAttrib;
|
||||
|
||||
GPUBufferPool *GPU_buffer_pool_new(void);
|
||||
void GPU_buffer_pool_free( GPUBufferPool *pool );
|
||||
void GPU_buffer_pool_free_unused( GPUBufferPool *pool );
|
||||
void GPU_global_buffer_pool_free(void);
|
||||
|
||||
GPUBuffer *GPU_buffer_alloc( int size, GPUBufferPool *pool );
|
||||
void GPU_buffer_free( GPUBuffer *buffer, GPUBufferPool *pool );
|
||||
GPUBuffer *GPU_buffer_alloc(int size);
|
||||
void GPU_buffer_free(GPUBuffer *buffer);
|
||||
|
||||
GPUDrawObject *GPU_drawobject_new( struct DerivedMesh *dm );
|
||||
void GPU_drawobject_free( struct DerivedMesh *dm );
|
||||
|
||||
/* Buffers for non-DerivedMesh drawing */
|
||||
void *GPU_build_mesh_buffers(struct GHash *map, struct MVert *mvert,
|
||||
struct MFace *mface, int *face_indices,
|
||||
int totface, int *vert_indices, int uniq_verts,
|
||||
int totvert);
|
||||
void GPU_update_mesh_buffers(void *buffers, struct MVert *mvert,
|
||||
int *vert_indices, int totvert);
|
||||
void *GPU_build_grid_buffers(struct DMGridData **grids,
|
||||
int *grid_indices, int totgrid, int gridsize);
|
||||
void GPU_update_grid_buffers(void *buffers_v, struct DMGridData **grids,
|
||||
int *grid_indices, int totgrid, int gridsize, int smooth);
|
||||
void GPU_draw_buffers(void *buffers);
|
||||
void GPU_free_buffers(void *buffers);
|
||||
|
||||
/* called before drawing */
|
||||
void GPU_vertex_setup( struct DerivedMesh *dm );
|
||||
void GPU_normal_setup( struct DerivedMesh *dm );
|
||||
@ -175,6 +153,7 @@ void GPU_color4_upload( struct DerivedMesh *dm, unsigned char *data );
|
||||
/* switch color rendering on=1/off=0 */
|
||||
void GPU_color_switch( int mode );
|
||||
|
||||
/* used for drawing edges */
|
||||
void GPU_buffer_draw_elements( GPUBuffer *elements, unsigned int mode, int start, int count );
|
||||
|
||||
/* called after drawing */
|
||||
@ -183,4 +162,18 @@ void GPU_buffer_unbind(void);
|
||||
/* used to check whether to use the old (without buffers) code */
|
||||
int GPU_buffer_legacy( struct DerivedMesh *dm );
|
||||
|
||||
/* Buffers for non-DerivedMesh drawing */
|
||||
void *GPU_build_mesh_buffers(struct GHash *map, struct MVert *mvert,
|
||||
struct MFace *mface, int *face_indices,
|
||||
int totface, int *vert_indices, int uniq_verts,
|
||||
int totvert);
|
||||
void GPU_update_mesh_buffers(void *buffers, struct MVert *mvert,
|
||||
int *vert_indices, int totvert);
|
||||
void *GPU_build_grid_buffers(struct DMGridData **grids,
|
||||
int *grid_indices, int totgrid, int gridsize);
|
||||
void GPU_update_grid_buffers(void *buffers_v, struct DMGridData **grids,
|
||||
int *grid_indices, int totgrid, int gridsize, int smooth);
|
||||
void GPU_draw_buffers(void *buffers);
|
||||
void GPU_free_buffers(void *buffers);
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -420,7 +420,7 @@ typedef struct SoftBody {
|
||||
#define OB_SB_SELF 512
|
||||
#define OB_SB_FACECOLL 1024
|
||||
#define OB_SB_EDGECOLL 2048
|
||||
#define OB_SB_COLLFINAL 4096
|
||||
#define OB_SB_COLLFINAL 4096 /* deprecated */
|
||||
#define OB_SB_BIG_UI 8192
|
||||
#define OB_SB_AERO_ANGLE 16384
|
||||
|
||||
|
@ -980,19 +980,19 @@ static void rna_def_font(BlenderRNA *brna, StructRNA *srna)
|
||||
|
||||
prop= RNA_def_property(srna, "font_bold", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "vfontb");
|
||||
RNA_def_property_ui_text(prop, "Font", "");
|
||||
RNA_def_property_ui_text(prop, "Font Bold", "");
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
|
||||
|
||||
prop= RNA_def_property(srna, "font_italic", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "vfonti");
|
||||
RNA_def_property_ui_text(prop, "Font", "");
|
||||
RNA_def_property_ui_text(prop, "Font Italic", "");
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
|
||||
|
||||
prop= RNA_def_property(srna, "font_bold_italic", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "vfontbi");
|
||||
RNA_def_property_ui_text(prop, "Font", "");
|
||||
RNA_def_property_ui_text(prop, "Font Bold Italic", "");
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
|
||||
|
||||
@ -1004,7 +1004,7 @@ static void rna_def_font(BlenderRNA *brna, StructRNA *srna)
|
||||
/* flags */
|
||||
prop= RNA_def_property(srna, "use_fast_edit", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FAST);
|
||||
RNA_def_property_ui_text(prop, "Fast", "Don't fill polygons while editing");
|
||||
RNA_def_property_ui_text(prop, "Fast Editing", "Don't fill polygons while editing");
|
||||
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
|
||||
}
|
||||
|
||||
|
@ -910,13 +910,6 @@ static void rna_def_collision(BlenderRNA *brna)
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Damping", "Amount of damping during collision");
|
||||
RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
|
||||
|
||||
/* Does this belong here?
|
||||
prop= RNA_def_property(srna, "collision_stack", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "softflag", OB_SB_COLLFINAL);
|
||||
RNA_def_property_ui_text(prop, "Collision from Stack", "Pick collision object from modifier stack (softbody only)");
|
||||
RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
|
||||
*/
|
||||
|
||||
prop= RNA_def_property(srna, "absorption", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
|
@ -177,10 +177,7 @@ static void sphere_do(
|
||||
|
||||
/* 3) if we were given a vertex group name,
|
||||
* only those vertices should be affected */
|
||||
defgrp_index = defgroup_name_index(ob, cmd->defgrp_name);
|
||||
|
||||
if ((ob->type == OB_MESH) && dm && defgrp_index >= 0)
|
||||
dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
|
||||
modifier_get_vgroup(ob, dm, cmd->defgrp_name, &dvert, &defgrp_index);
|
||||
|
||||
if(flag & MOD_CAST_SIZE_FROM_RADIUS) {
|
||||
len = cmd->radius;
|
||||
@ -335,10 +332,7 @@ static void cuboid_do(
|
||||
|
||||
/* 3) if we were given a vertex group name,
|
||||
* only those vertices should be affected */
|
||||
defgrp_index = defgroup_name_index(ob, cmd->defgrp_name);
|
||||
|
||||
if ((ob->type == OB_MESH) && dm && defgrp_index >= 0)
|
||||
dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
|
||||
modifier_get_vgroup(ob, dm, cmd->defgrp_name, &dvert, &defgrp_index);
|
||||
|
||||
if (ctrl_ob) {
|
||||
if(flag & MOD_CAST_USE_OB_TRANSFORM) {
|
||||
|
@ -169,7 +169,7 @@ static void displaceModifier_do(
|
||||
{
|
||||
int i;
|
||||
MVert *mvert;
|
||||
MDeformVert *dvert = NULL;
|
||||
MDeformVert *dvert;
|
||||
int defgrp_index;
|
||||
float (*tex_co)[3];
|
||||
float weight= 1.0f; /* init value unused but some compilers may complain */
|
||||
@ -177,11 +177,8 @@ static void displaceModifier_do(
|
||||
if(!dmd->texture) return;
|
||||
if(dmd->strength == 0.0f) return;
|
||||
|
||||
defgrp_index = defgroup_name_index(ob, dmd->defgrp_name);
|
||||
|
||||
mvert = CDDM_get_verts(dm);
|
||||
if(defgrp_index >= 0)
|
||||
dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
|
||||
modifier_get_vgroup(ob, dm, dmd->defgrp_name, &dvert, &defgrp_index);
|
||||
|
||||
tex_co = MEM_callocN(sizeof(*tex_co) * numVerts,
|
||||
"displaceModifier_do tex_co");
|
||||
|
@ -157,9 +157,8 @@ static void deformVerts(ModifierData *md, Object *ob,
|
||||
int i, *index_pt;
|
||||
const float falloff_squared= hmd->falloff * hmd->falloff; /* for faster comparisons */
|
||||
|
||||
int max_dvert= 0;
|
||||
MDeformVert *dvert= NULL;
|
||||
int defgrp_index = -1;
|
||||
MDeformVert *dvert;
|
||||
int defgrp_index, max_dvert;
|
||||
|
||||
/* get world-space matrix of target, corrected for the space the verts are in */
|
||||
if (hmd->subtarget[0] && pchan) {
|
||||
@ -174,21 +173,8 @@ static void deformVerts(ModifierData *md, Object *ob,
|
||||
mul_serie_m4(mat, ob->imat, dmat, hmd->parentinv,
|
||||
NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
if((defgrp_index= defgroup_name_index(ob, hmd->name)) != -1) {
|
||||
Mesh *me = ob->data;
|
||||
if(dm) {
|
||||
dvert= dm->getVertDataArray(dm, CD_MDEFORMVERT);
|
||||
if(dvert) {
|
||||
max_dvert = numVerts;
|
||||
}
|
||||
}
|
||||
else if(me->dvert) {
|
||||
dvert= me->dvert;
|
||||
if(dvert) {
|
||||
max_dvert = me->totvert;
|
||||
}
|
||||
}
|
||||
}
|
||||
modifier_get_vgroup(ob, dm, hmd->name, &dvert, &defgrp_index);
|
||||
max_dvert = (dvert)? numVerts: 0;
|
||||
|
||||
/* Regarding index range checking below.
|
||||
*
|
||||
|
@ -284,10 +284,7 @@ static void meshdeformModifier_do(
|
||||
copy_v3_v3(dco[a], co);
|
||||
}
|
||||
|
||||
defgrp_index = defgroup_name_index(ob, mmd->defgrp_name);
|
||||
|
||||
if(dm && defgrp_index >= 0)
|
||||
dvert= dm->getVertDataArray(dm, CD_MDEFORMVERT);
|
||||
modifier_get_vgroup(ob, dm, mmd->defgrp_name, &dvert, &defgrp_index);
|
||||
|
||||
/* do deformation */
|
||||
fac= 1.0f;
|
||||
|
@ -162,8 +162,8 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object
|
||||
float smd_limit[2], smd_factor;
|
||||
SpaceTransform *transf = NULL, tmp_transf;
|
||||
void (*simpleDeform_callback)(const float factor, const float dcut[3], float *co) = NULL; //Mode callback
|
||||
int vgroup = defgroup_name_index(ob, smd->vgroup_name);
|
||||
MDeformVert *dvert = NULL;
|
||||
int vgroup;
|
||||
MDeformVert *dvert;
|
||||
|
||||
//Safe-check
|
||||
if(smd->origin == ob) smd->origin = NULL; //No self references
|
||||
@ -216,17 +216,7 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object
|
||||
smd_factor = smd->factor / MAX2(FLT_EPSILON, smd_limit[1]-smd_limit[0]);
|
||||
}
|
||||
|
||||
|
||||
if(dm)
|
||||
{
|
||||
dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
|
||||
}
|
||||
else if(ob->type == OB_LATTICE)
|
||||
{
|
||||
dvert = lattice_get_deform_verts(ob);
|
||||
}
|
||||
|
||||
|
||||
modifier_get_vgroup(ob, dm, smd->vgroup_name, &dvert, &vgroup);
|
||||
|
||||
switch(smd->mode)
|
||||
{
|
||||
|
@ -123,10 +123,7 @@ static void smoothModifier_do(
|
||||
medges = dm->getEdgeArray(dm);
|
||||
numDMEdges = dm->getNumEdges(dm);
|
||||
|
||||
defgrp_index = defgroup_name_index(ob, smd->defgrp_name);
|
||||
|
||||
if (defgrp_index >= 0)
|
||||
dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
|
||||
modifier_get_vgroup(ob, dm, smd->defgrp_name, &dvert, &defgrp_index);
|
||||
|
||||
/* NOTICE: this can be optimized a little bit by moving the
|
||||
* if (dvert) out of the loop, if needed */
|
||||
|
@ -48,6 +48,7 @@
|
||||
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
@ -235,12 +236,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
|
||||
float const ofs_new= smd->offset - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset);
|
||||
|
||||
/* weights */
|
||||
MDeformVert *dvert= NULL, *dv= NULL;
|
||||
MDeformVert *dvert, *dv= NULL;
|
||||
const int defgrp_invert = ((smd->flag & MOD_SOLIDIFY_VGROUP_INV) != 0);
|
||||
const int defgrp_index= defgroup_name_index(ob, smd->defgrp_name);
|
||||
int defgrp_index;
|
||||
|
||||
if (defgrp_index >= 0)
|
||||
dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
|
||||
modifier_get_vgroup(ob, dm, smd->defgrp_name, &dvert, &defgrp_index);
|
||||
|
||||
orig_mface = dm->getFaceArray(dm);
|
||||
orig_medge = dm->getEdgeArray(dm);
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "DNA_lattice_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_curve_types.h"
|
||||
@ -47,6 +48,8 @@
|
||||
#include "BLI_math_matrix.h"
|
||||
|
||||
#include "BKE_cdderivedmesh.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_lattice.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_displist.h"
|
||||
|
||||
@ -239,6 +242,19 @@ DerivedMesh *get_dm(Object *ob, struct EditMesh *em, DerivedMesh *dm, float (*ve
|
||||
return dm;
|
||||
}
|
||||
|
||||
void modifier_get_vgroup(Object *ob, DerivedMesh *dm, const char *name, MDeformVert **dvert, int *defgrp_index)
|
||||
{
|
||||
*defgrp_index = defgroup_name_index(ob, name);
|
||||
*dvert = NULL;
|
||||
|
||||
if(*defgrp_index >= 0) {
|
||||
if(ob->type == OB_LATTICE)
|
||||
*dvert = lattice_get_deform_verts(ob);
|
||||
else if(dm)
|
||||
*dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
|
||||
}
|
||||
}
|
||||
|
||||
/* only called by BKE_modifier.h/modifier.c */
|
||||
void modifier_type_init(ModifierTypeInfo *types[])
|
||||
{
|
||||
|
@ -36,14 +36,15 @@
|
||||
/* so modifier types match their defines */
|
||||
#include "MOD_modifiertypes.h"
|
||||
|
||||
struct Tex;
|
||||
struct TexResult;
|
||||
struct CustomData;
|
||||
struct DerivedMesh;
|
||||
struct EditMesh;
|
||||
struct MDeformVert;
|
||||
struct ModifierData;
|
||||
struct Object;
|
||||
struct Scene;
|
||||
struct EditMesh;
|
||||
struct ModifierData;
|
||||
struct Tex;
|
||||
struct TexResult;
|
||||
|
||||
void get_texture_value(struct Tex *texture, float *tex_co, struct TexResult *texres);
|
||||
void get_texture_coords(struct MappingInfoModifierData *dmd, struct Object *ob, struct DerivedMesh *dm, float (*co)[3], float (*texco)[3], int numVerts);
|
||||
@ -51,5 +52,6 @@ void modifier_vgroup_cache(struct ModifierData *md, float (*vertexCos)[3]);
|
||||
void validate_layer_name(const struct CustomData *data, int type, char *name, char *outname);
|
||||
struct DerivedMesh *get_cddm(struct Object *ob, struct EditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3]);
|
||||
struct DerivedMesh *get_dm(struct Object *ob, struct EditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3], int orco);
|
||||
void modifier_get_vgroup(struct Object *ob, DerivedMesh *dm, const char *name, struct MDeformVert **dvert, int *defgrp_index);
|
||||
|
||||
#endif /* MOD_UTIL_H */
|
||||
|
@ -85,8 +85,8 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
|
||||
CustomDataMask dataMask = 0;
|
||||
|
||||
/* ask for vertexgroups if we need them */
|
||||
if(wmd->defgrp_name[0]) dataMask |= (1 << CD_MDEFORMVERT);
|
||||
dataMask |= (1 << CD_MDEFORMVERT);
|
||||
if(wmd->defgrp_name[0]) dataMask |= (CD_MASK_MDEFORMVERT);
|
||||
dataMask |= (CD_MASK_MDEFORMVERT);
|
||||
|
||||
/* ask for UV coordinates if we need them */
|
||||
if(wmd->texmapping == MOD_DISP_MAP_UV) dataMask |= (1 << CD_MTFACE);
|
||||
@ -174,14 +174,16 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
|
||||
float strength = wmd->strength;
|
||||
float fac = 1.0f, weight;
|
||||
int i;
|
||||
int defgrp_index = defgroup_name_index(ob, wmd->defgrp_name);
|
||||
MDeformVert *dv= NULL;
|
||||
int defgrp_index;
|
||||
MDeformVert *dvert, *dv= NULL;
|
||||
|
||||
float (*tex_co)[3]= NULL;
|
||||
|
||||
if(!(wmd->object_from && wmd->object_to))
|
||||
return;
|
||||
|
||||
modifier_get_vgroup(ob, dm, wmd->defgrp_name, &dvert, &defgrp_index);
|
||||
|
||||
if(wmd->curfalloff==NULL) /* should never happen, but bad lib linking could cause it */
|
||||
wmd->curfalloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
|
||||
@ -221,8 +223,8 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
|
||||
((fac=len_v3v3(co, mat_from[3])) < wmd->falloff_radius && (fac=(wmd->falloff_radius-fac)/wmd->falloff_radius)) ) {
|
||||
|
||||
/* skip if no vert group found */
|
||||
if(defgrp_index >= 0) {
|
||||
dv = dm->getVertData(dm, i, CD_MDEFORMVERT);
|
||||
if(dvert && defgrp_index >= 0) {
|
||||
dv = &dvert[i];
|
||||
|
||||
if(dv) {
|
||||
weight = defvert_find_weight(dv, defgrp_index) * wmd->strength;
|
||||
|
@ -256,7 +256,7 @@ static void waveModifier_do(WaveModifierData *md,
|
||||
{
|
||||
WaveModifierData *wmd = (WaveModifierData*) md;
|
||||
MVert *mvert = NULL;
|
||||
MDeformVert *dvert = NULL;
|
||||
MDeformVert *dvert;
|
||||
int defgrp_index;
|
||||
float ctime = BKE_curframe(scene);
|
||||
float minfac =
|
||||
@ -281,11 +281,7 @@ static void waveModifier_do(WaveModifierData *md,
|
||||
}
|
||||
|
||||
/* get the index of the deform group */
|
||||
defgrp_index = defgroup_name_index(ob, wmd->defgrp_name);
|
||||
|
||||
if(defgrp_index >= 0){
|
||||
dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
|
||||
}
|
||||
modifier_get_vgroup(ob, dm, wmd->defgrp_name, &dvert, &defgrp_index);
|
||||
|
||||
if(wmd->damp == 0) wmd->damp = 10.0f;
|
||||
|
||||
|
@ -226,7 +226,7 @@ static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in,
|
||||
GPUShadeInput shi;
|
||||
GPUShadeResult shr;
|
||||
bNodeSocket *sock;
|
||||
char hasinput[NUM_MAT_IN];
|
||||
char hasinput[NUM_MAT_IN]= {'\0'};
|
||||
int i;
|
||||
|
||||
/* note: cannot use the in[]->hasinput flags directly, as these are not necessarily
|
||||
|
@ -36,8 +36,6 @@
|
||||
#include "BLI_path_util.h"
|
||||
#endif
|
||||
|
||||
#define PYC_INTERPRETER_ACTIVE (((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) != NULL)
|
||||
|
||||
/* array utility function */
|
||||
int PyC_AsArray(void *array, PyObject *value, const int length, const PyTypeObject *type, const short is_double, const char *error_prefix)
|
||||
{
|
||||
|
@ -50,4 +50,6 @@ void PyC_MainModule_Restore(PyObject *main_mod);
|
||||
|
||||
void PyC_SetHomePath(const char *py_path_bundle);
|
||||
|
||||
#define PYC_INTERPRETER_ACTIVE (((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) != NULL)
|
||||
|
||||
#endif // PY_CAPI_UTILS_H
|
||||
|
@ -41,6 +41,8 @@
|
||||
|
||||
#include "bpy_driver.h"
|
||||
|
||||
#include "../generic/py_capi_utils.h"
|
||||
|
||||
/* for pydrivers (drivers using one-line Python expressions to express relationships between targets) */
|
||||
PyObject *bpy_pydriver_Dict= NULL;
|
||||
|
||||
@ -87,7 +89,7 @@ int bpy_pydriver_create_dict(void)
|
||||
void BPY_driver_reset(void)
|
||||
{
|
||||
PyGILState_STATE gilstate;
|
||||
int use_gil= 1; // (PyThreadState_Get()==NULL);
|
||||
int use_gil= !PYC_INTERPRETER_ACTIVE;
|
||||
|
||||
if(use_gil)
|
||||
gilstate= PyGILState_Ensure();
|
||||
@ -120,7 +122,7 @@ static void pydriver_error(ChannelDriver *driver)
|
||||
*
|
||||
* note: PyGILState_Ensure() isnt always called because python can call the
|
||||
* bake operator which intern starts a thread which calls scene update which
|
||||
* does a driver update. to avoid a deadlock check PyThreadState_Get() if PyGILState_Ensure() is needed.
|
||||
* does a driver update. to avoid a deadlock check PYC_INTERPRETER_ACTIVE if PyGILState_Ensure() is needed.
|
||||
*/
|
||||
float BPY_driver_exec(ChannelDriver *driver)
|
||||
{
|
||||
@ -147,7 +149,7 @@ float BPY_driver_exec(ChannelDriver *driver)
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
use_gil= 1; //(PyThreadState_Get()==NULL);
|
||||
use_gil= !PYC_INTERPRETER_ACTIVE;
|
||||
|
||||
if(use_gil)
|
||||
gilstate= PyGILState_Ensure();
|
||||
|
@ -663,7 +663,9 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
|
||||
#include "BLI_storage.h"
|
||||
/* TODO, reloading the module isnt functional at the moment. */
|
||||
|
||||
extern int main_python(int argc, const char **argv);
|
||||
static void bpy_module_free(void *mod);
|
||||
extern int main_python_enter(int argc, const char **argv);
|
||||
extern void main_python_exit(void);
|
||||
static struct PyModuleDef bpy_proxy_def= {
|
||||
PyModuleDef_HEAD_INIT,
|
||||
"bpy", /* m_name */
|
||||
@ -673,8 +675,8 @@ static struct PyModuleDef bpy_proxy_def= {
|
||||
NULL, /* m_reload */
|
||||
NULL, /* m_traverse */
|
||||
NULL, /* m_clear */
|
||||
NULL, /* m_free */
|
||||
};
|
||||
bpy_module_free, /* m_free */
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
@ -699,7 +701,7 @@ void bpy_module_delay_init(PyObject *bpy_proxy)
|
||||
|
||||
// printf("module found %s\n", argv[0]);
|
||||
|
||||
main_python(argc, argv);
|
||||
main_python_enter(argc, argv);
|
||||
|
||||
/* initialized in BPy_init_modules() */
|
||||
PyDict_Update(PyModule_GetDict(bpy_proxy), PyModule_GetDict(bpy_package_py));
|
||||
@ -756,4 +758,9 @@ PyInit_bpy(void)
|
||||
return bpy_proxy;
|
||||
}
|
||||
|
||||
static void bpy_module_free(void *UNUSED(mod))
|
||||
{
|
||||
main_python_exit();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -3847,9 +3847,11 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
|
||||
case PROP_RAW_DOUBLE:
|
||||
item= PyFloat_FromDouble((double) ((double *)array)[i]);
|
||||
break;
|
||||
case PROP_RAW_UNSET:
|
||||
default: /* PROP_RAW_UNSET */
|
||||
/* should never happen */
|
||||
BLI_assert(!"Invalid array type - get");
|
||||
item= Py_None;
|
||||
Py_INCREF(item);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1798,10 +1798,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
|
||||
pa_size = pa->size;
|
||||
|
||||
BLI_srandom(psys->seed+a);
|
||||
|
||||
r_tilt = 2.0f*(BLI_frand() - 0.5f);
|
||||
r_length = BLI_frand();
|
||||
r_tilt = 2.0f*(PSYS_FRAND(a) - 0.5f);
|
||||
r_length = PSYS_FRAND(a+1);
|
||||
|
||||
if(path_nbr) {
|
||||
cache = psys->pathcache[a];
|
||||
@ -2047,7 +2045,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
mul_m4_v3(psys->parent->obmat, state.co);
|
||||
|
||||
if(use_duplimat)
|
||||
mul_m4_v4(duplimat, state.co);
|
||||
mul_m4_v3(duplimat, state.co);
|
||||
|
||||
if(part->ren_as == PART_DRAW_BB) {
|
||||
bb.random = random;
|
||||
@ -2932,8 +2930,10 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
|
||||
vlr->v3= RE_findOrAddVert(obr, startvert+index[2]);
|
||||
vlr->v4= NULL;
|
||||
|
||||
normal_tri_v3(tmp, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
add_v3_v3(n, tmp);
|
||||
if(area_tri_v3(vlr->v3->co, vlr->v2->co, vlr->v1->co)>FLT_EPSILON) {
|
||||
normal_tri_v3(tmp, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
add_v3_v3(n, tmp);
|
||||
}
|
||||
|
||||
vlr->mat= matar[ dl->col ];
|
||||
vlr->flag= 0;
|
||||
|
@ -416,7 +416,7 @@ void WM_exit(bContext *C)
|
||||
BPY_python_end();
|
||||
#endif
|
||||
|
||||
GPU_buffer_pool_free(NULL);
|
||||
GPU_global_buffer_pool_free();
|
||||
GPU_free_unused_buffers();
|
||||
GPU_extensions_exit();
|
||||
|
||||
|
@ -1134,7 +1134,8 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
|
||||
|
||||
#ifdef WITH_PYTHON_MODULE
|
||||
/* allow python module to call main */
|
||||
#define main main_python
|
||||
#define main main_python_enter
|
||||
static void *evil_C= NULL;
|
||||
#endif
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
@ -1145,6 +1146,7 @@ int main(int argc, const char **argv)
|
||||
|
||||
#ifdef WITH_PYTHON_MODULE
|
||||
#undef main
|
||||
evil_C= C;
|
||||
#endif
|
||||
|
||||
#ifdef WITH_BINRELOC
|
||||
@ -1313,6 +1315,14 @@ int main(int argc, const char **argv)
|
||||
return 0;
|
||||
} /* end of int main(argc,argv) */
|
||||
|
||||
#ifdef WITH_PYTHON_MODULE
|
||||
void main_python_exit(void)
|
||||
{
|
||||
WM_exit((bContext *)evil_C);
|
||||
evil_C= NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void error_cb(const char *err)
|
||||
{
|
||||
|
||||
|
@ -1147,7 +1147,7 @@ PyObject *PyObjectPlus::NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v
|
||||
BGE_PROXY_REF(proxy) = NULL;
|
||||
BGE_PROXY_PTR(proxy) = ptr;
|
||||
#ifdef USE_WEAKREFS
|
||||
BGE_PROXY_WKREF(self->m_proxy) = NULL;
|
||||
BGE_PROXY_WKREF(proxy) = NULL;
|
||||
#endif
|
||||
return proxy;
|
||||
}
|
||||
|
@ -1022,10 +1022,8 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, getScreenRay,
|
||||
return NULL;
|
||||
|
||||
PyObject* argValue = PyTuple_New(2);
|
||||
if (argValue) {
|
||||
PyTuple_SET_ITEM(argValue, 0, PyFloat_FromDouble(x));
|
||||
PyTuple_SET_ITEM(argValue, 1, PyFloat_FromDouble(y));
|
||||
}
|
||||
PyTuple_SET_ITEM(argValue, 0, PyFloat_FromDouble(x));
|
||||
PyTuple_SET_ITEM(argValue, 1, PyFloat_FromDouble(y));
|
||||
|
||||
if(!PyVecTo(PygetScreenVect(argValue), vect))
|
||||
{
|
||||
|
@ -334,7 +334,7 @@ void KX_GameObject::RemoveParent(KX_Scene *scene)
|
||||
rootobj->m_pPhysicsController1->RemoveCompoundChild(m_pPhysicsController1);
|
||||
}
|
||||
m_pPhysicsController1->RestoreDynamics();
|
||||
if (m_pPhysicsController1->IsDyna() && rootobj->m_pPhysicsController1)
|
||||
if (m_pPhysicsController1->IsDyna() && (rootobj != NULL && rootobj->m_pPhysicsController1))
|
||||
{
|
||||
// dynamic object should remember the velocity they had while being parented
|
||||
MT_Point3 childPoint = GetSGNode()->GetWorldPosition();
|
||||
|
Loading…
Reference in New Issue
Block a user