forked from bartvdbraak/blender
svn merge ^/trunk/blender -r42095:42116
This commit is contained in:
commit
f28fd56f8f
22
GNUmakefile
22
GNUmakefile
@ -92,6 +92,17 @@ CMAKE_CONFIG = cmake $(BUILD_CMAKE_ARGS) \
|
||||
-DCMAKE_BUILD_TYPE:STRING=$(BUILD_TYPE)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Tool for 'make config'
|
||||
|
||||
# X11 spesific
|
||||
ifdef DISPLAY
|
||||
CMAKE_CONFIG_TOOL = cmake-gui
|
||||
else
|
||||
CMAKE_CONFIG_TOOL = ccmake
|
||||
endif
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Build Blender
|
||||
all:
|
||||
@ -115,8 +126,15 @@ lite: all
|
||||
headless: all
|
||||
bpy: all
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Helo for build targets
|
||||
# Configuration (save some cd'ing around)
|
||||
config:
|
||||
$(CMAKE_CONFIG_TOOL) $(BUILD_DIR)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Help for build targets
|
||||
help:
|
||||
@echo ""
|
||||
@echo "Convenience targets provided for building blender, (multiple at once can be used)"
|
||||
@ -125,6 +143,8 @@ help:
|
||||
@echo " * headless - build without an interface (renderfarm or server automation)"
|
||||
@echo " * bpy - build as a python module which can be loaded from python directly"
|
||||
@echo ""
|
||||
@echo " * config - run cmake configuration tool to set build options"
|
||||
@echo ""
|
||||
@echo " Note, passing the argument 'BUILD_DIR=path' when calling make will override the default build dir."
|
||||
@echo " Note, passing the argument 'BUILD_CMAKE_ARGS=args' lets you add cmake arguments."
|
||||
@echo ""
|
||||
|
@ -319,20 +319,11 @@ def creator(env):
|
||||
incs = ['#/intern/guardedalloc', '#/source/blender/blenlib', '#/source/blender/blenkernel', '#/source/blender/editors/include', '#/source/blender/blenloader', '#/source/blender/imbuf', '#/source/blender/renderconverter', '#/source/blender/render/extern/include', '#/source/blender/windowmanager', '#/source/blender/makesdna', '#/source/blender/makesrna', '#/source/gameengine/BlenderRoutines', '#/extern/glew/include', '#/source/blender/gpu', env['BF_OPENGL_INC']]
|
||||
|
||||
defs = []
|
||||
if env['WITH_BF_QUICKTIME']:
|
||||
incs.append(env['BF_QUICKTIME_INC'])
|
||||
defs.append('WITH_QUICKTIME')
|
||||
|
||||
if env['WITH_BF_BINRELOC']:
|
||||
incs.append('#/extern/binreloc/include')
|
||||
defs.append('WITH_BINRELOC')
|
||||
|
||||
if env['WITH_BF_OPENEXR']:
|
||||
defs.append('WITH_OPENEXR')
|
||||
|
||||
if env['WITH_BF_TIFF']:
|
||||
defs.append('WITH_TIFF')
|
||||
|
||||
if env['WITH_BF_SDL']:
|
||||
defs.append('WITH_SDL')
|
||||
|
||||
|
@ -278,7 +278,7 @@ layer that contains the vertex attribute.
|
||||
|
||||
.. data:: CD_MTFACE
|
||||
|
||||
Vertex attribute is a UV layer. Data type is vector of 2 float.
|
||||
Vertex attribute is a UV Map. Data type is vector of 2 float.
|
||||
|
||||
There can be more than one attribute of that type, they are differenciated by name.
|
||||
In blender, you can retrieve the attribute data with:
|
||||
@ -495,10 +495,10 @@ Functions
|
||||
for uniform in shader['uniforms']:
|
||||
if uniform['type'] == gpu.GPU_DYNAMIC_SAMPLER_2DIMAGE:
|
||||
print("uniform {0} is using image {1}".format(uniform['varname'], uniform['image'].filepath))
|
||||
# scan the attribute list and find the UV layer used in the shader
|
||||
# scan the attribute list and find the UV Map used in the shader
|
||||
for attribute in shader['attributes']:
|
||||
if attribute['type'] == gpu.CD_MTFACE:
|
||||
print("attribute {0} is using UV layer {1}".format(attribute['varname'], attribute['name']))
|
||||
print("attribute {0} is using UV Map {1}".format(attribute['varname'], attribute['name']))
|
||||
|
||||
*****
|
||||
Notes
|
||||
|
@ -201,6 +201,8 @@ void CameraIntrinsics::ComputeLookupGrid(Grid* grid, int width, int height, doub
|
||||
warp_y = warp_y*aspy + 0.5 * overscan * h;
|
||||
int ix = int(warp_x), iy = int(warp_y);
|
||||
int fx = round((warp_x-ix)*256), fy = round((warp_y-iy)*256);
|
||||
if(fx == 256) { fx=0; ix++; }
|
||||
if(fy == 256) { fy=0; iy++; }
|
||||
// Use nearest border pixel
|
||||
if( ix < 0 ) { ix = 0, fx = 0; }
|
||||
if( iy < 0 ) { iy = 0, fy = 0; }
|
||||
|
@ -144,7 +144,7 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<
|
||||
}
|
||||
}
|
||||
|
||||
/* create uv layer attributes */
|
||||
/* create uv map attributes */
|
||||
{
|
||||
BL::Mesh::uv_textures_iterator l;
|
||||
|
||||
|
@ -21,7 +21,45 @@ import bpy
|
||||
import os
|
||||
import shutil
|
||||
from bpy.types import Operator
|
||||
from bpy_extras.io_utils import unpack_list
|
||||
from bpy_extras.io_utils import unpack_list, unpack_face_list
|
||||
|
||||
from mathutils import Vector, Matrix
|
||||
|
||||
|
||||
def CLIP_spacees_walk(context, all_screens, tarea, tspace, callback, *args):
|
||||
screens = bpy.data.screens if all_screens else [context.screen]
|
||||
|
||||
for screen in screens:
|
||||
for area in screen.areas:
|
||||
if area.type == tarea:
|
||||
for space in area.spaces:
|
||||
if space.type == tspace:
|
||||
callback(space, *args)
|
||||
|
||||
|
||||
def CLIP_set_viewport_background(context, all_screens, clip, clip_user):
|
||||
def set_background(space_v3d, clip, user):
|
||||
bgpic = None
|
||||
|
||||
for x in space_v3d.background_images:
|
||||
if x.source == 'MOVIE':
|
||||
bgpic = x
|
||||
break
|
||||
|
||||
if not bgpic:
|
||||
bgpic = space_v3d.background_images.new()
|
||||
|
||||
bgpic.source = 'MOVIE'
|
||||
bgpic.clip = clip
|
||||
bgpic.clip_user.proxy_render_size = user.proxy_render_size
|
||||
bgpic.clip_user.use_render_undistorted = True
|
||||
bgpic.use_camera_clip = False
|
||||
bgpic.view_axis = 'CAMERA'
|
||||
|
||||
space_v3d.show_background_images = True
|
||||
|
||||
CLIP_spacees_walk(context, all_screens, 'VIEW_3D', 'VIEW_3D',
|
||||
set_background, clip, clip_user)
|
||||
|
||||
|
||||
def CLIP_track_view_selected(sc, track):
|
||||
@ -51,8 +89,8 @@ class CLIP_OT_track_to_empty(Operator):
|
||||
|
||||
ob = bpy.data.objects.new(name=track.name, object_data=None)
|
||||
ob.select = True
|
||||
bpy.context.scene.objects.link(ob)
|
||||
bpy.context.scene.objects.active = ob
|
||||
context.scene.objects.link(ob)
|
||||
context.scene.objects.active = ob
|
||||
|
||||
for con in ob.constraints:
|
||||
if con.type == 'FOLLOW_TRACK':
|
||||
@ -106,7 +144,7 @@ class CLIP_OT_bundles_to_mesh(Operator):
|
||||
|
||||
ob = bpy.data.objects.new(name="Tracks", object_data=mesh)
|
||||
|
||||
bpy.context.scene.objects.link(ob)
|
||||
context.scene.objects.link(ob)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
@ -202,35 +240,9 @@ class CLIP_OT_set_viewport_background(Operator):
|
||||
|
||||
return sc.clip
|
||||
|
||||
def _set_background(self, space_v3d, clip, user):
|
||||
bgpic = None
|
||||
|
||||
for x in space_v3d.background_images:
|
||||
if x.source == 'MOVIE':
|
||||
bgpic = x
|
||||
break
|
||||
|
||||
if not bgpic:
|
||||
bgpic = space_v3d.background_images.new()
|
||||
|
||||
bgpic.source = 'MOVIE'
|
||||
bgpic.clip = clip
|
||||
bgpic.clip_user.proxy_render_size = user.proxy_render_size
|
||||
bgpic.clip_user.use_render_undistorted = user.use_render_undistorted
|
||||
bgpic.use_camera_clip = False
|
||||
bgpic.view_axis = 'CAMERA'
|
||||
|
||||
space_v3d.show_background_images = True
|
||||
|
||||
def execute(self, context):
|
||||
sc = context.space_data
|
||||
clip = sc.clip
|
||||
|
||||
for area in context.window.screen.areas:
|
||||
if area.type == 'VIEW_3D':
|
||||
for space in area.spaces:
|
||||
if space.type == 'VIEW_3D':
|
||||
self._set_background(space, clip, sc.clip_user)
|
||||
CLIP_set_viewport_background(context, False, sc.clip, sc.clip_user)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
@ -332,3 +344,430 @@ object's movement caused by this constraint"""
|
||||
self._bake_object(scene, ob)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class CLIP_OT_setup_tracking_scene(Operator):
|
||||
"""Prepare scene for compositing 3D objects into this footage"""
|
||||
|
||||
bl_idname = "clip.setup_tracking_scene"
|
||||
bl_label = "Setup Tracking Scene"
|
||||
bl_options = {'UNDO', 'REGISTER'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
sc = context.space_data
|
||||
|
||||
if sc.type != 'CLIP_EDITOR':
|
||||
return False
|
||||
|
||||
clip = sc.clip
|
||||
|
||||
return clip and clip.tracking.reconstruction.is_valid
|
||||
|
||||
@staticmethod
|
||||
def _setupScene(context):
|
||||
scene = context.scene
|
||||
scene.active_clip = context.space_data.clip
|
||||
|
||||
@staticmethod
|
||||
def _setupWorld(context):
|
||||
scene = context.scene
|
||||
world = scene.world
|
||||
|
||||
if not world:
|
||||
world = bpy.data.worlds.new(name="World")
|
||||
scene.world = world
|
||||
|
||||
world.light_settings.use_ambient_occlusion = True
|
||||
world.light_settings.ao_blend_type = 'MULTIPLY'
|
||||
|
||||
world.light_settings.use_environment_light = True
|
||||
world.light_settings.environment_energy = 0.1
|
||||
|
||||
world.light_settings.distance = 1.0
|
||||
world.light_settings.sample_method = 'ADAPTIVE_QMC'
|
||||
world.light_settings.samples = 7
|
||||
world.light_settings.threshold = 0.005
|
||||
|
||||
@staticmethod
|
||||
def _findOrCreateCamera(context):
|
||||
scene = context.scene
|
||||
|
||||
if scene.camera:
|
||||
return scene.camera
|
||||
|
||||
cam = bpy.data.cameras.new(name="Camera")
|
||||
camob = bpy.data.objects.new(name="Camera", object_data=cam)
|
||||
scene.objects.link(camob)
|
||||
|
||||
scene.camera = camob
|
||||
|
||||
camob.matrix_local = (Matrix.Translation((7.481, -6.508, 5.344)) *
|
||||
Matrix.Rotation(0.815, 4, 'Z') *
|
||||
Matrix.Rotation(0.011, 4, 'Y') *
|
||||
Matrix.Rotation(1.109, 4, 'X'))
|
||||
|
||||
return camob
|
||||
|
||||
@staticmethod
|
||||
def _setupCamera(context):
|
||||
camob = CLIP_OT_setup_tracking_scene._findOrCreateCamera(context)
|
||||
|
||||
# Remove all constraints to be sure motion is fine
|
||||
camob.constraints.clear()
|
||||
|
||||
# Append camera solver constraint
|
||||
con = camob.constraints.new(type='CAMERA_SOLVER')
|
||||
con.use_active_clip = True
|
||||
con.influence = 1.0
|
||||
|
||||
@staticmethod
|
||||
def _setupViewport(context):
|
||||
sc = context.space_data
|
||||
CLIP_set_viewport_background(context, True, sc.clip, sc.clip_user)
|
||||
|
||||
@staticmethod
|
||||
def _setupRenderLayers(context):
|
||||
scene = context.scene
|
||||
rlayers = scene.render.layers
|
||||
|
||||
if not scene.render.layers.get("Foreground"):
|
||||
if len(rlayers) == 1:
|
||||
fg = rlayers[0]
|
||||
fg.name = 'Foreground'
|
||||
else:
|
||||
fg = scene.render.layers.new('Foreground')
|
||||
|
||||
fg.use_sky = False
|
||||
fg.layers = [True] + [False] * 19
|
||||
fg.layers_zmask = [False] * 10 + [True] + [False] * 9
|
||||
fg.use_pass_vector = True
|
||||
|
||||
if not scene.render.layers.get("Background"):
|
||||
bg = scene.render.layers.new('Background')
|
||||
bg.use_pass_shadow = True
|
||||
bg.use_pass_ambient_occlusion = True
|
||||
bg.layers = [False] * 10 + [True] + [False] * 9
|
||||
|
||||
@staticmethod
|
||||
def _findNode(tree, type):
|
||||
for node in tree.nodes:
|
||||
if node.type == type:
|
||||
return node
|
||||
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def _findOrCreateNode(tree, type):
|
||||
node = CLIP_OT_setup_tracking_scene._findNode(tree, type)
|
||||
|
||||
if not node:
|
||||
node = tree.nodes.new(type=type)
|
||||
|
||||
return node
|
||||
|
||||
@staticmethod
|
||||
def _needSetupNodes(context):
|
||||
scene = context.scene
|
||||
tree = scene.node_tree
|
||||
|
||||
if not tree:
|
||||
# No compositor node tree found, time to create it!
|
||||
return True
|
||||
|
||||
for node in tree.nodes:
|
||||
if node.type in {'MOVIECLIP', 'MOVIEDISTORTION'}:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
def _offsetNodes(tree):
|
||||
for a in tree.nodes:
|
||||
for b in tree.nodes:
|
||||
if a != b and a.location == b.location:
|
||||
b.location += Vector((40.0, 20.0))
|
||||
|
||||
def _setupNodes(self, context):
|
||||
if not self._needSetupNodes(context):
|
||||
# compositor nodes were already setup or even changes already
|
||||
# do nothing to prevent nodes damage
|
||||
return
|
||||
|
||||
# Enable backdrop for all compositor spaces
|
||||
def setup_space(space):
|
||||
space.show_backdrop = True
|
||||
|
||||
CLIP_spacees_walk(context, True, 'NODE_EDITOR', 'NODE_EDITOR',
|
||||
setup_space)
|
||||
|
||||
sc = context.space_data
|
||||
scene = context.scene
|
||||
scene.use_nodes = True
|
||||
tree = scene.node_tree
|
||||
clip = sc.clip
|
||||
|
||||
need_stabilization = False
|
||||
|
||||
# create nodes
|
||||
rlayer_fg = self._findOrCreateNode(tree, 'R_LAYERS')
|
||||
rlayer_bg = tree.nodes.new(type='R_LAYERS')
|
||||
composite = self._findOrCreateNode(tree, 'COMPOSITE')
|
||||
|
||||
movieclip = tree.nodes.new(type='MOVIECLIP')
|
||||
distortion = tree.nodes.new(type='MOVIEDISTORTION')
|
||||
|
||||
if need_stabilization:
|
||||
stabilize = tree.nodes.new(type='STABILIZE2D')
|
||||
|
||||
scale = tree.nodes.new(type='SCALE')
|
||||
invert = tree.nodes.new(type='INVERT')
|
||||
add_ao = tree.nodes.new(type='MIX_RGB')
|
||||
add_shadow = tree.nodes.new(type='MIX_RGB')
|
||||
mul_shadow = tree.nodes.new(type='MIX_RGB')
|
||||
mul_image = tree.nodes.new(type='MIX_RGB')
|
||||
vector_blur = tree.nodes.new(type='VECBLUR')
|
||||
alphaover = tree.nodes.new(type='ALPHAOVER')
|
||||
viewer = tree.nodes.new(type='VIEWER')
|
||||
|
||||
# setup nodes
|
||||
movieclip.clip = clip
|
||||
|
||||
distortion.clip = clip
|
||||
distortion.distortion_type = 'UNDISTORT'
|
||||
|
||||
if need_stabilization:
|
||||
stabilize.clip = clip
|
||||
|
||||
scale.space = 'RENDER_SIZE'
|
||||
|
||||
rlayer_bg.scene = scene
|
||||
rlayer_bg.layer = "Background"
|
||||
|
||||
rlayer_fg.scene = scene
|
||||
rlayer_fg.layer = "Foreground"
|
||||
|
||||
add_ao.blend_type = 'ADD'
|
||||
add_shadow.blend_type = 'ADD'
|
||||
|
||||
mul_shadow.blend_type = 'MULTIPLY'
|
||||
mul_shadow.inputs['Fac'].default_value = 0.8
|
||||
|
||||
mul_image.blend_type = 'MULTIPLY'
|
||||
mul_image.inputs['Fac'].default_value = 0.8
|
||||
|
||||
vector_blur.factor = 0.75
|
||||
|
||||
# create links
|
||||
tree.links.new(movieclip.outputs['Image'], distortion.inputs['Image'])
|
||||
|
||||
if need_stabilization:
|
||||
tree.links.new(distortion.outputs['Image'],
|
||||
stabilize.inputs['Image'])
|
||||
tree.links.new(stabilize.outputs['Image'], scale.inputs['Image'])
|
||||
else:
|
||||
tree.links.new(distortion.outputs['Image'], scale.inputs['Image'])
|
||||
|
||||
tree.links.new(rlayer_bg.outputs['Alpha'], invert.inputs['Color'])
|
||||
|
||||
tree.links.new(invert.outputs['Color'], add_shadow.inputs[1])
|
||||
tree.links.new(rlayer_bg.outputs['Shadow'], add_shadow.inputs[2])
|
||||
|
||||
tree.links.new(invert.outputs['Color'], add_ao.inputs[1])
|
||||
tree.links.new(rlayer_bg.outputs['AO'], add_ao.inputs[2])
|
||||
|
||||
tree.links.new(add_ao.outputs['Image'], mul_shadow.inputs[1])
|
||||
tree.links.new(add_shadow.outputs['Image'], mul_shadow.inputs[2])
|
||||
|
||||
tree.links.new(scale.outputs['Image'], mul_image.inputs[1])
|
||||
tree.links.new(mul_shadow.outputs['Image'], mul_image.inputs[2])
|
||||
|
||||
tree.links.new(rlayer_fg.outputs['Image'], vector_blur.inputs['Image'])
|
||||
tree.links.new(rlayer_fg.outputs['Z'], vector_blur.inputs['Z'])
|
||||
tree.links.new(rlayer_fg.outputs['Speed'], vector_blur.inputs['Speed'])
|
||||
|
||||
tree.links.new(mul_image.outputs['Image'], alphaover.inputs[1])
|
||||
tree.links.new(vector_blur.outputs['Image'], alphaover.inputs[2])
|
||||
|
||||
tree.links.new(alphaover.outputs['Image'], composite.inputs['Image'])
|
||||
tree.links.new(alphaover.outputs['Image'], viewer.inputs['Image'])
|
||||
|
||||
# place nodes
|
||||
movieclip.location = Vector((-300.0, 350.0))
|
||||
|
||||
distortion.location = movieclip.location
|
||||
distortion.location += Vector((200.0, 0.0))
|
||||
|
||||
if need_stabilization:
|
||||
stabilize.location = distortion.location
|
||||
stabilize.location += Vector((200.0, 0.0))
|
||||
|
||||
scale.location = stabilize.location
|
||||
scale.location += Vector((200.0, 0.0))
|
||||
else:
|
||||
scale.location = distortion.location
|
||||
scale.location += Vector((200.0, 0.0))
|
||||
|
||||
rlayer_bg.location = movieclip.location
|
||||
rlayer_bg.location -= Vector((0.0, 350.0))
|
||||
|
||||
invert.location = rlayer_bg.location
|
||||
invert.location += Vector((250.0, 50.0))
|
||||
|
||||
add_ao.location = invert.location
|
||||
add_ao.location[0] += 200
|
||||
add_ao.location[1] = rlayer_bg.location[1]
|
||||
|
||||
add_shadow.location = add_ao.location
|
||||
add_shadow.location -= Vector((0.0, 250.0))
|
||||
|
||||
mul_shadow.location = add_ao.location
|
||||
mul_shadow.location += Vector((200.0, -50.0))
|
||||
|
||||
mul_image.location = mul_shadow.location
|
||||
mul_image.location += Vector((300.0, 200.0))
|
||||
|
||||
rlayer_fg.location = rlayer_bg.location
|
||||
rlayer_fg.location -= Vector((0.0, 500.0))
|
||||
|
||||
vector_blur.location[0] = mul_image.location[0]
|
||||
vector_blur.location[1] = rlayer_fg.location[1]
|
||||
|
||||
alphaover.location[0] = vector_blur.location[0] + 350
|
||||
alphaover.location[1] = \
|
||||
(vector_blur.location[1] + mul_image.location[1]) / 2
|
||||
|
||||
composite.location = alphaover.location
|
||||
composite.location += Vector((200.0, -100.0))
|
||||
|
||||
viewer.location = composite.location
|
||||
composite.location += Vector((0.0, 200.0))
|
||||
|
||||
# ensure no nodes were creates on position of existing node
|
||||
self._offsetNodes(tree)
|
||||
|
||||
@staticmethod
|
||||
def _createMesh(scene, name, vertices, faces):
|
||||
mesh = bpy.data.meshes.new(name=name)
|
||||
|
||||
mesh.vertices.add(len(vertices))
|
||||
mesh.vertices.foreach_set("co", unpack_list(vertices))
|
||||
|
||||
mesh.faces.add(len(faces))
|
||||
mesh.faces.foreach_set("vertices_raw", unpack_face_list(faces))
|
||||
|
||||
mesh.update(calc_edges=True)
|
||||
|
||||
ob = bpy.data.objects.new(name=name, object_data=mesh)
|
||||
|
||||
scene.objects.link(ob)
|
||||
|
||||
return ob
|
||||
|
||||
@staticmethod
|
||||
def _getPlaneVertices(half_size, z):
|
||||
|
||||
return [(-half_size, -half_size, z),
|
||||
(-half_size, half_size, z),
|
||||
(half_size, half_size, z),
|
||||
(half_size, -half_size, z)]
|
||||
|
||||
def _createGround(self, scene):
|
||||
vertices = self._getPlaneVertices(4.0, 0.0)
|
||||
faces = [(0, 1, 2, 3)]
|
||||
|
||||
ob = self._createMesh(scene, "Ground", vertices, faces)
|
||||
ob["is_ground"] = True
|
||||
|
||||
return ob
|
||||
|
||||
@staticmethod
|
||||
def _findGround(context):
|
||||
scene = context.scene
|
||||
|
||||
for ob in scene.objects:
|
||||
if ob.type == 'MESH' and "is_ground" in ob:
|
||||
return ob
|
||||
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def _mergeLayers(layers_a, layers_b):
|
||||
|
||||
return [(layers_a[i] | layers_b[i]) for i in range(len(layers_a))]
|
||||
|
||||
@staticmethod
|
||||
def _createLamp(scene):
|
||||
lamp = bpy.data.lamps.new(name="Lamp", type='POINT')
|
||||
lampob = bpy.data.objects.new(name="Lamp", object_data=lamp)
|
||||
scene.objects.link(lampob)
|
||||
|
||||
lampob.matrix_local = Matrix.Translation((4.076, 1.005, 5.904))
|
||||
|
||||
lamp.distance = 30
|
||||
lamp.shadow_method = 'RAY_SHADOW'
|
||||
|
||||
return lampob
|
||||
|
||||
def _createSampleObject(self, scene):
|
||||
vertices = self._getPlaneVertices(1.0, -1.0) + \
|
||||
self._getPlaneVertices(1.0, 1.0)
|
||||
faces = ((0, 1, 2, 3),
|
||||
(4, 7, 6, 5),
|
||||
(0, 4, 5, 1),
|
||||
(1, 5, 6, 2),
|
||||
(2, 6, 7, 3),
|
||||
(3, 7, 4, 0))
|
||||
|
||||
return self._createMesh(scene, "Cube", vertices, faces)
|
||||
|
||||
def _setupObjects(self, context):
|
||||
scene = context.scene
|
||||
|
||||
fg = scene.render.layers.get("Foreground")
|
||||
bg = scene.render.layers.get("Background")
|
||||
|
||||
all_layers = self._mergeLayers(fg.layers, bg.layers)
|
||||
|
||||
# enshure all lamps are active on foreground and background
|
||||
has_lamp = False
|
||||
has_mesh = False
|
||||
for ob in scene.objects:
|
||||
if ob.type == 'LAMP':
|
||||
ob.layers = all_layers
|
||||
has_lamp = True
|
||||
elif ob.type == 'MESH' and "is_ground" not in ob:
|
||||
has_mesh = True
|
||||
|
||||
# create sample lamp if there's no lamps in the scene
|
||||
if not has_lamp:
|
||||
lamp = self._createLamp(scene)
|
||||
lamp.layers = all_layers
|
||||
|
||||
# create sample object if there's no meshes in the scene
|
||||
if not has_mesh:
|
||||
ob = self._createSampleObject(scene)
|
||||
ob.layers = fg.layers
|
||||
|
||||
# create ground object if needed
|
||||
ground = self._findGround(context)
|
||||
if not ground:
|
||||
ground = self._createGround(scene)
|
||||
ground.layers = bg.layers
|
||||
else:
|
||||
# make sure ground is available on Background layer
|
||||
ground.layers = self._mergeLayers(ground.layers, bg.layers)
|
||||
|
||||
# layers with background and foreground should be rendered
|
||||
scene.layers = self._mergeLayers(scene.layers, all_layers)
|
||||
|
||||
def execute(self, context):
|
||||
self._setupScene(context)
|
||||
self._setupWorld(context)
|
||||
self._setupCamera(context)
|
||||
self._setupViewport(context)
|
||||
self._setupRenderLayers(context)
|
||||
self._setupNodes(context)
|
||||
self._setupObjects(context)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
@ -567,8 +567,8 @@ class LightMapPack(Operator):
|
||||
default=True,
|
||||
)
|
||||
PREF_NEW_UVLAYER = BoolProperty(
|
||||
name="New UV Layer",
|
||||
description="Create a new UV layer for every mesh packed",
|
||||
name="New UV Map",
|
||||
description="Create a new UV map for every mesh packed",
|
||||
default=False,
|
||||
)
|
||||
PREF_APPLY_IMAGE = BoolProperty(
|
||||
|
@ -265,7 +265,7 @@ class DATA_PT_shape_keys(MeshButtonsPanel, Panel):
|
||||
|
||||
|
||||
class DATA_PT_uv_texture(MeshButtonsPanel, Panel):
|
||||
bl_label = "UV Texture"
|
||||
bl_label = "UV Maps"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def draw(self, context):
|
||||
|
@ -696,7 +696,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
|
||||
col.prop(md, "image", text="")
|
||||
|
||||
col = split.column()
|
||||
col.label(text="UV Layer:")
|
||||
col.label(text="UV Map:")
|
||||
col.prop_search(md, "uv_layer", ob.data, "uv_textures", text="")
|
||||
|
||||
split = layout.split()
|
||||
|
@ -242,7 +242,7 @@ class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, Panel):
|
||||
# image format outputs
|
||||
if surface.surface_format == 'IMAGE':
|
||||
layout.operator("dpaint.bake", text="Bake Image Sequence", icon='MOD_DYNAMICPAINT')
|
||||
layout.prop_search(surface, "uv_layer", ob.data, "uv_textures", text="UV layer:")
|
||||
layout.prop_search(surface, "uv_layer", ob.data, "uv_textures", text="UV Map:")
|
||||
layout.separator()
|
||||
|
||||
layout.prop(surface, "image_output_path", text="")
|
||||
@ -300,7 +300,7 @@ class PHYSICS_PT_dp_canvas_initial_color(PhysicButtonsPanel, Panel):
|
||||
|
||||
elif surface.init_color_type == 'TEXTURE':
|
||||
layout.prop(surface, "init_texture")
|
||||
layout.prop_search(surface, "init_layername", ob.data, "uv_textures", text="UV Layer:")
|
||||
layout.prop_search(surface, "init_layername", ob.data, "uv_textures", text="UV Map:")
|
||||
|
||||
elif surface.init_color_type == 'VERTEX_COLOR':
|
||||
layout.prop_search(surface, "init_layername", ob.data, "vertex_colors", text="Color Layer: ")
|
||||
|
@ -831,7 +831,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel, Panel):
|
||||
"""
|
||||
elif tex.texture_coords == 'UV':
|
||||
split = layout.split(percentage=0.3)
|
||||
split.label(text="Layer:")
|
||||
split.label(text="Map:")
|
||||
ob = context.object
|
||||
if ob and ob.type == 'MESH':
|
||||
split.prop_search(tex, "uv_layer", ob.data, "uv_textures", text="")
|
||||
|
@ -640,6 +640,7 @@ class CLIP_PT_tools_clip(Panel):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator("clip.set_viewport_background")
|
||||
layout.operator("clip.setup_tracking_scene")
|
||||
|
||||
|
||||
class CLIP_MT_view(Menu):
|
||||
|
@ -65,6 +65,8 @@ int BKE_imtype_supports_compress(const char imtype);
|
||||
int BKE_imtype_supports_quality(const char imtype);
|
||||
char BKE_imtype_valid_depths(const char imtype);
|
||||
|
||||
char BKE_imtype_from_arg(const char *arg);
|
||||
|
||||
struct anim *openanim(const char *name, int flags, int streamindex);
|
||||
|
||||
void image_de_interlace(struct Image *ima, int odd);
|
||||
|
@ -1303,9 +1303,9 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
|
||||
DM_add_edge_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL);
|
||||
DM_add_face_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL);
|
||||
|
||||
range_vni(DM_get_vert_data_layer(dm, CD_ORIGINDEX), dm->numVertData, 0);
|
||||
range_vni(DM_get_edge_data_layer(dm, CD_ORIGINDEX), dm->numEdgeData, 0);
|
||||
range_vni(DM_get_face_data_layer(dm, CD_ORIGINDEX), dm->numPolyData, 0);
|
||||
range_vn_i(DM_get_vert_data_layer(dm, CD_ORIGINDEX), dm->numVertData, 0);
|
||||
range_vn_i(DM_get_edge_data_layer(dm, CD_ORIGINDEX), dm->numEdgeData, 0);
|
||||
range_vn_i(DM_get_face_data_layer(dm, CD_ORIGINDEX), dm->numPolyData, 0);
|
||||
}
|
||||
|
||||
if((dataMask & CD_MASK_WEIGHT_MCOL) && (ob->mode & OB_MODE_WEIGHT_PAINT))
|
||||
|
@ -1037,7 +1037,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
|
||||
/* 4: CD_MFACE */
|
||||
{sizeof(MFace), "MFace", 1, NULL, NULL, NULL, NULL, NULL, NULL},
|
||||
/* 5: CD_MTFACE */
|
||||
{sizeof(MTFace), "MTFace", 1, "UVTex", layerCopy_tface, NULL,
|
||||
{sizeof(MTFace), "MTFace", 1, "UVMap", layerCopy_tface, NULL,
|
||||
layerInterp_tface, layerSwap_tface, layerDefault_tface},
|
||||
/* 6: CD_MCOL */
|
||||
/* 4 MCol structs per face */
|
||||
@ -1057,7 +1057,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
|
||||
/* 12: CD_PROP_STR */
|
||||
{sizeof(MStringProperty), "MStringProperty",1,"String",layerCopy_propString,NULL,NULL,NULL},
|
||||
/* 13: CD_ORIGSPACE */
|
||||
{sizeof(OrigSpaceFace), "OrigSpaceFace", 1, "UVTex", layerCopy_origspace_face, NULL,
|
||||
{sizeof(OrigSpaceFace), "OrigSpaceFace", 1, "UVMap", layerCopy_origspace_face, NULL,
|
||||
layerInterp_origspace_face, layerSwap_origspace_face, layerDefault_origspace_face},
|
||||
/* 14: CD_ORCO */
|
||||
{sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
|
||||
|
@ -1307,7 +1307,7 @@ void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
|
||||
|
||||
if (!tex) return;
|
||||
|
||||
/* get uv layer */
|
||||
/* get uv map */
|
||||
CustomData_validate_layer_name(&dm->faceData, CD_MTFACE, surface->init_layername, uvname);
|
||||
tface = CustomData_get_layer_named(&dm->faceData, CD_MTFACE, uvname);
|
||||
if (!tface) return;
|
||||
@ -2094,7 +2094,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
|
||||
numOfFaces = dm->getNumFaces(dm);
|
||||
mface = dm->getTessFaceArray(dm);
|
||||
|
||||
/* get uv layer */
|
||||
/* get uv map */
|
||||
CustomData_validate_layer_name(&dm->faceData, CD_MTFACE, surface->uvlayer_name, uvname);
|
||||
tface = CustomData_get_layer_named(&dm->faceData, CD_MTFACE, uvname);
|
||||
|
||||
|
@ -971,6 +971,47 @@ char BKE_imtype_valid_depths(const char imtype)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* string is from command line --render-format arg, keep in sync with
|
||||
* creator.c help info */
|
||||
char BKE_imtype_from_arg(const char *imtype_arg)
|
||||
{
|
||||
if (!strcmp(imtype_arg,"TGA")) return R_IMF_IMTYPE_TARGA;
|
||||
else if (!strcmp(imtype_arg,"IRIS")) return R_IMF_IMTYPE_IRIS;
|
||||
#ifdef WITH_DDS
|
||||
else if (!strcmp(imtype_arg,"DDS")) return R_IMF_IMTYPE_DDS;
|
||||
#endif
|
||||
else if (!strcmp(imtype_arg,"JPEG")) return R_IMF_IMTYPE_JPEG90;
|
||||
else if (!strcmp(imtype_arg,"IRIZ")) return R_IMF_IMTYPE_IRIZ;
|
||||
else if (!strcmp(imtype_arg,"RAWTGA")) return R_IMF_IMTYPE_RAWTGA;
|
||||
else if (!strcmp(imtype_arg,"AVIRAW")) return R_IMF_IMTYPE_AVIRAW;
|
||||
else if (!strcmp(imtype_arg,"AVIJPEG")) return R_IMF_IMTYPE_AVIJPEG;
|
||||
else if (!strcmp(imtype_arg,"PNG")) return R_IMF_IMTYPE_PNG;
|
||||
else if (!strcmp(imtype_arg,"AVICODEC")) return R_IMF_IMTYPE_AVICODEC;
|
||||
else if (!strcmp(imtype_arg,"QUICKTIME")) return R_IMF_IMTYPE_QUICKTIME;
|
||||
else if (!strcmp(imtype_arg,"BMP")) return R_IMF_IMTYPE_BMP;
|
||||
#ifdef WITH_HDR
|
||||
else if (!strcmp(imtype_arg,"HDR")) return R_IMF_IMTYPE_RADHDR;
|
||||
#endif
|
||||
#ifdef WITH_TIFF
|
||||
else if (!strcmp(imtype_arg,"TIFF")) return R_IMF_IMTYPE_TIFF;
|
||||
#endif
|
||||
#ifdef WITH_OPENEXR
|
||||
else if (!strcmp(imtype_arg,"EXR")) return R_IMF_IMTYPE_OPENEXR;
|
||||
else if (!strcmp(imtype_arg,"MULTILAYER")) return R_IMF_IMTYPE_MULTILAYER;
|
||||
#endif
|
||||
else if (!strcmp(imtype_arg,"MPEG")) return R_IMF_IMTYPE_FFMPEG;
|
||||
else if (!strcmp(imtype_arg,"FRAMESERVER")) return R_IMF_IMTYPE_FRAMESERVER;
|
||||
#ifdef WITH_CINEON
|
||||
else if (!strcmp(imtype_arg,"CINEON")) return R_IMF_IMTYPE_CINEON;
|
||||
else if (!strcmp(imtype_arg,"DPX")) return R_IMF_IMTYPE_DPX;
|
||||
#endif
|
||||
#ifdef WITH_OPENJPEG
|
||||
else if (!strcmp(imtype_arg,"JP2")) return R_IMF_IMTYPE_JP2;
|
||||
#endif
|
||||
else return R_IMF_IMTYPE_INVALID;
|
||||
}
|
||||
|
||||
int BKE_add_image_extension(char *string, const char imtype)
|
||||
{
|
||||
const char *extension= NULL;
|
||||
|
@ -197,17 +197,20 @@ void minmax_v3v3_v3(float min[3], float max[3], const float vec[3]);
|
||||
|
||||
/***************************** Array Functions *******************************/
|
||||
/* attempted to follow fixed length vertex functions. names could be improved*/
|
||||
void range_vni(int *array, const int size, const int start);
|
||||
double dot_vn_vn(const float *array_src_a, const float *array_src_b, const int size);
|
||||
float normalize_vn_vn(float *array_tar, const float *array_src, const int size);
|
||||
float normalize_vn(float *array_tar, const int size);
|
||||
void range_vn_i(int *array_tar, const int size, const int start);
|
||||
void negate_vn(float *array_tar, const int size);
|
||||
void negate_vn_vn(float *array_tar, const float *array_src, const int size);
|
||||
void mul_vn_fl(float *array, const int size, const float f);
|
||||
void mul_vn_fl(float *array_tar, const int size, const float f);
|
||||
void mul_vn_vn_fl(float *array_tar, const float *array_src, const int size, const float f);
|
||||
void add_vn_vn(float *array_tar, const float *array_src, const int size);
|
||||
void add_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size);
|
||||
void sub_vn_vn(float *array_tar, const float *array_src, const int size);
|
||||
void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size);
|
||||
void fill_vni(int *array_tar, const int size, const int val);
|
||||
void fill_vn(float *array_tar, const int size, const float val);
|
||||
void fill_vn_i(int *array_tar, const int size, const int val);
|
||||
void fill_vn_fl(float *array_tar, const int size, const float val);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -392,7 +392,37 @@ void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
|
||||
|
||||
/***************************** Array Functions *******************************/
|
||||
|
||||
void range_vni(int *array_tar, const int size, const int start)
|
||||
double dot_vn_vn(const float *array_src_a, const float *array_src_b, const int size)
|
||||
{
|
||||
double d= 0.0f;
|
||||
const float *array_pt_a= array_src_a + (size-1);
|
||||
const float *array_pt_b= array_src_b + (size-1);
|
||||
int i= size;
|
||||
while(i--) { d += *(array_pt_a--) * *(array_pt_b--); }
|
||||
return d;
|
||||
}
|
||||
|
||||
float normalize_vn_vn(float *array_tar, const float *array_src, const int size)
|
||||
{
|
||||
double d= dot_vn_vn(array_tar, array_src, size);
|
||||
float d_sqrt;
|
||||
if (d > 1.0e-35) {
|
||||
d_sqrt= (float)sqrt(d);
|
||||
mul_vn_vn_fl(array_tar, array_src, size, 1.0f/d_sqrt);
|
||||
}
|
||||
else {
|
||||
fill_vn_fl(array_tar, size, 0.0f);
|
||||
d_sqrt= 0.0f;
|
||||
}
|
||||
return d_sqrt;
|
||||
}
|
||||
|
||||
float normalize_vn(float *array_tar, const int size)
|
||||
{
|
||||
return normalize_vn_vn(array_tar, array_tar, size);
|
||||
}
|
||||
|
||||
void range_vn_i(int *array_tar, const int size, const int start)
|
||||
{
|
||||
int *array_pt= array_tar + (size-1);
|
||||
int j= start + (size-1);
|
||||
@ -464,14 +494,14 @@ void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_
|
||||
while(i--) { *(tar--) = *(src_a--) - *(src_b--); }
|
||||
}
|
||||
|
||||
void fill_vni(int *array_tar, const int size, const int val)
|
||||
void fill_vn_i(int *array_tar, const int size, const int val)
|
||||
{
|
||||
int *tar= array_tar + (size-1);
|
||||
int i= size;
|
||||
while(i--) { *(tar--) = val; }
|
||||
}
|
||||
|
||||
void fill_vn(float *array_tar, const int size, const float val)
|
||||
void fill_vn_fl(float *array_tar, const int size, const float val)
|
||||
{
|
||||
float *tar= array_tar + (size-1);
|
||||
int i= size;
|
||||
|
@ -6561,8 +6561,8 @@ static void customdata_version_242(Mesh *me)
|
||||
|
||||
if (layer->type == CD_MTFACE) {
|
||||
if (layer->name[0] == 0) {
|
||||
if (mtfacen == 0) strcpy(layer->name, "UVTex");
|
||||
else sprintf(layer->name, "UVTex.%.3d", mtfacen);
|
||||
if (mtfacen == 0) strcpy(layer->name, "UVMap");
|
||||
else sprintf(layer->name, "UVMap.%.3d", mtfacen);
|
||||
}
|
||||
mtfacen++;
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ void GeometryExporter::createPolylist(short material_index,
|
||||
COLLADASW::Input input3(COLLADASW::InputSemantic::TEXCOORD,
|
||||
makeUrl(makeTexcoordSourceId(geom_id, i)),
|
||||
2, // offset always 2, this is only until we have optimized UV sets
|
||||
i // set number equals UV layer index
|
||||
i // set number equals UV map index
|
||||
);
|
||||
til.push_back(input3);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ void InstanceWriter::add_material_bindings(COLLADASW::BindMaterial& bind_materia
|
||||
ostr << translate_id(id_name(ma)) << a+1;
|
||||
COLLADASW::InstanceMaterial im(ostr.str(), COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, matid));
|
||||
|
||||
// create <bind_vertex_input> for each uv layer
|
||||
// create <bind_vertex_input> for each uv map
|
||||
Mesh *me = (Mesh*)ob->data;
|
||||
int totlayer = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
|
||||
|
||||
|
@ -417,7 +417,7 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //T
|
||||
me->totface = mesh->getFacesCount() + new_tris;
|
||||
me->mface = (MFace*)CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, me->totface);
|
||||
|
||||
// allocate UV layers
|
||||
// allocate UV Maps
|
||||
unsigned int totuvset = mesh->getUVCoords().getInputInfosArray().getCount();
|
||||
|
||||
for (i = 0; i < totuvset; i++) {
|
||||
@ -433,7 +433,7 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //T
|
||||
//this->set_layername_map[i] = CustomData_get_layer_name(&me->fdata, CD_MTFACE, i);
|
||||
}
|
||||
|
||||
// activate the first uv layer
|
||||
// activate the first uv map
|
||||
if (totuvset) me->mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, 0);
|
||||
|
||||
UVDataWrapper uvs(mesh->getUVCoords());
|
||||
|
@ -569,7 +569,7 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor
|
||||
/* draw settings for stepped interpolation modifier */
|
||||
static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
|
||||
{
|
||||
uiLayout *col, *subcol;
|
||||
uiLayout *col, *sub;
|
||||
PointerRNA ptr;
|
||||
|
||||
/* init the RNA-pointer */
|
||||
@ -584,17 +584,17 @@ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, sho
|
||||
col= uiLayoutColumn(layout, 1);
|
||||
uiItemR(col, &ptr, "use_frame_start", 0, NULL, ICON_NONE);
|
||||
|
||||
subcol = uiLayoutColumn(col, 1);
|
||||
uiLayoutSetActive(subcol, RNA_boolean_get(&ptr, "use_frame_start"));
|
||||
uiItemR(subcol, &ptr, "frame_start", 0, NULL, ICON_NONE);
|
||||
sub = uiLayoutColumn(col, 1);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_start"));
|
||||
uiItemR(sub, &ptr, "frame_start", 0, NULL, ICON_NONE);
|
||||
|
||||
/* block 3: end range settings */
|
||||
col= uiLayoutColumn(layout, 1);
|
||||
uiItemR(col, &ptr, "use_frame_end", 0, NULL, ICON_NONE);
|
||||
|
||||
subcol = uiLayoutColumn(col, 1);
|
||||
uiLayoutSetActive(subcol, RNA_boolean_get(&ptr, "use_frame_end"));
|
||||
uiItemR(subcol, &ptr, "frame_end", 0, NULL, ICON_NONE);
|
||||
sub = uiLayoutColumn(col, 1);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_end"));
|
||||
uiItemR(sub, &ptr, "frame_end", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
/* --------------- */
|
||||
@ -602,7 +602,7 @@ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, sho
|
||||
void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifiers, FModifier *fcm)
|
||||
{
|
||||
FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm);
|
||||
uiLayout *box, *row, *subrow, *col;
|
||||
uiLayout *box, *row, *sub, *col;
|
||||
uiBlock *block;
|
||||
uiBut *but;
|
||||
short width= 314;
|
||||
@ -620,30 +620,30 @@ void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifie
|
||||
block= uiLayoutGetBlock(row); // err...
|
||||
|
||||
/* left-align -------------------------------------------- */
|
||||
subrow= uiLayoutRow(row, 1);
|
||||
uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_LEFT);
|
||||
sub= uiLayoutRow(row, 1);
|
||||
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
|
||||
/* expand */
|
||||
uiItemR(subrow, &ptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
||||
uiItemR(sub, &ptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
||||
|
||||
/* checkbox for 'active' status (for now) */
|
||||
uiItemR(subrow, &ptr, "active", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
||||
uiItemR(sub, &ptr, "active", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
||||
|
||||
/* name */
|
||||
if (fmi)
|
||||
uiItemL(subrow, fmi->name, ICON_NONE);
|
||||
uiItemL(sub, fmi->name, ICON_NONE);
|
||||
else
|
||||
uiItemL(subrow, "<Unknown Modifier>", ICON_NONE);
|
||||
uiItemL(sub, "<Unknown Modifier>", ICON_NONE);
|
||||
|
||||
/* right-align ------------------------------------------- */
|
||||
subrow= uiLayoutRow(row, 1);
|
||||
uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_RIGHT);
|
||||
sub= uiLayoutRow(row, 1);
|
||||
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT);
|
||||
|
||||
|
||||
/* 'mute' button */
|
||||
uiItemR(subrow, &ptr, "mute", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
||||
uiItemR(sub, &ptr, "mute", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
|
||||
|
@ -95,8 +95,8 @@ static void gp_ui_dellayer_cb (bContext *C, void *gpd, void *gpl)
|
||||
static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, const short is_v3d)
|
||||
{
|
||||
uiLayout *box=NULL, *split=NULL;
|
||||
uiLayout *col=NULL, *subcol=NULL;
|
||||
uiLayout *row=NULL, *subrow=NULL;
|
||||
uiLayout *col=NULL;
|
||||
uiLayout *row=NULL, *sub=NULL;
|
||||
uiBlock *block;
|
||||
uiBut *but;
|
||||
PointerRNA ptr;
|
||||
@ -120,17 +120,17 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, con
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
|
||||
/* left-align ............................... */
|
||||
subrow= uiLayoutRow(row, 0);
|
||||
sub= uiLayoutRow(row, 0);
|
||||
|
||||
/* active */
|
||||
block= uiLayoutGetBlock(subrow);
|
||||
block= uiLayoutGetBlock(sub);
|
||||
icon= (gpl->flag & GP_LAYER_ACTIVE) ? ICON_RADIOBUT_ON : ICON_RADIOBUT_OFF;
|
||||
but= uiDefIconBut(block, BUT, 0, icon, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Set active layer");
|
||||
uiButSetFunc(but, gp_ui_activelayer_cb, gpd, gpl);
|
||||
|
||||
/* locked */
|
||||
icon= (gpl->flag & GP_LAYER_LOCKED) ? ICON_LOCKED : ICON_UNLOCKED;
|
||||
uiItemR(subrow, &ptr, "lock", 0, "", icon);
|
||||
uiItemR(sub, &ptr, "lock", 0, "", icon);
|
||||
|
||||
/* when layer is locked or hidden, only draw header */
|
||||
if (gpl->flag & (GP_LAYER_LOCKED|GP_LAYER_HIDE)) {
|
||||
@ -138,7 +138,7 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, con
|
||||
|
||||
/* visibility button (only if hidden but not locked!) */
|
||||
if ((gpl->flag & GP_LAYER_HIDE) && !(gpl->flag & GP_LAYER_LOCKED))
|
||||
uiItemR(subrow, &ptr, "hide", 0, "", ICON_RESTRICT_VIEW_ON);
|
||||
uiItemR(sub, &ptr, "hide", 0, "", ICON_RESTRICT_VIEW_ON);
|
||||
|
||||
|
||||
/* name */
|
||||
@ -146,14 +146,14 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, con
|
||||
sprintf(name, "%s (Hidden)", gpl->info);
|
||||
else
|
||||
sprintf(name, "%s (Locked)", gpl->info);
|
||||
uiItemL(subrow, name, ICON_NONE);
|
||||
uiItemL(sub, name, ICON_NONE);
|
||||
|
||||
/* delete button (only if hidden but not locked!) */
|
||||
if ((gpl->flag & GP_LAYER_HIDE) && !(gpl->flag & GP_LAYER_LOCKED)) {
|
||||
/* right-align ............................... */
|
||||
subrow= uiLayoutRow(row, 1);
|
||||
uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_RIGHT);
|
||||
block= uiLayoutGetBlock(subrow); // XXX... err...
|
||||
sub= uiLayoutRow(row, 1);
|
||||
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT);
|
||||
block= uiLayoutGetBlock(sub); // XXX... err...
|
||||
|
||||
but= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Delete layer");
|
||||
uiButSetFunc(but, gp_ui_dellayer_cb, gpd, gpl);
|
||||
@ -163,24 +163,24 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, con
|
||||
else {
|
||||
/* draw rest of header -------------------------------- */
|
||||
/* visibility button */
|
||||
uiItemR(subrow, &ptr, "hide", 0, "", ICON_RESTRICT_VIEW_OFF);
|
||||
uiItemR(sub, &ptr, "hide", 0, "", ICON_RESTRICT_VIEW_OFF);
|
||||
|
||||
/* frame locking */
|
||||
// TODO: this needs its own icons...
|
||||
icon= (gpl->flag & GP_LAYER_FRAMELOCK) ? ICON_RENDER_STILL : ICON_RENDER_ANIMATION;
|
||||
uiItemR(subrow, &ptr, "lock_frame", 0, "", icon);
|
||||
uiItemR(sub, &ptr, "lock_frame", 0, "", icon);
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||
|
||||
/* name */
|
||||
uiItemR(subrow, &ptr, "info", 0, "", ICON_NONE);
|
||||
uiItemR(sub, &ptr, "info", 0, "", ICON_NONE);
|
||||
|
||||
/* delete 'button' */
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
/* right-align ............................... */
|
||||
subrow= uiLayoutRow(row, 1);
|
||||
uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_RIGHT);
|
||||
block= uiLayoutGetBlock(subrow); // XXX... err...
|
||||
sub= uiLayoutRow(row, 1);
|
||||
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT);
|
||||
block= uiLayoutGetBlock(sub); // XXX... err...
|
||||
|
||||
but= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Delete layer");
|
||||
uiButSetFunc(but, gp_ui_dellayer_cb, gpd, gpl);
|
||||
@ -196,32 +196,29 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, con
|
||||
col= uiLayoutColumn(split, 0);
|
||||
|
||||
/* color */
|
||||
subcol= uiLayoutColumn(col, 1);
|
||||
uiItemR(subcol, &ptr, "color", 0, "", ICON_NONE);
|
||||
uiItemR(subcol, &ptr, "alpha", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
sub= uiLayoutColumn(col, 1);
|
||||
uiItemR(sub, &ptr, "color", 0, "", ICON_NONE);
|
||||
uiItemR(sub, &ptr, "alpha", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
|
||||
/* stroke thickness */
|
||||
subcol= uiLayoutColumn(col, 1);
|
||||
uiItemR(subcol, &ptr, "line_width", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "line_width", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
|
||||
/* debugging options */
|
||||
if (G.f & G_DEBUG) {
|
||||
subcol= uiLayoutColumn(col, 1);
|
||||
uiItemR(subcol, &ptr, "show_points", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "show_points", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
/* right column ................... */
|
||||
col= uiLayoutColumn(split, 0);
|
||||
|
||||
/* onion-skinning */
|
||||
subcol= uiLayoutColumn(col, 1);
|
||||
uiItemR(subcol, &ptr, "use_onion_skinning", 0, "Onion Skinning", ICON_NONE);
|
||||
uiItemR(subcol, &ptr, "ghost_range_max", 0, "Frames", ICON_NONE); // XXX shorter name here? i.e. GStep
|
||||
sub= uiLayoutColumn(col, 1);
|
||||
uiItemR(sub, &ptr, "use_onion_skinning", 0, "Onion Skinning", ICON_NONE);
|
||||
uiItemR(sub, &ptr, "ghost_range_max", 0, "Frames", ICON_NONE); // XXX shorter name here? i.e. GStep
|
||||
|
||||
/* 3d-view specific drawing options */
|
||||
if (is_v3d) {
|
||||
subcol= uiLayoutColumn(col, 0);
|
||||
uiItemR(subcol, &ptr, "show_x_ray", 0, "X-Ray", ICON_NONE);
|
||||
uiItemR(col, &ptr, "show_x_ray", 0, "X-Ray", ICON_NONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -513,8 +513,8 @@ static int uv_texture_add_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
void MESH_OT_uv_texture_add(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Add UV Texture";
|
||||
ot->description= "Add UV texture layer";
|
||||
ot->name= "Add UV Map";
|
||||
ot->description= "Add UV Map";
|
||||
ot->idname= "MESH_OT_uv_texture_add";
|
||||
|
||||
|
||||
@ -601,8 +601,8 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
void MESH_OT_drop_named_image(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Assign Image to UV Texture";
|
||||
ot->description= "Assigns Image to active UV layer, or creates a UV layer";
|
||||
ot->name= "Assign Image to UV Map";
|
||||
ot->description= "Assigns Image to active UV Map, or creates a UV Map";
|
||||
ot->idname= "MESH_OT_drop_named_image";
|
||||
|
||||
|
||||
@ -634,8 +634,8 @@ static int uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
void MESH_OT_uv_texture_remove(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Remove UV Texture";
|
||||
ot->description= "Remove UV texture layer";
|
||||
ot->name= "Remove UV Map";
|
||||
ot->description= "Remove UV Map";
|
||||
ot->idname= "MESH_OT_uv_texture_remove";
|
||||
|
||||
|
||||
|
@ -263,7 +263,7 @@ typedef struct ProjPaintState {
|
||||
MVert *dm_mvert;
|
||||
MFace *dm_mface;
|
||||
MTFace *dm_mtface;
|
||||
MTFace *dm_mtface_clone; /* other UV layer, use for cloning between layers */
|
||||
MTFace *dm_mtface_clone; /* other UV map, use for cloning between layers */
|
||||
MTFace *dm_mtface_stencil;
|
||||
|
||||
/* projection painting only */
|
||||
@ -1347,7 +1347,7 @@ static float project_paint_uvpixel_mask(
|
||||
|
||||
/* Image Mask */
|
||||
if (ps->do_layer_stencil) {
|
||||
/* another UV layers image is masking this one's */
|
||||
/* another UV maps image is masking this one's */
|
||||
ImBuf *ibuf_other;
|
||||
Image *other_tpage = project_paint_face_image(ps, ps->dm_mtface_stencil, face_index);
|
||||
const MTFace *tf_other = ps->dm_mtface_stencil + face_index;
|
||||
|
@ -136,7 +136,7 @@ static void graph_panel_view(const bContext *C, Panel *pa)
|
||||
SpaceIpo *sipo= CTX_wm_space_graph(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
PointerRNA spaceptr, sceneptr;
|
||||
uiLayout *col, *subcol, *row;
|
||||
uiLayout *col, *sub, *row;
|
||||
|
||||
/* get RNA pointers for use when creating the UI elements */
|
||||
RNA_id_pointer_create(&scene->id, &sceneptr);
|
||||
@ -146,16 +146,16 @@ static void graph_panel_view(const bContext *C, Panel *pa)
|
||||
col= uiLayoutColumn(pa->layout, 0);
|
||||
uiItemR(col, &spaceptr, "show_cursor", 0, NULL, ICON_NONE);
|
||||
|
||||
subcol= uiLayoutColumn(col, 1);
|
||||
uiLayoutSetActive(subcol, RNA_boolean_get(&spaceptr, "show_cursor"));
|
||||
uiItemO(subcol, "Cursor from Selection", ICON_NONE, "GRAPH_OT_frame_jump");
|
||||
sub= uiLayoutColumn(col, 1);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(&spaceptr, "show_cursor"));
|
||||
uiItemO(sub, "Cursor from Selection", ICON_NONE, "GRAPH_OT_frame_jump");
|
||||
|
||||
subcol= uiLayoutColumn(col, 1);
|
||||
uiLayoutSetActive(subcol, RNA_boolean_get(&spaceptr, "show_cursor"));
|
||||
row= uiLayoutSplit(subcol, 0.7, 1);
|
||||
sub= uiLayoutColumn(col, 1);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(&spaceptr, "show_cursor"));
|
||||
row= uiLayoutSplit(sub, 0.7, 1);
|
||||
uiItemR(row, &sceneptr, "frame_current", 0, "Cursor X", ICON_NONE);
|
||||
uiItemEnumO(row, "GRAPH_OT_snap", "To Keys", 0, "type", GRAPHKEYS_SNAP_CFRA);
|
||||
row= uiLayoutSplit(subcol, 0.7, 1);
|
||||
row= uiLayoutSplit(sub, 0.7, 1);
|
||||
uiItemR(row, &spaceptr, "cursor_position_y", 0, "Cursor Y", ICON_NONE);
|
||||
uiItemEnumO(row, "GRAPH_OT_snap", "To Keys", 0, "type", GRAPHKEYS_SNAP_VALUE);
|
||||
}
|
||||
@ -168,7 +168,7 @@ static void graph_panel_properties(const bContext *C, Panel *pa)
|
||||
FCurve *fcu;
|
||||
PointerRNA fcu_ptr;
|
||||
uiLayout *layout = pa->layout;
|
||||
uiLayout *col, *row, *subrow;
|
||||
uiLayout *col, *row, *sub;
|
||||
uiBlock *block;
|
||||
char name[256];
|
||||
int icon = 0;
|
||||
@ -201,9 +201,9 @@ static void graph_panel_properties(const bContext *C, Panel *pa)
|
||||
row= uiLayoutRow(col, 1);
|
||||
uiItemR(row, &fcu_ptr, "color_mode", 0, "", ICON_NONE);
|
||||
|
||||
subrow= uiLayoutRow(row, 1);
|
||||
uiLayoutSetEnabled(subrow, (fcu->color_mode==FCURVE_COLOR_CUSTOM));
|
||||
uiItemR(subrow, &fcu_ptr, "color", 0, "", ICON_NONE);
|
||||
sub= uiLayoutRow(row, 1);
|
||||
uiLayoutSetEnabled(sub, (fcu->color_mode==FCURVE_COLOR_CUSTOM));
|
||||
uiItemR(sub, &fcu_ptr, "color", 0, "", ICON_NONE);
|
||||
|
||||
MEM_freeN(ale);
|
||||
}
|
||||
@ -562,7 +562,7 @@ static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar
|
||||
DriverTarget *dtar= &dvar->targets[0];
|
||||
Object *ob = (Object *)dtar->id;
|
||||
PointerRNA dtar_ptr;
|
||||
uiLayout *col, *subcol;
|
||||
uiLayout *col, *sub;
|
||||
|
||||
/* initialise RNA pointer to the target */
|
||||
RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr);
|
||||
@ -578,9 +578,9 @@ static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar
|
||||
uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
|
||||
}
|
||||
|
||||
subcol= uiLayoutColumn(layout, 1);
|
||||
uiItemR(subcol, &dtar_ptr, "transform_type", 0, NULL, ICON_NONE);
|
||||
uiItemR(subcol, &dtar_ptr, "transform_space", 0, "Space", ICON_NONE);
|
||||
sub= uiLayoutColumn(layout, 1);
|
||||
uiItemR(sub, &dtar_ptr, "transform_type", 0, NULL, ICON_NONE);
|
||||
uiItemR(sub, &dtar_ptr, "transform_space", 0, "Space", ICON_NONE);
|
||||
}
|
||||
|
||||
/* driver settings for active F-Curve (only for 'Drivers' mode) */
|
||||
|
@ -791,14 +791,15 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr)
|
||||
/* some settings depend on this being a scene thats rendered */
|
||||
const short is_render_out= (id && GS(id->name) == ID_SCE);
|
||||
|
||||
uiLayout *col, *row;
|
||||
uiLayout *col, *row, *split, *sub;
|
||||
|
||||
col= uiLayoutColumn(layout, 0);
|
||||
|
||||
uiItemR(col, imfptr, "file_format", 0, "", ICON_NONE);
|
||||
split= uiLayoutSplit(col, 0.5f, 0);
|
||||
|
||||
row= uiLayoutRow(col, 0);
|
||||
uiItemR(row, imfptr, "color_mode", UI_ITEM_R_EXPAND, "Color", ICON_NONE);
|
||||
uiItemR(split, imfptr, "file_format", 0, "", ICON_NONE);
|
||||
sub= uiLayoutRow(split, 0);
|
||||
uiItemR(sub, imfptr, "color_mode", UI_ITEM_R_EXPAND, "Color", ICON_NONE);
|
||||
|
||||
/* only display depth setting if multiple depths can be used */
|
||||
if((ELEM6(depth_ok,
|
||||
|
@ -3222,7 +3222,7 @@ static int is_sensor_linked(uiBlock *block, bSensor *sens)
|
||||
|
||||
static void draw_sensor_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *logic_ptr)
|
||||
{
|
||||
uiLayout *box, *row, *subrow;
|
||||
uiLayout *box, *row, *sub;
|
||||
bSensor *sens= (bSensor *)ptr->data;
|
||||
|
||||
box= uiLayoutBox(layout);
|
||||
@ -3237,15 +3237,15 @@ static void draw_sensor_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *lo
|
||||
uiItemL(row, sens->name, ICON_NONE);
|
||||
}
|
||||
|
||||
subrow= uiLayoutRow(row, 0);
|
||||
uiLayoutSetActive(subrow, ((RNA_boolean_get(logic_ptr, "show_sensors_active_states")
|
||||
sub= uiLayoutRow(row, 0);
|
||||
uiLayoutSetActive(sub, ((RNA_boolean_get(logic_ptr, "show_sensors_active_states")
|
||||
&& RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin")));
|
||||
uiItemR(subrow, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE);
|
||||
uiItemR(sub, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE);
|
||||
|
||||
if(RNA_boolean_get(ptr, "show_expanded")==0) {
|
||||
subrow= uiLayoutRow(row, 1);
|
||||
uiItemEnumO(subrow, "LOGIC_OT_sensor_move", "", ICON_TRIA_UP, "direction", 1); // up
|
||||
uiItemEnumO(subrow, "LOGIC_OT_sensor_move", "", ICON_TRIA_DOWN, "direction", 2); // down
|
||||
sub= uiLayoutRow(row, 1);
|
||||
uiItemEnumO(sub, "LOGIC_OT_sensor_move", "", ICON_TRIA_UP, "direction", 1); // up
|
||||
uiItemEnumO(sub, "LOGIC_OT_sensor_move", "", ICON_TRIA_DOWN, "direction", 2); // down
|
||||
}
|
||||
|
||||
uiItemO(row, "", ICON_X, "LOGIC_OT_sensor_remove");
|
||||
@ -3253,7 +3253,7 @@ static void draw_sensor_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *lo
|
||||
|
||||
static void draw_sensor_internal_header(uiLayout *layout, PointerRNA *ptr)
|
||||
{
|
||||
uiLayout *box, *split, *subrow, *row;
|
||||
uiLayout *box, *split, *sub, *row;
|
||||
|
||||
box= uiLayoutBox(layout);
|
||||
split = uiLayoutSplit(box, 0.45, 0);
|
||||
@ -3262,17 +3262,16 @@ static void draw_sensor_internal_header(uiLayout *layout, PointerRNA *ptr)
|
||||
uiItemR(row, ptr, "use_pulse_true_level", 0, "", ICON_DOTSUP);
|
||||
uiItemR(row, ptr, "use_pulse_false_level", 0, "", ICON_DOTSDOWN);
|
||||
|
||||
subrow=uiLayoutRow(row, 0);
|
||||
uiLayoutSetActive(subrow, (RNA_boolean_get(ptr, "use_pulse_true_level")
|
||||
sub=uiLayoutRow(row, 0);
|
||||
uiLayoutSetActive(sub, (RNA_boolean_get(ptr, "use_pulse_true_level")
|
||||
|| RNA_boolean_get(ptr, "use_pulse_false_level")));
|
||||
uiItemR(subrow, ptr, "frequency", 0, "Freq", ICON_NONE);
|
||||
uiItemR(sub, ptr, "frequency", 0, "Freq", ICON_NONE);
|
||||
|
||||
row= uiLayoutRow(split, 1);
|
||||
uiItemR(row, ptr, "use_level", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
|
||||
uiItemR(row, ptr, "use_tap", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
|
||||
|
||||
row= uiLayoutRow(split, 1);
|
||||
uiItemR(row, ptr, "invert", UI_ITEM_R_TOGGLE, "Invert", ICON_NONE);
|
||||
uiItemR(split, ptr, "invert", UI_ITEM_R_TOGGLE, "Invert", ICON_NONE);
|
||||
}
|
||||
/* sensors in alphabetical order */
|
||||
|
||||
@ -3577,7 +3576,7 @@ static void draw_brick_sensor(uiLayout *layout, PointerRNA *ptr, bContext *C)
|
||||
/* Controller code */
|
||||
static void draw_controller_header(uiLayout *layout, PointerRNA *ptr, int xco, int width, int yco)
|
||||
{
|
||||
uiLayout *box, *row, *subrow;
|
||||
uiLayout *box, *row, *sub;
|
||||
bController *cont= (bController *)ptr->data;
|
||||
|
||||
char state[3];
|
||||
@ -3601,9 +3600,9 @@ static void draw_controller_header(uiLayout *layout, PointerRNA *ptr, int xco, i
|
||||
uiItemR(row, ptr, "use_priority", 0, "", ICON_NONE);
|
||||
|
||||
if(RNA_boolean_get(ptr, "show_expanded")==0) {
|
||||
subrow= uiLayoutRow(row, 1);
|
||||
uiItemEnumO(subrow, "LOGIC_OT_controller_move", "", ICON_TRIA_UP, "direction", 1); // up
|
||||
uiItemEnumO(subrow, "LOGIC_OT_controller_move", "", ICON_TRIA_DOWN, "direction", 2); // down
|
||||
sub= uiLayoutRow(row, 1);
|
||||
uiItemEnumO(sub, "LOGIC_OT_controller_move", "", ICON_TRIA_UP, "direction", 1); // up
|
||||
uiItemEnumO(sub, "LOGIC_OT_controller_move", "", ICON_TRIA_DOWN, "direction", 2); // down
|
||||
}
|
||||
uiItemO(row, "", ICON_X, "LOGIC_OT_controller_remove");
|
||||
}
|
||||
@ -3615,7 +3614,7 @@ static void draw_controller_expression(uiLayout *layout, PointerRNA *ptr)
|
||||
|
||||
static void draw_controller_python(uiLayout *layout, PointerRNA *ptr)
|
||||
{
|
||||
uiLayout *split, *subsplit;
|
||||
uiLayout *split, *sub;
|
||||
|
||||
split = uiLayoutSplit(layout, 0.3, 1);
|
||||
uiItemR(split, ptr, "mode", 0, "", ICON_NONE);
|
||||
@ -3623,9 +3622,9 @@ static void draw_controller_python(uiLayout *layout, PointerRNA *ptr)
|
||||
uiItemR(split, ptr, "text", 0, "", ICON_NONE);
|
||||
}
|
||||
else {
|
||||
subsplit = uiLayoutSplit(split, 0.8, 0);
|
||||
uiItemR(subsplit, ptr, "module", 0, "", ICON_NONE);
|
||||
uiItemR(subsplit, ptr, "use_debug", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
|
||||
sub = uiLayoutSplit(split, 0.8, 0);
|
||||
uiItemR(sub, ptr, "module", 0, "", ICON_NONE);
|
||||
uiItemR(sub, ptr, "use_debug", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3670,7 +3669,7 @@ static void draw_brick_controller(uiLayout *layout, PointerRNA *ptr)
|
||||
/* Actuator code */
|
||||
static void draw_actuator_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *logic_ptr)
|
||||
{
|
||||
uiLayout *box, *row, *subrow;
|
||||
uiLayout *box, *row, *sub;
|
||||
bActuator *act= (bActuator *)ptr->data;
|
||||
|
||||
box= uiLayoutBox(layout);
|
||||
@ -3685,15 +3684,15 @@ static void draw_actuator_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *
|
||||
uiItemL(row, act->name, ICON_NONE);
|
||||
}
|
||||
|
||||
subrow= uiLayoutRow(row, 0);
|
||||
uiLayoutSetActive(subrow, ((RNA_boolean_get(logic_ptr, "show_actuators_active_states")
|
||||
sub= uiLayoutRow(row, 0);
|
||||
uiLayoutSetActive(sub, ((RNA_boolean_get(logic_ptr, "show_actuators_active_states")
|
||||
&& RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin")));
|
||||
uiItemR(subrow, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE);
|
||||
uiItemR(sub, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE);
|
||||
|
||||
if(RNA_boolean_get(ptr, "show_expanded")==0) {
|
||||
subrow= uiLayoutRow(row, 1);
|
||||
uiItemEnumO(subrow, "LOGIC_OT_actuator_move", "", ICON_TRIA_UP, "direction", 1); // up
|
||||
uiItemEnumO(subrow, "LOGIC_OT_actuator_move", "", ICON_TRIA_DOWN, "direction", 2); // down
|
||||
sub= uiLayoutRow(row, 1);
|
||||
uiItemEnumO(sub, "LOGIC_OT_actuator_move", "", ICON_TRIA_UP, "direction", 1); // up
|
||||
uiItemEnumO(sub, "LOGIC_OT_actuator_move", "", ICON_TRIA_DOWN, "direction", 2); // down
|
||||
}
|
||||
uiItemO(row, "", ICON_X, "LOGIC_OT_actuator_remove");
|
||||
}
|
||||
@ -3702,20 +3701,20 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr)
|
||||
{
|
||||
Object *ob = (Object *)ptr->id.data;
|
||||
PointerRNA settings_ptr;
|
||||
uiLayout *row, *subrow, *col;
|
||||
uiLayout *row, *sub;
|
||||
|
||||
RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
|
||||
|
||||
row= uiLayoutRow(layout, 0);
|
||||
uiItemR(row, ptr, "play_mode", 0, "", ICON_NONE);
|
||||
|
||||
subrow= uiLayoutRow(row, 1);
|
||||
uiItemR(subrow, ptr, "use_force", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
|
||||
uiItemR(subrow, ptr, "use_additive", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
|
||||
sub= uiLayoutRow(row, 1);
|
||||
uiItemR(sub, ptr, "use_force", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
|
||||
uiItemR(sub, ptr, "use_additive", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(subrow, 0);
|
||||
uiLayoutSetActive(col, (RNA_boolean_get(ptr, "use_additive") || RNA_boolean_get(ptr, "use_force")));
|
||||
uiItemR(col, ptr, "use_local", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
|
||||
row = uiLayoutColumn(sub, 0);
|
||||
uiLayoutSetActive(row, (RNA_boolean_get(ptr, "use_additive") || RNA_boolean_get(ptr, "use_force")));
|
||||
uiItemR(row, ptr, "use_local", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
|
||||
|
||||
row= uiLayoutRow(layout, 0);
|
||||
uiItemR(row, ptr, "action", 0, "", ICON_NONE);
|
||||
@ -3740,11 +3739,10 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr)
|
||||
uiItemR(row, ptr, "layer", 0, NULL, ICON_NONE);
|
||||
uiItemR(row, ptr, "layer_weight", 0, NULL, ICON_NONE);
|
||||
|
||||
row= uiLayoutRow(layout, 0);
|
||||
uiItemPointerR(layout, ptr, "frame_property", &settings_ptr, "properties", NULL, ICON_NONE);
|
||||
|
||||
#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
|
||||
uiItemR(row, "stride_length", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, "stride_length", 0, NULL, ICON_NONE);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -3829,7 +3827,7 @@ static void draw_actuator_camera(uiLayout *layout, PointerRNA *ptr)
|
||||
|
||||
static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext *C)
|
||||
{
|
||||
uiLayout *row, *col, *subcol, *split;
|
||||
uiLayout *row, *col, *sub, *split;
|
||||
PointerRNA main_ptr;
|
||||
|
||||
RNA_main_pointer_create(CTX_data_main(C), &main_ptr);
|
||||
@ -3855,15 +3853,15 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext
|
||||
uiItemR(row, ptr, "use_normal", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
|
||||
|
||||
row = uiLayoutRow(layout, 0);
|
||||
col = uiLayoutColumn(row, 0);
|
||||
col = uiLayoutColumn(row, 1);
|
||||
uiItemL(col, "Range:", ICON_NONE);
|
||||
uiItemR(col, ptr, "range", 0, "", ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(row, 1);
|
||||
uiItemR(col, ptr, "use_force_distance", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
|
||||
subcol = uiLayoutColumn(col, 0);
|
||||
uiLayoutSetActive(subcol, RNA_boolean_get(ptr, "use_force_distance")==1);
|
||||
uiItemR(subcol, ptr, "distance", 0, "", ICON_NONE);
|
||||
sub = uiLayoutColumn(col, 0);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_force_distance")==1);
|
||||
uiItemR(sub, ptr, "distance", 0, "", ICON_NONE);
|
||||
|
||||
uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER , NULL, ICON_NONE);
|
||||
|
||||
@ -3931,7 +3929,7 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext
|
||||
static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr)
|
||||
{
|
||||
Object *ob = (Object *)ptr->id.data;
|
||||
uiLayout *row, *split, *subsplit;
|
||||
uiLayout *row, *split, *sub;
|
||||
uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
|
||||
|
||||
switch (RNA_enum_get(ptr, "mode"))
|
||||
@ -3967,9 +3965,9 @@ static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr)
|
||||
case ACT_EDOB_TRACK_TO:
|
||||
split = uiLayoutSplit(layout, 0.5, 0);
|
||||
uiItemR(split, ptr, "track_object", 0, NULL, ICON_NONE);
|
||||
subsplit = uiLayoutSplit(split, 0.7, 0);
|
||||
uiItemR(subsplit, ptr, "time", 0, NULL, ICON_NONE);
|
||||
uiItemR(subsplit, ptr, "use_3d_tracking", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
|
||||
sub = uiLayoutSplit(split, 0.7, 0);
|
||||
uiItemR(sub, ptr, "time", 0, NULL, ICON_NONE);
|
||||
uiItemR(sub, ptr, "use_3d_tracking", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
|
||||
break;
|
||||
case ACT_EDOB_DYNAMICS:
|
||||
if(ob->type != OB_MESH) {
|
||||
@ -4041,7 +4039,7 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr)
|
||||
{
|
||||
Object *ob;
|
||||
PointerRNA settings_ptr;
|
||||
uiLayout *split, *row, *col, *subcol;
|
||||
uiLayout *split, *row, *col, *sub;
|
||||
int physics_type;
|
||||
|
||||
ob = (Object *)ptr->id.data;
|
||||
@ -4100,24 +4098,24 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr)
|
||||
row = uiLayoutRow(layout, 0);
|
||||
col = uiLayoutColumn(row, 0);
|
||||
uiItemR(col, ptr, "use_servo_limit_x", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
|
||||
subcol = uiLayoutColumn(col, 1);
|
||||
uiLayoutSetActive(subcol, RNA_boolean_get(ptr, "use_servo_limit_x")==1);
|
||||
uiItemR(subcol, ptr, "force_max_x", 0, NULL, ICON_NONE);
|
||||
uiItemR(subcol, ptr, "force_min_x", 0, NULL, ICON_NONE);
|
||||
sub = uiLayoutColumn(col, 1);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_x")==1);
|
||||
uiItemR(sub, ptr, "force_max_x", 0, NULL, ICON_NONE);
|
||||
uiItemR(sub, ptr, "force_min_x", 0, NULL, ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(row, 0);
|
||||
uiItemR(col, ptr, "use_servo_limit_y", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
|
||||
subcol = uiLayoutColumn(col, 1);
|
||||
uiLayoutSetActive(subcol, RNA_boolean_get(ptr, "use_servo_limit_y")==1);
|
||||
uiItemR(subcol, ptr, "force_max_y", 0, NULL, ICON_NONE);
|
||||
uiItemR(subcol, ptr, "force_min_y", 0, NULL, ICON_NONE);
|
||||
sub = uiLayoutColumn(col, 1);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_y")==1);
|
||||
uiItemR(sub, ptr, "force_max_y", 0, NULL, ICON_NONE);
|
||||
uiItemR(sub, ptr, "force_min_y", 0, NULL, ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(row, 0);
|
||||
uiItemR(col, ptr, "use_servo_limit_z", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
|
||||
subcol = uiLayoutColumn(col, 1);
|
||||
uiLayoutSetActive(subcol, RNA_boolean_get(ptr, "use_servo_limit_z")==1);
|
||||
uiItemR(subcol, ptr, "force_max_z", 0, NULL, ICON_NONE);
|
||||
uiItemR(subcol, ptr, "force_min_z", 0, NULL, ICON_NONE);
|
||||
sub = uiLayoutColumn(col, 1);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_z")==1);
|
||||
uiItemR(sub, ptr, "force_max_z", 0, NULL, ICON_NONE);
|
||||
uiItemR(sub, ptr, "force_min_z", 0, NULL, ICON_NONE);
|
||||
|
||||
//XXXACTUATOR missing labels from original 2.49 ui (e.g. Servo, Min, Max, Fast)
|
||||
//Layout designers willing to help on that, please compare with 2.49 ui
|
||||
@ -4133,7 +4131,7 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr)
|
||||
|
||||
static void draw_actuator_parent(uiLayout *layout, PointerRNA *ptr)
|
||||
{
|
||||
uiLayout *row, *subrow;
|
||||
uiLayout *row, *sub;
|
||||
|
||||
uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
|
||||
|
||||
@ -4142,9 +4140,9 @@ static void draw_actuator_parent(uiLayout *layout, PointerRNA *ptr)
|
||||
|
||||
row = uiLayoutRow(layout, 0);
|
||||
uiItemR(row, ptr, "use_compound", 0, NULL, ICON_NONE);
|
||||
subrow= uiLayoutRow(row, 0);
|
||||
uiLayoutSetActive(subrow, RNA_boolean_get(ptr, "use_compound")==1);
|
||||
uiItemR(subrow, ptr, "use_ghost", 0, NULL, ICON_NONE);
|
||||
sub= uiLayoutRow(row, 0);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_compound")==1);
|
||||
uiItemR(sub, ptr, "use_ghost", 0, NULL, ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4156,7 +4154,7 @@ static void draw_actuator_property(uiLayout *layout, PointerRNA *ptr)
|
||||
Object *ob_from= pa->ob;
|
||||
PointerRNA settings_ptr, obj_settings_ptr;
|
||||
|
||||
uiLayout *row, *subrow;
|
||||
uiLayout *row, *sub;
|
||||
|
||||
RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
|
||||
|
||||
@ -4181,9 +4179,9 @@ static void draw_actuator_property(uiLayout *layout, PointerRNA *ptr)
|
||||
uiItemPointerR(row, ptr, "object_property", &obj_settings_ptr, "properties", NULL, ICON_NONE);
|
||||
}else
|
||||
{
|
||||
subrow= uiLayoutRow(row, 0);
|
||||
uiLayoutSetActive(subrow, 0);
|
||||
uiItemR(subrow, ptr, "object_property", 0, NULL, ICON_NONE);
|
||||
sub= uiLayoutRow(row, 0);
|
||||
uiLayoutSetActive(sub, 0);
|
||||
uiItemR(sub, ptr, "object_property", 0, NULL, ICON_NONE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -294,7 +294,7 @@ static void nla_panel_properties(const bContext *C, Panel *pa)
|
||||
{
|
||||
PointerRNA strip_ptr;
|
||||
uiLayout *layout= pa->layout;
|
||||
uiLayout *column, *row, *subcol;
|
||||
uiLayout *column, *row, *sub;
|
||||
uiBlock *block;
|
||||
short showEvalProps = 1;
|
||||
|
||||
@ -339,10 +339,10 @@ static void nla_panel_properties(const bContext *C, Panel *pa)
|
||||
uiLayoutSetActive(column, RNA_boolean_get(&strip_ptr, "use_animated_influence")==0);
|
||||
uiItemR(column, &strip_ptr, "use_auto_blend", 0, NULL, ICON_NONE); // XXX as toggle?
|
||||
|
||||
subcol= uiLayoutColumn(column, 1);
|
||||
uiLayoutSetActive(subcol, RNA_boolean_get(&strip_ptr, "use_auto_blend")==0);
|
||||
uiItemR(subcol, &strip_ptr, "blend_in", 0, NULL, ICON_NONE);
|
||||
uiItemR(subcol, &strip_ptr, "blend_out", 0, NULL, ICON_NONE);
|
||||
sub= uiLayoutColumn(column, 1);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(&strip_ptr, "use_auto_blend")==0);
|
||||
uiItemR(sub, &strip_ptr, "blend_in", 0, NULL, ICON_NONE);
|
||||
uiItemR(sub, &strip_ptr, "blend_out", 0, NULL, ICON_NONE);
|
||||
|
||||
/* settings */
|
||||
column= uiLayoutColumn(layout, 1);
|
||||
@ -395,7 +395,7 @@ static void nla_panel_evaluation(const bContext *C, Panel *pa)
|
||||
{
|
||||
PointerRNA strip_ptr;
|
||||
uiLayout *layout= pa->layout;
|
||||
uiLayout *column, *subcolumn, *subrow;
|
||||
uiLayout *col, *sub;
|
||||
uiBlock *block;
|
||||
|
||||
/* check context and also validity of pointer */
|
||||
@ -405,23 +405,21 @@ static void nla_panel_evaluation(const bContext *C, Panel *pa)
|
||||
block= uiLayoutGetBlock(layout);
|
||||
uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL);
|
||||
|
||||
column= uiLayoutColumn(layout, 1);
|
||||
uiItemR(column, &strip_ptr, "use_animated_influence", 0, NULL, ICON_NONE);
|
||||
|
||||
subcolumn= uiLayoutColumn(column, 1);
|
||||
uiLayoutSetEnabled(subcolumn, RNA_boolean_get(&strip_ptr, "use_animated_influence"));
|
||||
uiItemR(subcolumn, &strip_ptr, "influence", 0, NULL, ICON_NONE);
|
||||
|
||||
col= uiLayoutColumn(layout, 1);
|
||||
uiItemR(col, &strip_ptr, "use_animated_influence", 0, NULL, ICON_NONE);
|
||||
|
||||
column= uiLayoutColumn(layout, 1);
|
||||
subrow= uiLayoutRow(column, 0);
|
||||
uiItemR(subrow, &strip_ptr, "use_animated_time", 0, NULL, ICON_NONE);
|
||||
uiItemR(subrow, &strip_ptr, "use_animated_time_cyclic", 0, NULL, ICON_NONE);
|
||||
sub= uiLayoutColumn(col, 1);
|
||||
uiLayoutSetEnabled(sub, RNA_boolean_get(&strip_ptr, "use_animated_influence"));
|
||||
uiItemR(sub, &strip_ptr, "influence", 0, NULL, ICON_NONE);
|
||||
|
||||
subcolumn= uiLayoutColumn(column, 1);
|
||||
subrow= uiLayoutRow(subcolumn, 0);
|
||||
uiLayoutSetEnabled(subrow, RNA_boolean_get(&strip_ptr, "use_animated_time"));
|
||||
uiItemR(subcolumn, &strip_ptr, "strip_time", 0, NULL, ICON_NONE);
|
||||
col= uiLayoutColumn(layout, 1);
|
||||
sub= uiLayoutRow(col, 0);
|
||||
uiItemR(sub, &strip_ptr, "use_animated_time", 0, NULL, ICON_NONE);
|
||||
uiItemR(sub, &strip_ptr, "use_animated_time_cyclic", 0, NULL, ICON_NONE);
|
||||
|
||||
sub= uiLayoutRow(col, 0);
|
||||
uiLayoutSetEnabled(sub, RNA_boolean_get(&strip_ptr, "use_animated_time"));
|
||||
uiItemR(sub, &strip_ptr, "strip_time", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
/* F-Modifiers for active NLA-Strip */
|
||||
|
@ -1840,7 +1840,7 @@ static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[][3], f
|
||||
BMIter viter;
|
||||
int i, start;
|
||||
|
||||
fill_vn(dists, em->bm->totvert, FLT_MAX);
|
||||
fill_vn_fl(dists, em->bm->totvert, FLT_MAX);
|
||||
|
||||
BM_ElemIndex_Ensure(em->bm, BM_VERT);
|
||||
|
||||
|
@ -174,7 +174,7 @@ void ED_uvedit_assign_image(Main *bmain, Scene *scene, Object *obedit, Image *im
|
||||
else {
|
||||
/* old shading system, assign image to selected faces */
|
||||
|
||||
/* ensure we have a uv layer */
|
||||
/* ensure we have a uv map */
|
||||
if(!CustomData_has_layer(&em->bm->pdata, CD_MTEXPOLY)) {
|
||||
BM_add_data_layer(em->bm, &em->bm->pdata, CD_MTEXPOLY);
|
||||
BM_add_data_layer(em->bm, &em->bm->ldata, CD_MLOOPUV);
|
||||
|
@ -928,7 +928,7 @@ static void uv_map_clip_correct(BMEditMesh *em, wmOperator *op)
|
||||
|
||||
/* ******************** Unwrap operator **************** */
|
||||
|
||||
/* assumes UV layer is checked, doesn't run update funcs */
|
||||
/* assumes UV Map is checked, doesn't run update funcs */
|
||||
void ED_unwrap_lscm(Scene *scene, Object *obedit, const short sel)
|
||||
{
|
||||
BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh;
|
||||
|
@ -887,7 +887,7 @@ typedef struct WeightVGEditModifierData {
|
||||
struct Object *mask_tex_map_obj; /* Name of the map object. */
|
||||
/* How to map the texture (using MOD_DISP_MAP_* constants). */
|
||||
int mask_tex_mapping;
|
||||
char mask_tex_uvlayer_name[32]; /* Name of the UV layer. */
|
||||
char mask_tex_uvlayer_name[32]; /* Name of the UV map. */
|
||||
|
||||
/* Padding... */
|
||||
int pad_i1;
|
||||
@ -932,7 +932,7 @@ typedef struct WeightVGMixModifierData {
|
||||
struct Tex *mask_texture; /* The texture. */
|
||||
struct Object *mask_tex_map_obj; /* Name of the map object. */
|
||||
int mask_tex_mapping; /* How to map the texture! */
|
||||
char mask_tex_uvlayer_name[32]; /* Name of the UV layer. */
|
||||
char mask_tex_uvlayer_name[32]; /* Name of the UV map. */
|
||||
|
||||
/* Padding... */
|
||||
int pad_i1;
|
||||
@ -979,7 +979,7 @@ typedef struct WeightVGProximityModifierData {
|
||||
struct Tex *mask_texture; /* The texture. */
|
||||
struct Object *mask_tex_map_obj; /* Name of the map object. */
|
||||
int mask_tex_mapping; /* How to map the texture! */
|
||||
char mask_tex_uvlayer_name[32]; /* Name of the UV layer. */
|
||||
char mask_tex_uvlayer_name[32]; /* Name of the UV Map. */
|
||||
|
||||
float min_dist, max_dist; /* Distances mapping to 0.0/1.0 weights. */
|
||||
|
||||
|
@ -277,6 +277,8 @@ typedef struct ImageFormatData {
|
||||
#define R_IMF_IMTYPE_XVID 32
|
||||
#define R_IMF_IMTYPE_THEORA 33
|
||||
|
||||
#define R_IMF_IMTYPE_INVALID 255
|
||||
|
||||
/* ImageFormatData.flag */
|
||||
#define R_IMF_FLAG_ZBUF (1<<0) /* was R_OPENEXR_ZBUF */
|
||||
#define R_IMF_FLAG_PREVIEW_JPG (1<<1) /* was R_PREVIEW_JPG */
|
||||
|
@ -412,7 +412,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
|
||||
|
||||
prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
|
||||
RNA_def_property_ui_text(prop, "UV Layer", "UV layer name");
|
||||
RNA_def_property_ui_text(prop, "UV Map", "UV map name");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DynamicPaint_uvlayer_set");
|
||||
|
||||
prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
|
||||
|
@ -443,7 +443,7 @@ static void rna_def_material_mtex(BlenderRNA *brna)
|
||||
|
||||
prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "uvname");
|
||||
RNA_def_property_ui_text(prop, "UV Layer", "UV layer to use for mapping with UV texture coordinates");
|
||||
RNA_def_property_ui_text(prop, "UV Map", "UV map to use for mapping with UV texture coordinates");
|
||||
RNA_def_property_update(prop, 0, "rna_Material_update");
|
||||
|
||||
prop= RNA_def_property(srna, "use_from_dupli", PROP_BOOLEAN, PROP_NONE);
|
||||
@ -1604,7 +1604,7 @@ static void rna_def_material_strand(BlenderRNA *brna)
|
||||
|
||||
prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "strand_uvname");
|
||||
RNA_def_property_ui_text(prop, "UV Layer", "Name of UV layer to override");
|
||||
RNA_def_property_ui_text(prop, "UV Map", "Name of UV map to override");
|
||||
RNA_def_property_update(prop, 0, "rna_Material_update");
|
||||
}
|
||||
|
||||
@ -1841,13 +1841,13 @@ void RNA_def_material(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "use_face_texture", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_FACETEXTURE);
|
||||
RNA_def_property_ui_text(prop, "Face Textures",
|
||||
"Replace the object's base color with color from face assigned image textures");
|
||||
"Replace the object's base color with color from UV map image textures");
|
||||
RNA_def_property_update(prop, 0, "rna_Material_update");
|
||||
|
||||
prop= RNA_def_property(srna, "use_face_texture_alpha", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_FACETEXTURE_ALPHA);
|
||||
RNA_def_property_ui_text(prop, "Face Textures Alpha",
|
||||
"Replace the object's base alpha value with alpha from face assigned image textures");
|
||||
"Replace the object's base alpha value with alpha from UV map image textures");
|
||||
RNA_def_property_update(prop, 0, "rna_Material_update");
|
||||
|
||||
prop= RNA_def_property(srna, "use_cast_shadows_only", PROP_BOOLEAN, PROP_NONE);
|
||||
|
@ -1647,7 +1647,7 @@ static void rna_def_mtexpoly(BlenderRNA *brna)
|
||||
#endif
|
||||
|
||||
srna= RNA_def_struct(brna, "MeshTextureFaceLayer", NULL);
|
||||
RNA_def_struct_ui_text(srna, "Mesh Texture Face Layer", "Layer of texture faces in a Mesh datablock");
|
||||
RNA_def_struct_ui_text(srna, "Mesh UV Map", "UV map with assigned image textures in a Mesh datablock");
|
||||
RNA_def_struct_sdna(srna, "CustomDataLayer");
|
||||
RNA_def_struct_path_func(srna, "rna_MeshTextureFaceLayer_path");
|
||||
RNA_def_struct_ui_icon(srna, ICON_GROUP_UVS);
|
||||
@ -1655,24 +1655,24 @@ static void rna_def_mtexpoly(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
||||
RNA_def_struct_name_property(srna, prop);
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshTextureFaceLayer_name_set");
|
||||
RNA_def_property_ui_text(prop, "Name", "Name of UV unwrapping layer");
|
||||
RNA_def_property_ui_text(prop, "Name", "Name of UV map");
|
||||
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
||||
|
||||
prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_active_get", "rna_MeshTextureFaceLayer_active_set");
|
||||
RNA_def_property_ui_text(prop, "Active", "Set the layer as active for display and editing");
|
||||
RNA_def_property_ui_text(prop, "Active", "Set the map as active for display and editing");
|
||||
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
||||
|
||||
prop= RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0);
|
||||
RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_active_render_get", "rna_MeshTextureFaceLayer_active_render_set");
|
||||
RNA_def_property_ui_text(prop, "Active Render", "Set the layer as active for rendering");
|
||||
RNA_def_property_ui_text(prop, "Active Render", "Set the map as active for rendering");
|
||||
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
||||
|
||||
prop= RNA_def_property(srna, "active_clone", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "active_clone", 0);
|
||||
RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_clone_get", "rna_MeshTextureFaceLayer_clone_set");
|
||||
RNA_def_property_ui_text(prop, "Active Clone", "Set the layer as active for cloning");
|
||||
RNA_def_property_ui_text(prop, "Active Clone", "Set the map as active for cloning");
|
||||
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
||||
|
||||
prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
|
||||
@ -1682,7 +1682,7 @@ static void rna_def_mtexpoly(BlenderRNA *brna)
|
||||
|
||||
srna= RNA_def_struct(brna, "MeshTextureFace", NULL);
|
||||
RNA_def_struct_sdna(srna, "MTexPoly");
|
||||
RNA_def_struct_ui_text(srna, "Mesh Texture Face", "UV mapping, texturing and game engine data for a face");
|
||||
RNA_def_struct_ui_text(srna, "Mesh UV Map Face", "UV map and image texture for a face");
|
||||
RNA_def_struct_path_func(srna, "rna_MeshTextureFace_path");
|
||||
RNA_def_struct_ui_icon(srna, ICON_FACESEL_HLT);
|
||||
|
||||
@ -2147,12 +2147,12 @@ static void rna_def_uv_textures(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
RNA_def_property_srna(cprop, "UVTextures");
|
||||
srna= RNA_def_struct(brna, "UVTextures", NULL);
|
||||
RNA_def_struct_sdna(srna, "Mesh");
|
||||
RNA_def_struct_ui_text(srna, "UV Textures", "Collection of uv textures");
|
||||
RNA_def_struct_ui_text(srna, "UV Maps", "Collection of UV maps");
|
||||
|
||||
func= RNA_def_function(srna, "new", "rna_Mesh_uv_texture_new");
|
||||
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
||||
RNA_def_function_ui_description(func, "Add a UV texture layer to Mesh");
|
||||
RNA_def_string(func, "name", "UVTex", 0, "", "UV Texture name");
|
||||
RNA_def_string(func, "name", "UVMap", 0, "", "UV map name");
|
||||
parm= RNA_def_pointer(func, "layer", "MeshTextureFaceLayer", "", "The newly created layer");
|
||||
RNA_def_function_return(func, parm);
|
||||
|
||||
@ -2167,12 +2167,12 @@ static void rna_def_uv_textures(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
|
||||
RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_uv_texture_get", "rna_Mesh_active_uv_texture_set", NULL, NULL);
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Active UV Texture", "Active UV texture");
|
||||
RNA_def_property_ui_text(prop, "Active UV Map", "Active UV Map");
|
||||
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
||||
|
||||
prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
|
||||
RNA_def_property_int_funcs(prop, "rna_Mesh_active_uv_texture_index_get", "rna_Mesh_active_uv_texture_index_set", "rna_Mesh_active_uv_texture_index_range");
|
||||
RNA_def_property_ui_text(prop, "Active UV Texture Index", "Active UV texture index");
|
||||
RNA_def_property_ui_text(prop, "Active UV Map Index", "Active UV Map index");
|
||||
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
||||
}
|
||||
|
||||
@ -2261,28 +2261,28 @@ static void rna_def_mesh(BlenderRNA *brna)
|
||||
RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_textures_begin", NULL, NULL, NULL,
|
||||
"rna_Mesh_uv_textures_length", NULL, NULL, NULL);
|
||||
RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
|
||||
RNA_def_property_ui_text(prop, "UV Textures", "All UV texture layers");
|
||||
RNA_def_property_ui_text(prop, "Clone UV Map", "UV map to be used as cloning source");
|
||||
rna_def_uv_textures(brna, prop);
|
||||
|
||||
prop= RNA_def_property(srna, "uv_texture_clone", PROP_POINTER, PROP_UNSIGNED);
|
||||
RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
|
||||
RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_texture_clone_get", "rna_Mesh_uv_texture_clone_set", NULL, NULL);
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Clone UV Texture", "UV texture layer to be used as cloning source");
|
||||
RNA_def_property_ui_text(prop, "Clone UV Map", "UV map to be used as cloning source");
|
||||
|
||||
prop= RNA_def_property(srna, "uv_texture_clone_index", PROP_INT, PROP_UNSIGNED);
|
||||
RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_clone_index_get", "rna_Mesh_uv_texture_clone_index_set", "rna_Mesh_active_uv_texture_index_range");
|
||||
RNA_def_property_ui_text(prop, "Clone UV Texture Index", "Clone UV texture layer index");
|
||||
RNA_def_property_ui_text(prop, "Clone UV Map Index", "Clone UV texture index");
|
||||
|
||||
prop= RNA_def_property(srna, "uv_texture_stencil", PROP_POINTER, PROP_UNSIGNED);
|
||||
RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
|
||||
RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_texture_stencil_get", "rna_Mesh_uv_texture_stencil_set", NULL, NULL);
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Mask UV Texture", "UV texture layer to mask the painted area");
|
||||
RNA_def_property_ui_text(prop, "Mask UV Map", "UV map to mask the painted area");
|
||||
|
||||
prop= RNA_def_property(srna, "uv_texture_stencil_index", PROP_INT, PROP_UNSIGNED);
|
||||
RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_stencil_index_get", "rna_Mesh_uv_texture_stencil_index_set", "rna_Mesh_active_uv_texture_index_range");
|
||||
RNA_def_property_ui_text(prop, "Mask UV Texture Index", "Mask UV texture layer index");
|
||||
RNA_def_property_ui_text(prop, "Mask UV Map Index", "Mask UV map index");
|
||||
|
||||
/* Vertex colors */
|
||||
|
||||
|
@ -808,7 +808,7 @@ static void rna_def_modifier_generic_map_info(StructRNA *srna)
|
||||
|
||||
prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
|
||||
RNA_def_property_ui_text(prop, "UV Layer", "UV layer name");
|
||||
RNA_def_property_ui_text(prop, "UV Map", "UV map name");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MappingInfo_uvlayer_set");
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
@ -1236,7 +1236,7 @@ static void rna_def_modifier_wave(BlenderRNA *brna)
|
||||
|
||||
prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
|
||||
RNA_def_property_ui_text(prop, "UV Layer", "UV layer name");
|
||||
RNA_def_property_ui_text(prop, "UV Map", "UV map name");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WaveModifier_uvlayer_set");
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
@ -1607,7 +1607,7 @@ static void rna_def_modifier_uvproject(BlenderRNA *brna)
|
||||
|
||||
prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
|
||||
RNA_def_property_ui_text(prop, "UV Layer", "UV layer name");
|
||||
RNA_def_property_ui_text(prop, "UV Map", "UV map name");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_UVProjectModifier_uvlayer_set");
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
@ -2004,7 +2004,7 @@ static void rna_def_modifier_explode(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "particle_uv", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "uvname");
|
||||
RNA_def_property_string_maxlength(prop, 32);
|
||||
RNA_def_property_ui_text(prop, "Particle UV", "UV Layer to change with particle age");
|
||||
RNA_def_property_ui_text(prop, "Particle UV", "UV map to change with particle age");
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
}
|
||||
|
||||
@ -2623,7 +2623,7 @@ static void rna_def_modifier_weightvg_mask(BlenderRNA *brna, StructRNA *srna)
|
||||
|
||||
prop= RNA_def_property(srna, "mask_tex_uv_layer", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "mask_tex_uvlayer_name");
|
||||
RNA_def_property_ui_text(prop, "UV Layer", "UV layer name");
|
||||
RNA_def_property_ui_text(prop, "UV Map", "UV map name");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGModifier_mask_uvlayer_set");
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
|
@ -1187,7 +1187,7 @@ static void def_sh_geometry(StructRNA *srna)
|
||||
|
||||
prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "uvname");
|
||||
RNA_def_property_ui_text(prop, "UV Layer", "");
|
||||
RNA_def_property_ui_text(prop, "UV Map", "");
|
||||
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "color_layer", PROP_STRING, PROP_NONE);
|
||||
|
@ -1194,7 +1194,7 @@ static void rna_Object_boundbox_get(PointerRNA *ptr, float *values)
|
||||
memcpy(values, bb->vec, sizeof(bb->vec));
|
||||
}
|
||||
else {
|
||||
fill_vn(values, sizeof(bb->vec)/sizeof(float), 0.0f);
|
||||
fill_vn_fl(values, sizeof(bb->vec)/sizeof(float), 0.0f);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1287,7 +1287,7 @@ static void rna_def_particle_settings_mtex(BlenderRNA *brna)
|
||||
|
||||
prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "uvname");
|
||||
RNA_def_property_ui_text(prop, "UV Layer", "UV layer to use for mapping with UV texture coordinates");
|
||||
RNA_def_property_ui_text(prop, "UV Map", "UV map to use for mapping with UV texture coordinates");
|
||||
RNA_def_property_update(prop, 0, "rna_Particle_reset");
|
||||
|
||||
prop= RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
|
||||
@ -2717,17 +2717,17 @@ static void rna_def_particle_system(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "billboard_normal_uv", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "bb_uvname[0]");
|
||||
RNA_def_property_string_maxlength(prop, 32);
|
||||
RNA_def_property_ui_text(prop, "Billboard Normal UV", "UV Layer to control billboard normals");
|
||||
RNA_def_property_ui_text(prop, "Billboard Normal UV", "UV map to control billboard normals");
|
||||
|
||||
prop= RNA_def_property(srna, "billboard_time_index_uv", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "bb_uvname[1]");
|
||||
RNA_def_property_string_maxlength(prop, 32);
|
||||
RNA_def_property_ui_text(prop, "Billboard Time Index UV", "UV Layer to control billboard time index (X-Y)");
|
||||
RNA_def_property_ui_text(prop, "Billboard Time Index UV", "UV map to control billboard time index (X-Y)");
|
||||
|
||||
prop= RNA_def_property(srna, "billboard_split_uv", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "bb_uvname[2]");
|
||||
RNA_def_property_string_maxlength(prop, 32);
|
||||
RNA_def_property_ui_text(prop, "Billboard Split UV", "UV Layer to control billboard splitting");
|
||||
RNA_def_property_ui_text(prop, "Billboard Split UV", "UV map to control billboard splitting");
|
||||
|
||||
/* vertex groups */
|
||||
|
||||
|
@ -105,83 +105,87 @@ EnumPropertyItem snap_element_items[] = {
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
|
||||
|
||||
/* note on duplicate block, perhaps we should use some trick to avoid
|
||||
* the duplicate, but with the inline defines it becomes very tricky
|
||||
* this awaits someone who has very good preprocessor-fu.
|
||||
* for now just make sure they stay in sync - campbell */
|
||||
/* workaround for duplice enums,
|
||||
* have each enum line as a defne then conditionally set it or not
|
||||
*/
|
||||
|
||||
#define R_IMF_ENUM_BMP {R_IMF_IMTYPE_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"},
|
||||
#define R_IMF_ENUM_IRIS {R_IMF_IMTYPE_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", "Output image in (old!) SGI IRIS format"},
|
||||
#define R_IMF_ENUM_PNG {R_IMF_IMTYPE_PNG, "PNG", ICON_FILE_IMAGE, "PNG", "Output image in PNG format"},
|
||||
#define R_IMF_ENUM_JPEG {R_IMF_IMTYPE_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", "Output image in JPEG format"},
|
||||
#define R_IMF_ENUM_TAGA {R_IMF_IMTYPE_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", "Output image in Targa format"},
|
||||
#define R_IMF_ENUM_TAGA_RAW {R_IMF_IMTYPE_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", "Output image in uncompressed Targa format"},
|
||||
|
||||
|
||||
#ifdef WITH_DDS
|
||||
# define R_IMF_ENUM_DDS {R_IMF_IMTYPE_DDS, "DDS", ICON_FILE_IMAGE, "DDS", "Output image in DDS format"},
|
||||
#else
|
||||
# define R_IMF_ENUM_DDS
|
||||
#endif
|
||||
|
||||
#ifdef WITH_OPENJPEG
|
||||
# define R_IMF_ENUM_JPEG2K {R_IMF_IMTYPE_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", "Output image in JPEG 2000 format"},
|
||||
#else
|
||||
# define R_IMF_ENUM_JPEG2K
|
||||
#endif
|
||||
|
||||
#ifdef WITH_CINEON
|
||||
# define R_IMF_ENUM_CINEON {R_IMF_IMTYPE_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", "Output image in Cineon format"},
|
||||
# define R_IMF_ENUM_DPX {R_IMF_IMTYPE_DPX, "DPX",ICON_FILE_IMAGE, "DPX", "Output image in DPX format"},
|
||||
#else
|
||||
# define R_IMF_ENUM_CINEON
|
||||
# define R_IMF_ENUM_DPX
|
||||
#endif
|
||||
|
||||
#ifdef WITH_OPENEXR
|
||||
# define R_IMF_ENUM_EXR_MULTI {R_IMF_IMTYPE_MULTILAYER, "MULTILAYER", ICON_FILE_IMAGE, "MultiLayer", "Output image in multilayer OpenEXR format"},
|
||||
# define R_IMF_ENUM_EXR {R_IMF_IMTYPE_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", "Output image in OpenEXR format"},
|
||||
#else
|
||||
# define R_IMF_ENUM_EXR_MULTI
|
||||
# define R_IMF_ENUM_EXR
|
||||
#endif
|
||||
|
||||
#ifdef WITH_HDR
|
||||
# define R_IMF_ENUM_HDR {R_IMF_IMTYPE_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", "Output image in Radiance HDR format"},
|
||||
#else
|
||||
# define R_IMF_ENUM_HDR
|
||||
#endif
|
||||
|
||||
#ifdef WITH_TIFF
|
||||
# define R_IMF_ENUM_TIFF {R_IMF_IMTYPE_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", "Output image in TIFF format"},
|
||||
#else
|
||||
# define R_IMF_ENUM_TIFF
|
||||
#endif
|
||||
|
||||
|
||||
#define IMAGE_TYPE_ITEMS_IMAGE_ONLY \
|
||||
R_IMF_ENUM_BMP \
|
||||
R_IMF_ENUM_DDS \
|
||||
R_IMF_ENUM_IRIS \
|
||||
R_IMF_ENUM_PNG \
|
||||
R_IMF_ENUM_JPEG \
|
||||
R_IMF_ENUM_JPEG2K \
|
||||
R_IMF_ENUM_TAGA \
|
||||
R_IMF_ENUM_TAGA_RAW \
|
||||
{0, "", 0, " ", NULL}, \
|
||||
R_IMF_ENUM_CINEON \
|
||||
R_IMF_ENUM_DPX \
|
||||
R_IMF_ENUM_EXR_MULTI \
|
||||
R_IMF_ENUM_EXR \
|
||||
R_IMF_ENUM_HDR \
|
||||
R_IMF_ENUM_TIFF \
|
||||
|
||||
|
||||
EnumPropertyItem image_only_type_items[] = {
|
||||
|
||||
IMAGE_TYPE_ITEMS_IMAGE_ONLY
|
||||
|
||||
/* --- duplicate block warning (see below) --- */
|
||||
#define IMAGE_TYPE_ITEMS_IMAGE_ONLY
|
||||
{R_IMF_IMTYPE_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"},
|
||||
#ifdef WITH_DDS
|
||||
{R_IMF_IMTYPE_DDS, "DDS", ICON_FILE_IMAGE, "DDS", "Output image in DDS format"},
|
||||
#endif
|
||||
{R_IMF_IMTYPE_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", "Output image in (old!) SGI IRIS format"},
|
||||
{R_IMF_IMTYPE_PNG, "PNG", ICON_FILE_IMAGE, "PNG", "Output image in PNG format"},
|
||||
{R_IMF_IMTYPE_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", "Output image in JPEG format"},
|
||||
#ifdef WITH_OPENJPEG
|
||||
{R_IMF_IMTYPE_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", "Output image in JPEG 2000 format"},
|
||||
#endif
|
||||
{R_IMF_IMTYPE_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", "Output image in Targa format"},
|
||||
{R_IMF_IMTYPE_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", "Output image in uncompressed Targa format"},
|
||||
{0, "", 0, " ", NULL},
|
||||
#ifdef WITH_CINEON
|
||||
{R_IMF_IMTYPE_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", "Output image in Cineon format"},
|
||||
{R_IMF_IMTYPE_DPX, "DPX",ICON_FILE_IMAGE, "DPX", "Output image in DPX format"},
|
||||
#endif
|
||||
#ifdef WITH_OPENEXR
|
||||
{R_IMF_IMTYPE_MULTILAYER, "MULTILAYER", ICON_FILE_IMAGE, "MultiLayer", "Output image in multilayer OpenEXR format"},
|
||||
{R_IMF_IMTYPE_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", "Output image in OpenEXR format"},
|
||||
#endif
|
||||
#ifdef WITH_HDR
|
||||
{R_IMF_IMTYPE_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", "Output image in Radiance HDR format"},
|
||||
#endif
|
||||
#ifdef WITH_TIFF
|
||||
{R_IMF_IMTYPE_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", "Output image in TIFF format"},
|
||||
#endif
|
||||
/* --- end duplicate block (see below) --- */
|
||||
|
||||
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
|
||||
EnumPropertyItem image_type_items[] = {
|
||||
{0, "", 0, "Image", NULL},
|
||||
|
||||
|
||||
/* --- duplicate block warning (see above) --- */
|
||||
#define IMAGE_TYPE_ITEMS_IMAGE_ONLY
|
||||
{R_IMF_IMTYPE_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"},
|
||||
#ifdef WITH_DDS
|
||||
{R_IMF_IMTYPE_DDS, "DDS", ICON_FILE_IMAGE, "DDS", "Output image in DDS format"},
|
||||
#endif
|
||||
{R_IMF_IMTYPE_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", "Output image in (old!) SGI IRIS format"},
|
||||
{R_IMF_IMTYPE_PNG, "PNG", ICON_FILE_IMAGE, "PNG", "Output image in PNG format"},
|
||||
{R_IMF_IMTYPE_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", "Output image in JPEG format"},
|
||||
#ifdef WITH_OPENJPEG
|
||||
{R_IMF_IMTYPE_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", "Output image in JPEG 2000 format"},
|
||||
#endif
|
||||
{R_IMF_IMTYPE_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", "Output image in Targa format"},
|
||||
{R_IMF_IMTYPE_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", "Output image in uncompressed Targa format"},
|
||||
{0, "", 0, " ", NULL},
|
||||
#ifdef WITH_CINEON
|
||||
{R_IMF_IMTYPE_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", "Output image in Cineon format"},
|
||||
{R_IMF_IMTYPE_DPX, "DPX",ICON_FILE_IMAGE, "DPX", "Output image in DPX format"},
|
||||
#endif
|
||||
#ifdef WITH_OPENEXR
|
||||
{R_IMF_IMTYPE_MULTILAYER, "MULTILAYER", ICON_FILE_IMAGE, "MultiLayer", "Output image in multilayer OpenEXR format"},
|
||||
{R_IMF_IMTYPE_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", "Output image in OpenEXR format"},
|
||||
#endif
|
||||
#ifdef WITH_HDR
|
||||
{R_IMF_IMTYPE_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", "Output image in Radiance HDR format"},
|
||||
#endif
|
||||
#ifdef WITH_TIFF
|
||||
{R_IMF_IMTYPE_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", "Output image in TIFF format"},
|
||||
#endif
|
||||
/* --- end duplicate block (see above) --- */
|
||||
|
||||
IMAGE_TYPE_ITEMS_IMAGE_ONLY
|
||||
|
||||
{0, "", 0, "Movie", NULL},
|
||||
#ifdef _WIN32
|
||||
|
@ -339,7 +339,7 @@ static void rna_def_image_paint(BlenderRNA *brna)
|
||||
|
||||
prop= RNA_def_property(srna, "use_stencil_layer", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_STENCIL);
|
||||
RNA_def_property_ui_text(prop, "Stencil Layer", "Set the mask layer from the UV layer buttons");
|
||||
RNA_def_property_ui_text(prop, "Stencil Layer", "Set the mask layer from the UV map buttons");
|
||||
|
||||
prop= RNA_def_property(srna, "invert_stencil", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_STENCIL_INV);
|
||||
@ -347,8 +347,8 @@ static void rna_def_image_paint(BlenderRNA *brna)
|
||||
|
||||
prop= RNA_def_property(srna, "use_clone_layer", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_CLONE);
|
||||
RNA_def_property_ui_text(prop, "Clone Layer",
|
||||
"Use another UV layer as clone source, otherwise use 3D the cursor as the source");
|
||||
RNA_def_property_ui_text(prop, "Clone Map",
|
||||
"Use another UV map as clone source, otherwise use 3D the cursor as the source");
|
||||
|
||||
/* integers */
|
||||
|
||||
|
@ -170,7 +170,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
|
||||
|
||||
if(num_projectors == 0) return dm;
|
||||
|
||||
/* make sure there are UV layers available */
|
||||
/* make sure there are UV Maps available */
|
||||
|
||||
if(!CustomData_has_layer(&dm->faceData, CD_MTFACE)) return dm;
|
||||
|
||||
@ -259,7 +259,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
|
||||
mul_mat3_m4_v3(projectors[i].ob->obmat, projectors[i].normal);
|
||||
}
|
||||
|
||||
/* make sure we are not modifying the original UV layer */
|
||||
/* make sure we are not modifying the original UV map */
|
||||
tface = CustomData_duplicate_referenced_layer_named(&dm->faceData,
|
||||
CD_MTFACE, uvname);
|
||||
|
||||
|
@ -61,7 +61,7 @@ static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(i
|
||||
int i;
|
||||
|
||||
if(ngeo->uvname[0]) {
|
||||
/* find uv layer by name */
|
||||
/* find uv map by name */
|
||||
for(i = 0; i < shi->totuv; i++) {
|
||||
if(strcmp(shi->uv[i].name, ngeo->uvname)==0) {
|
||||
suv= &shi->uv[i];
|
||||
|
@ -619,11 +619,11 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
|
||||
case PROP_ALL_VECTOR_SUBTYPES:
|
||||
if (len>=2 && len <= 4) {
|
||||
if (is_thick) {
|
||||
ret= newVectorObject(NULL, len, Py_NEW, NULL);
|
||||
ret= Vector_CreatePyObject(NULL, len, Py_NEW, NULL);
|
||||
RNA_property_float_get_array(ptr, prop, ((VectorObject *)ret)->vec);
|
||||
}
|
||||
else {
|
||||
PyObject *vec_cb= newVectorObject_cb(ret, len, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_VEC);
|
||||
PyObject *vec_cb= Vector_CreatePyObject_cb(ret, len, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_VEC);
|
||||
Py_DECREF(ret); /* the vector owns now */
|
||||
ret= vec_cb; /* return the vector instead */
|
||||
}
|
||||
@ -632,22 +632,22 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
|
||||
case PROP_MATRIX:
|
||||
if (len==16) {
|
||||
if (is_thick) {
|
||||
ret= newMatrixObject(NULL, 4, 4, Py_NEW, NULL);
|
||||
ret= Matrix_CreatePyObject(NULL, 4, 4, Py_NEW, NULL);
|
||||
RNA_property_float_get_array(ptr, prop, ((MatrixObject *)ret)->contigPtr);
|
||||
}
|
||||
else {
|
||||
PyObject *mat_cb= newMatrixObject_cb(ret, 4,4, mathutils_rna_matrix_cb_index, FALSE);
|
||||
PyObject *mat_cb= Matrix_CreatePyObject_cb(ret, 4,4, mathutils_rna_matrix_cb_index, FALSE);
|
||||
Py_DECREF(ret); /* the matrix owns now */
|
||||
ret= mat_cb; /* return the matrix instead */
|
||||
}
|
||||
}
|
||||
else if (len==9) {
|
||||
if (is_thick) {
|
||||
ret= newMatrixObject(NULL, 3, 3, Py_NEW, NULL);
|
||||
ret= Matrix_CreatePyObject(NULL, 3, 3, Py_NEW, NULL);
|
||||
RNA_property_float_get_array(ptr, prop, ((MatrixObject *)ret)->contigPtr);
|
||||
}
|
||||
else {
|
||||
PyObject *mat_cb= newMatrixObject_cb(ret, 3,3, mathutils_rna_matrix_cb_index, FALSE);
|
||||
PyObject *mat_cb= Matrix_CreatePyObject_cb(ret, 3,3, mathutils_rna_matrix_cb_index, FALSE);
|
||||
Py_DECREF(ret); /* the matrix owns now */
|
||||
ret= mat_cb; /* return the matrix instead */
|
||||
}
|
||||
@ -661,23 +661,23 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
|
||||
PropertyRNA *prop_eul_order= NULL;
|
||||
short order= pyrna_rotation_euler_order_get(ptr, &prop_eul_order, EULER_ORDER_XYZ);
|
||||
|
||||
ret= newEulerObject(NULL, order, Py_NEW, NULL); // TODO, get order from RNA
|
||||
ret= Euler_CreatePyObject(NULL, order, Py_NEW, NULL); // TODO, get order from RNA
|
||||
RNA_property_float_get_array(ptr, prop, ((EulerObject *)ret)->eul);
|
||||
}
|
||||
else {
|
||||
/* order will be updated from callback on use */
|
||||
PyObject *eul_cb= newEulerObject_cb(ret, EULER_ORDER_XYZ, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_EUL); // TODO, get order from RNA
|
||||
PyObject *eul_cb= Euler_CreatePyObject_cb(ret, EULER_ORDER_XYZ, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_EUL); // TODO, get order from RNA
|
||||
Py_DECREF(ret); /* the euler owns now */
|
||||
ret= eul_cb; /* return the euler instead */
|
||||
}
|
||||
}
|
||||
else if (len==4) {
|
||||
if (is_thick) {
|
||||
ret= newQuaternionObject(NULL, Py_NEW, NULL);
|
||||
ret= Quaternion_CreatePyObject(NULL, Py_NEW, NULL);
|
||||
RNA_property_float_get_array(ptr, prop, ((QuaternionObject *)ret)->quat);
|
||||
}
|
||||
else {
|
||||
PyObject *quat_cb= newQuaternionObject_cb(ret, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_QUAT);
|
||||
PyObject *quat_cb= Quaternion_CreatePyObject_cb(ret, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_QUAT);
|
||||
Py_DECREF(ret); /* the quat owns now */
|
||||
ret= quat_cb; /* return the quat instead */
|
||||
}
|
||||
@ -687,11 +687,11 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
|
||||
case PROP_COLOR_GAMMA:
|
||||
if (len==3) { /* color */
|
||||
if (is_thick) {
|
||||
ret= newColorObject(NULL, Py_NEW, NULL); // TODO, get order from RNA
|
||||
ret= Color_CreatePyObject(NULL, Py_NEW, NULL); // TODO, get order from RNA
|
||||
RNA_property_float_get_array(ptr, prop, ((ColorObject *)ret)->col);
|
||||
}
|
||||
else {
|
||||
PyObject *col_cb= newColorObject_cb(ret, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_COLOR);
|
||||
PyObject *col_cb= Color_CreatePyObject_cb(ret, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_COLOR);
|
||||
Py_DECREF(ret); /* the color owns now */
|
||||
ret= col_cb; /* return the color instead */
|
||||
}
|
||||
@ -4543,15 +4543,15 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
|
||||
switch(RNA_property_subtype(prop)) {
|
||||
#ifdef USE_MATHUTILS
|
||||
case PROP_ALL_VECTOR_SUBTYPES:
|
||||
ret= newVectorObject(data, len, Py_NEW, NULL);
|
||||
ret= Vector_CreatePyObject(data, len, Py_NEW, NULL);
|
||||
break;
|
||||
case PROP_MATRIX:
|
||||
if (len==16) {
|
||||
ret= newMatrixObject(data, 4, 4, Py_NEW, NULL);
|
||||
ret= Matrix_CreatePyObject(data, 4, 4, Py_NEW, NULL);
|
||||
break;
|
||||
}
|
||||
else if (len==9) {
|
||||
ret= newMatrixObject(data, 3, 3, Py_NEW, NULL);
|
||||
ret= Matrix_CreatePyObject(data, 3, 3, Py_NEW, NULL);
|
||||
break;
|
||||
}
|
||||
/* pass through */
|
||||
|
@ -61,7 +61,7 @@ static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||
"more then a single arg given");
|
||||
return NULL;
|
||||
}
|
||||
return newColorObject(col, Py_NEW, type);
|
||||
return Color_CreatePyObject(col, Py_NEW, type);
|
||||
}
|
||||
|
||||
//-----------------------------METHODS----------------------------
|
||||
@ -104,7 +104,7 @@ static PyObject *Color_copy(ColorObject *self)
|
||||
if (BaseMath_ReadCallback(self) == -1)
|
||||
return NULL;
|
||||
|
||||
return newColorObject(self->col, Py_NEW, Py_TYPE(self));
|
||||
return Color_CreatePyObject(self->col, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
//----------------------------print object (internal)--------------
|
||||
@ -384,7 +384,7 @@ static PyObject *Color_add(PyObject *v1, PyObject *v2)
|
||||
|
||||
add_vn_vnvn(col, color1->col, color2->col, COLOR_SIZE);
|
||||
|
||||
return newColorObject(col, Py_NEW, Py_TYPE(v1));
|
||||
return Color_CreatePyObject(col, Py_NEW, Py_TYPE(v1));
|
||||
}
|
||||
|
||||
/* addition in-place: obj += obj */
|
||||
@ -433,7 +433,7 @@ static PyObject *Color_sub(PyObject *v1, PyObject *v2)
|
||||
|
||||
sub_vn_vnvn(col, color1->col, color2->col, COLOR_SIZE);
|
||||
|
||||
return newColorObject(col, Py_NEW, Py_TYPE(v1));
|
||||
return Color_CreatePyObject(col, Py_NEW, Py_TYPE(v1));
|
||||
}
|
||||
|
||||
/* subtraction in-place: obj -= obj */
|
||||
@ -465,7 +465,7 @@ static PyObject *color_mul_float(ColorObject *color, const float scalar)
|
||||
{
|
||||
float tcol[COLOR_SIZE];
|
||||
mul_vn_vn_fl(tcol, color->col, COLOR_SIZE, scalar);
|
||||
return newColorObject(tcol, Py_NEW, Py_TYPE(color));
|
||||
return Color_CreatePyObject(tcol, Py_NEW, Py_TYPE(color));
|
||||
}
|
||||
|
||||
|
||||
@ -612,7 +612,7 @@ static PyObject *Color_neg(ColorObject *self)
|
||||
return NULL;
|
||||
|
||||
negate_vn_vn(tcol, self->col, COLOR_SIZE);
|
||||
return newColorObject(tcol, Py_NEW, Py_TYPE(self));
|
||||
return Color_CreatePyObject(tcol, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
|
||||
@ -821,13 +821,13 @@ PyTypeObject color_Type = {
|
||||
NULL, //tp_weaklist
|
||||
NULL //tp_del
|
||||
};
|
||||
//------------------------newColorObject (internal)-------------
|
||||
//------------------------Color_CreatePyObject (internal)-------------
|
||||
//creates a new color object
|
||||
/*pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
|
||||
(i.e. it was allocated elsewhere by MEM_mallocN())
|
||||
pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
|
||||
(i.e. it must be created here with PyMEM_malloc())*/
|
||||
PyObject *newColorObject(float *col, int type, PyTypeObject *base_type)
|
||||
PyObject *Color_CreatePyObject(float *col, int type, PyTypeObject *base_type)
|
||||
{
|
||||
ColorObject *self;
|
||||
|
||||
@ -860,9 +860,9 @@ PyObject *newColorObject(float *col, int type, PyTypeObject *base_type)
|
||||
return (PyObject *)self;
|
||||
}
|
||||
|
||||
PyObject *newColorObject_cb(PyObject *cb_user, int cb_type, int cb_subtype)
|
||||
PyObject *Color_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype)
|
||||
{
|
||||
ColorObject *self= (ColorObject *)newColorObject(NULL, Py_NEW, NULL);
|
||||
ColorObject *self= (ColorObject *)Color_CreatePyObject(NULL, Py_NEW, NULL);
|
||||
if (self) {
|
||||
Py_INCREF(cb_user);
|
||||
self->cb_user= cb_user;
|
||||
|
@ -48,7 +48,7 @@ be stored in py_data) or be a wrapper for data allocated through
|
||||
blender (stored in blend_data). This is an either/or struct not both*/
|
||||
|
||||
//prototypes
|
||||
PyObject *newColorObject( float *col, int type, PyTypeObject *base_type);
|
||||
PyObject *newColorObject_cb(PyObject *cb_user, int cb_type, int cb_subtype);
|
||||
PyObject *Color_CreatePyObject( float *col, int type, PyTypeObject *base_type);
|
||||
PyObject *Color_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype);
|
||||
|
||||
#endif /* MATHUTILS_COLOR_H */
|
||||
|
@ -71,7 +71,7 @@ static PyObject *Euler_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
return newEulerObject(eul, order, Py_NEW, type);
|
||||
return Euler_CreatePyObject(eul, order, Py_NEW, type);
|
||||
}
|
||||
|
||||
/* internal use, assume read callback is done */
|
||||
@ -142,7 +142,7 @@ static PyObject *Euler_to_quaternion(EulerObject * self)
|
||||
|
||||
eulO_to_quat(quat, self->eul, self->order);
|
||||
|
||||
return newQuaternionObject(quat, Py_NEW, NULL);
|
||||
return Quaternion_CreatePyObject(quat, Py_NEW, NULL);
|
||||
}
|
||||
|
||||
//return a matrix representation of the euler
|
||||
@ -163,7 +163,7 @@ static PyObject *Euler_to_matrix(EulerObject * self)
|
||||
|
||||
eulO_to_mat3((float (*)[3])mat, self->eul, self->order);
|
||||
|
||||
return newMatrixObject(mat, 3, 3 , Py_NEW, NULL);
|
||||
return Matrix_CreatePyObject(mat, 3, 3 , Py_NEW, NULL);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Euler_zero_doc,
|
||||
@ -293,7 +293,7 @@ static PyObject *Euler_copy(EulerObject *self)
|
||||
if (BaseMath_ReadCallback(self) == -1)
|
||||
return NULL;
|
||||
|
||||
return newEulerObject(self->eul, self->order, Py_NEW, Py_TYPE(self));
|
||||
return Euler_CreatePyObject(self->eul, self->order, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
//----------------------------print object (internal)--------------
|
||||
@ -664,13 +664,13 @@ PyTypeObject euler_Type = {
|
||||
NULL, //tp_weaklist
|
||||
NULL //tp_del
|
||||
};
|
||||
//------------------------newEulerObject (internal)-------------
|
||||
//------------------------Euler_CreatePyObject (internal)-------------
|
||||
//creates a new euler object
|
||||
/*pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
|
||||
(i.e. it was allocated elsewhere by MEM_mallocN())
|
||||
pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
|
||||
(i.e. it must be created here with PyMEM_malloc())*/
|
||||
PyObject *newEulerObject(float *eul, short order, int type, PyTypeObject *base_type)
|
||||
PyObject *Euler_CreatePyObject(float *eul, short order, int type, PyTypeObject *base_type)
|
||||
{
|
||||
EulerObject *self;
|
||||
|
||||
@ -707,9 +707,9 @@ PyObject *newEulerObject(float *eul, short order, int type, PyTypeObject *base_t
|
||||
return (PyObject *)self;
|
||||
}
|
||||
|
||||
PyObject *newEulerObject_cb(PyObject *cb_user, short order, int cb_type, int cb_subtype)
|
||||
PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, short order, int cb_type, int cb_subtype)
|
||||
{
|
||||
EulerObject *self= (EulerObject *)newEulerObject(NULL, order, Py_NEW, NULL);
|
||||
EulerObject *self= (EulerObject *)Euler_CreatePyObject(NULL, order, Py_NEW, NULL);
|
||||
if (self) {
|
||||
Py_INCREF(cb_user);
|
||||
self->cb_user= cb_user;
|
||||
|
@ -50,8 +50,8 @@ be stored in py_data) or be a wrapper for data allocated through
|
||||
blender (stored in blend_data). This is an either/or struct not both*/
|
||||
|
||||
//prototypes
|
||||
PyObject *newEulerObject( float *eul, short order, int type, PyTypeObject *base_type);
|
||||
PyObject *newEulerObject_cb(PyObject *cb_user, short order, int cb_type, int cb_subtype);
|
||||
PyObject *Euler_CreatePyObject( float *eul, short order, int type, PyTypeObject *base_type);
|
||||
PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, short order, int cb_type, int cb_subtype);
|
||||
|
||||
short euler_order_from_string(const char *str, const char *error_prefix);
|
||||
|
||||
|
@ -125,7 +125,7 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||
|
||||
switch(PyTuple_GET_SIZE(args)) {
|
||||
case 0:
|
||||
return (PyObject *) newMatrixObject(NULL, 4, 4, Py_NEW, type);
|
||||
return (PyObject *) Matrix_CreatePyObject(NULL, 4, 4, Py_NEW, type);
|
||||
case 1:
|
||||
{
|
||||
PyObject *arg= PyTuple_GET_ITEM(args, 0);
|
||||
@ -140,7 +140,7 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||
|
||||
if (col_size >= 2 && col_size <= 4) {
|
||||
/* sane row & col size, new matrix and assign as slice */
|
||||
PyObject *matrix= newMatrixObject(NULL, row_size, col_size, Py_NEW, type);
|
||||
PyObject *matrix= Matrix_CreatePyObject(NULL, row_size, col_size, Py_NEW, type);
|
||||
if (Matrix_ass_slice((MatrixObject *)matrix, 0, INT_MAX, arg) == 0) {
|
||||
return matrix;
|
||||
}
|
||||
@ -284,7 +284,7 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args)
|
||||
matrix_3x3_as_4x4(mat);
|
||||
}
|
||||
//pass to matrix creation
|
||||
return newMatrixObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls);
|
||||
return Matrix_CreatePyObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls);
|
||||
}
|
||||
|
||||
|
||||
@ -308,7 +308,7 @@ static PyObject *C_Matrix_Translation(PyObject *cls, PyObject *value)
|
||||
/* create a identity matrix and add translation */
|
||||
unit_m4((float(*)[4]) mat);
|
||||
copy_v3_v3(mat + 12, tvec); /* 12, 13, 14 */
|
||||
return newMatrixObject(mat, 4, 4, Py_NEW, (PyTypeObject *)cls);
|
||||
return Matrix_CreatePyObject(mat, 4, 4, Py_NEW, (PyTypeObject *)cls);
|
||||
}
|
||||
//----------------------------------mathutils.Matrix.Scale() -------------
|
||||
//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc.
|
||||
@ -395,7 +395,7 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args)
|
||||
matrix_3x3_as_4x4(mat);
|
||||
}
|
||||
//pass to matrix creation
|
||||
return newMatrixObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls);
|
||||
return Matrix_CreatePyObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls);
|
||||
}
|
||||
//----------------------------------mathutils.Matrix.OrthoProjection() ---
|
||||
//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc.
|
||||
@ -512,7 +512,7 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
|
||||
matrix_3x3_as_4x4(mat);
|
||||
}
|
||||
//pass to matrix creation
|
||||
return newMatrixObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls);
|
||||
return Matrix_CreatePyObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(C_Matrix_Shear_doc,
|
||||
@ -613,7 +613,7 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args)
|
||||
matrix_3x3_as_4x4(mat);
|
||||
}
|
||||
//pass to matrix creation
|
||||
return newMatrixObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls);
|
||||
return Matrix_CreatePyObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls);
|
||||
}
|
||||
|
||||
void matrix_as_3x3(float mat[3][3], MatrixObject *self)
|
||||
@ -673,7 +673,7 @@ static PyObject *Matrix_to_quaternion(MatrixObject *self)
|
||||
mat4_to_quat(quat, (float (*)[4])self->contigPtr);
|
||||
}
|
||||
|
||||
return newQuaternionObject(quat, Py_NEW, NULL);
|
||||
return Quaternion_CreatePyObject(quat, Py_NEW, NULL);
|
||||
}
|
||||
|
||||
/*---------------------------matrix.toEuler() --------------------*/
|
||||
@ -747,7 +747,7 @@ static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args)
|
||||
else mat3_to_eulO(eul, order, mat);
|
||||
}
|
||||
|
||||
return newEulerObject(eul, order, Py_NEW, NULL);
|
||||
return Euler_CreatePyObject(eul, order, Py_NEW, NULL);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Matrix_resize_4x4_doc,
|
||||
@ -827,12 +827,12 @@ static PyObject *Matrix_to_4x4(MatrixObject *self)
|
||||
return NULL;
|
||||
|
||||
if (self->col_size==4 && self->row_size==4) {
|
||||
return (PyObject *)newMatrixObject(self->contigPtr, 4, 4, Py_NEW, Py_TYPE(self));
|
||||
return (PyObject *)Matrix_CreatePyObject(self->contigPtr, 4, 4, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
else if (self->col_size==3 && self->row_size==3) {
|
||||
float mat[4][4];
|
||||
copy_m4_m3(mat, (float (*)[3])self->contigPtr);
|
||||
return (PyObject *)newMatrixObject((float *)mat, 4, 4, Py_NEW, Py_TYPE(self));
|
||||
return (PyObject *)Matrix_CreatePyObject((float *)mat, 4, 4, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
/* TODO, 2x2 matrix */
|
||||
|
||||
@ -865,7 +865,7 @@ static PyObject *Matrix_to_3x3(MatrixObject *self)
|
||||
|
||||
matrix_as_3x3(mat, self);
|
||||
|
||||
return newMatrixObject((float *)mat, 3, 3, Py_NEW, Py_TYPE(self));
|
||||
return Matrix_CreatePyObject((float *)mat, 3, 3, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Matrix_to_translation_doc,
|
||||
@ -888,7 +888,7 @@ static PyObject *Matrix_to_translation(MatrixObject *self)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return newVectorObject(self->matrix[3], 3, Py_NEW, NULL);
|
||||
return Vector_CreatePyObject(self->matrix[3], 3, Py_NEW, NULL);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Matrix_to_scale_doc,
|
||||
@ -923,7 +923,7 @@ static PyObject *Matrix_to_scale(MatrixObject *self)
|
||||
/* compatible mat4_to_loc_rot_size */
|
||||
mat3_to_rot_size(rot, size, mat);
|
||||
|
||||
return newVectorObject(size, 3, Py_NEW, NULL);
|
||||
return Vector_CreatePyObject(size, 3, Py_NEW, NULL);
|
||||
}
|
||||
|
||||
/*---------------------------matrix.invert() ---------------------*/
|
||||
@ -1080,9 +1080,9 @@ static PyObject *Matrix_decompose(MatrixObject *self)
|
||||
mat3_to_quat(quat, rot);
|
||||
|
||||
ret= PyTuple_New(3);
|
||||
PyTuple_SET_ITEM(ret, 0, newVectorObject(loc, 3, Py_NEW, NULL));
|
||||
PyTuple_SET_ITEM(ret, 1, newQuaternionObject(quat, Py_NEW, NULL));
|
||||
PyTuple_SET_ITEM(ret, 2, newVectorObject(size, 3, Py_NEW, NULL));
|
||||
PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(loc, 3, Py_NEW, NULL));
|
||||
PyTuple_SET_ITEM(ret, 1, Quaternion_CreatePyObject(quat, Py_NEW, NULL));
|
||||
PyTuple_SET_ITEM(ret, 2, Vector_CreatePyObject(size, 3, Py_NEW, NULL));
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -1133,7 +1133,7 @@ static PyObject *Matrix_lerp(MatrixObject *self, PyObject *args)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (PyObject*)newMatrixObject(mat, self->row_size, self->col_size, Py_NEW, Py_TYPE(self));
|
||||
return (PyObject*)Matrix_CreatePyObject(mat, self->row_size, self->col_size, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
/*---------------------------matrix.determinant() ----------------*/
|
||||
@ -1223,7 +1223,7 @@ PyDoc_STRVAR(Matrix_zero_doc,
|
||||
);
|
||||
static PyObject *Matrix_zero(MatrixObject *self)
|
||||
{
|
||||
fill_vn(self->contigPtr, self->row_size * self->col_size, 0.0f);
|
||||
fill_vn_fl(self->contigPtr, self->row_size * self->col_size, 0.0f);
|
||||
|
||||
if (BaseMath_WriteCallback(self) == -1)
|
||||
return NULL;
|
||||
@ -1286,7 +1286,7 @@ static PyObject *Matrix_copy(MatrixObject *self)
|
||||
if (BaseMath_ReadCallback(self) == -1)
|
||||
return NULL;
|
||||
|
||||
return (PyObject*)newMatrixObject((float (*))self->contigPtr, self->row_size, self->col_size, Py_NEW, Py_TYPE(self));
|
||||
return (PyObject*)Matrix_CreatePyObject((float (*))self->contigPtr, self->row_size, self->col_size, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
/*----------------------------print object (internal)-------------*/
|
||||
@ -1383,7 +1383,7 @@ static PyObject *Matrix_item(MatrixObject *self, int i)
|
||||
"array index out of range");
|
||||
return NULL;
|
||||
}
|
||||
return newVectorObject_cb((PyObject *)self, self->col_size, mathutils_matrix_vector_cb_index, i);
|
||||
return Vector_CreatePyObject_cb((PyObject *)self, self->col_size, mathutils_matrix_vector_cb_index, i);
|
||||
}
|
||||
/*----------------------------object[]-------------------------
|
||||
sequence accessor (set) */
|
||||
@ -1428,7 +1428,7 @@ static PyObject *Matrix_slice(MatrixObject *self, int begin, int end)
|
||||
tuple= PyTuple_New(end - begin);
|
||||
for (count= begin; count < end; count++) {
|
||||
PyTuple_SET_ITEM(tuple, count - begin,
|
||||
newVectorObject_cb((PyObject *)self, self->col_size, mathutils_matrix_vector_cb_index, count));
|
||||
Vector_CreatePyObject_cb((PyObject *)self, self->col_size, mathutils_matrix_vector_cb_index, count));
|
||||
|
||||
}
|
||||
|
||||
@ -1514,7 +1514,7 @@ static PyObject *Matrix_add(PyObject *m1, PyObject *m2)
|
||||
|
||||
add_vn_vnvn(mat, mat1->contigPtr, mat2->contigPtr, mat1->row_size * mat1->col_size);
|
||||
|
||||
return newMatrixObject(mat, mat1->row_size, mat1->col_size, Py_NEW, Py_TYPE(mat1));
|
||||
return Matrix_CreatePyObject(mat, mat1->row_size, mat1->col_size, Py_NEW, Py_TYPE(mat1));
|
||||
}
|
||||
/*------------------------obj - obj------------------------------
|
||||
subtraction*/
|
||||
@ -1547,7 +1547,7 @@ static PyObject *Matrix_sub(PyObject *m1, PyObject *m2)
|
||||
|
||||
sub_vn_vnvn(mat, mat1->contigPtr, mat2->contigPtr, mat1->row_size * mat1->col_size);
|
||||
|
||||
return newMatrixObject(mat, mat1->row_size, mat1->col_size, Py_NEW, Py_TYPE(mat1));
|
||||
return Matrix_CreatePyObject(mat, mat1->row_size, mat1->col_size, Py_NEW, Py_TYPE(mat1));
|
||||
}
|
||||
/*------------------------obj * obj------------------------------
|
||||
mulplication*/
|
||||
@ -1555,7 +1555,7 @@ static PyObject *matrix_mul_float(MatrixObject *mat, const float scalar)
|
||||
{
|
||||
float tmat[16];
|
||||
mul_vn_vn_fl(tmat, mat->contigPtr, mat->row_size * mat->col_size, scalar);
|
||||
return newMatrixObject(tmat, mat->row_size, mat->col_size, Py_NEW, Py_TYPE(mat));
|
||||
return Matrix_CreatePyObject(tmat, mat->row_size, mat->col_size, Py_NEW, Py_TYPE(mat));
|
||||
}
|
||||
|
||||
static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
|
||||
@ -1594,7 +1594,7 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
|
||||
}
|
||||
}
|
||||
|
||||
return newMatrixObject(mat, mat2->row_size, mat1->col_size, Py_NEW, Py_TYPE(mat1));
|
||||
return Matrix_CreatePyObject(mat, mat2->row_size, mat1->col_size, Py_NEW, Py_TYPE(mat1));
|
||||
}
|
||||
else if (mat2) {
|
||||
/*FLOAT/INT * MATRIX */
|
||||
@ -1613,7 +1613,7 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return newVectorObject(tvec, vec2->size, Py_NEW, Py_TYPE(m2));
|
||||
return Vector_CreatePyObject(tvec, vec2->size, Py_NEW, Py_TYPE(m2));
|
||||
}
|
||||
/*FLOAT/INT * MATRIX */
|
||||
else if (((scalar= PyFloat_AsDouble(m2)) == -1.0f && PyErr_Occurred())==0) {
|
||||
@ -1940,7 +1940,7 @@ PyTypeObject matrix_Type = {
|
||||
NULL /*tp_del*/
|
||||
};
|
||||
|
||||
/*------------------------newMatrixObject (internal)-------------
|
||||
/*------------------------Matrix_CreatePyObject (internal)-------------
|
||||
creates a new matrix object
|
||||
self->matrix self->contiguous_ptr (reference to data.xxx)
|
||||
[0]------------->[0]
|
||||
@ -1956,7 +1956,7 @@ self->matrix[1][1] = self->contigPtr[4] */
|
||||
(i.e. it was allocated elsewhere by MEM_mallocN())
|
||||
pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
|
||||
(i.e. it must be created here with PyMEM_malloc())*/
|
||||
PyObject *newMatrixObject(float *mat, const unsigned short rowSize, const unsigned short colSize, int type, PyTypeObject *base_type)
|
||||
PyObject *Matrix_CreatePyObject(float *mat, const unsigned short rowSize, const unsigned short colSize, int type, PyTypeObject *base_type)
|
||||
{
|
||||
MatrixObject *self;
|
||||
int x, row, col;
|
||||
@ -2022,9 +2022,9 @@ PyObject *newMatrixObject(float *mat, const unsigned short rowSize, const unsign
|
||||
return (PyObject *) self;
|
||||
}
|
||||
|
||||
PyObject *newMatrixObject_cb(PyObject *cb_user, int rowSize, int colSize, int cb_type, int cb_subtype)
|
||||
PyObject *Matrix_CreatePyObject_cb(PyObject *cb_user, int rowSize, int colSize, int cb_type, int cb_subtype)
|
||||
{
|
||||
MatrixObject *self= (MatrixObject *)newMatrixObject(NULL, rowSize, colSize, Py_NEW, NULL);
|
||||
MatrixObject *self= (MatrixObject *)Matrix_CreatePyObject(NULL, rowSize, colSize, Py_NEW, NULL);
|
||||
if (self) {
|
||||
Py_INCREF(cb_user);
|
||||
self->cb_user= cb_user;
|
||||
|
@ -51,8 +51,8 @@ be stored in py_data) or be a wrapper for data allocated through
|
||||
blender (stored in blend_data). This is an either/or struct not both*/
|
||||
|
||||
/*prototypes*/
|
||||
PyObject *newMatrixObject(float *mat, const unsigned short row_size, const unsigned short col_size, int type, PyTypeObject *base_type);
|
||||
PyObject *newMatrixObject_cb(PyObject *user, int row_size, int col_size, int cb_type, int cb_subtype);
|
||||
PyObject *Matrix_CreatePyObject(float *mat, const unsigned short row_size, const unsigned short col_size, int type, PyTypeObject *base_type);
|
||||
PyObject *Matrix_CreatePyObject_cb(PyObject *user, int row_size, int col_size, int cb_type, int cb_subtype);
|
||||
|
||||
extern int mathutils_matrix_vector_cb_index;
|
||||
extern struct Mathutils_Callback mathutils_matrix_vector_cb;
|
||||
|
@ -120,7 +120,7 @@ static PyObject *Quaternion_to_euler(QuaternionObject *self, PyObject *args)
|
||||
else quat_to_eulO(eul, order, tquat);
|
||||
}
|
||||
|
||||
return newEulerObject(eul, order, Py_NEW, NULL);
|
||||
return Euler_CreatePyObject(eul, order, Py_NEW, NULL);
|
||||
}
|
||||
//----------------------------Quaternion.toMatrix()------------------
|
||||
PyDoc_STRVAR(Quaternion_to_matrix_doc,
|
||||
@ -139,7 +139,7 @@ static PyObject *Quaternion_to_matrix(QuaternionObject *self)
|
||||
return NULL;
|
||||
|
||||
quat_to_mat3((float (*)[3])mat, self->quat);
|
||||
return newMatrixObject(mat, 3, 3, Py_NEW, NULL);
|
||||
return Matrix_CreatePyObject(mat, 3, 3, Py_NEW, NULL);
|
||||
}
|
||||
|
||||
//----------------------------Quaternion.toMatrix()------------------
|
||||
@ -169,7 +169,7 @@ static PyObject *Quaternion_to_axis_angle(QuaternionObject *self)
|
||||
quat__axis_angle_sanitize(axis, &angle);
|
||||
|
||||
ret= PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(ret, 0, newVectorObject(axis, 3, Py_NEW, NULL));
|
||||
PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(axis, 3, Py_NEW, NULL));
|
||||
PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(angle));
|
||||
return ret;
|
||||
}
|
||||
@ -197,7 +197,7 @@ static PyObject *Quaternion_cross(QuaternionObject *self, PyObject *value)
|
||||
return NULL;
|
||||
|
||||
mul_qt_qtqt(quat, self->quat, tquat);
|
||||
return newQuaternionObject(quat, Py_NEW, Py_TYPE(self));
|
||||
return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
//----------------------------Quaternion.dot(other)------------------
|
||||
@ -246,7 +246,7 @@ static PyObject *Quaternion_rotation_difference(QuaternionObject *self, PyObject
|
||||
|
||||
rotation_between_quats_to_quat(quat, self->quat, tquat);
|
||||
|
||||
return newQuaternionObject(quat, Py_NEW, Py_TYPE(self));
|
||||
return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Quaternion_slerp_doc,
|
||||
@ -288,7 +288,7 @@ static PyObject *Quaternion_slerp(QuaternionObject *self, PyObject *args)
|
||||
|
||||
interp_qt_qtqt(quat, self->quat, tquat, fac);
|
||||
|
||||
return newQuaternionObject(quat, Py_NEW, Py_TYPE(self));
|
||||
return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Quaternion_rotate_doc,
|
||||
@ -464,7 +464,7 @@ static PyObject *Quaternion_copy(QuaternionObject *self)
|
||||
if (BaseMath_ReadCallback(self) == -1)
|
||||
return NULL;
|
||||
|
||||
return newQuaternionObject(self->quat, Py_NEW, Py_TYPE(self));
|
||||
return Quaternion_CreatePyObject(self->quat, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
//----------------------------print object (internal)--------------
|
||||
@ -721,7 +721,7 @@ static PyObject *Quaternion_add(PyObject *q1, PyObject *q2)
|
||||
return NULL;
|
||||
|
||||
add_qt_qtqt(quat, quat1->quat, quat2->quat, 1.0f);
|
||||
return newQuaternionObject(quat, Py_NEW, Py_TYPE(q1));
|
||||
return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(q1));
|
||||
}
|
||||
//------------------------obj - obj------------------------------
|
||||
//subtraction
|
||||
@ -749,7 +749,7 @@ static PyObject *Quaternion_sub(PyObject *q1, PyObject *q2)
|
||||
quat[x] = quat1->quat[x] - quat2->quat[x];
|
||||
}
|
||||
|
||||
return newQuaternionObject(quat, Py_NEW, Py_TYPE(q1));
|
||||
return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(q1));
|
||||
}
|
||||
|
||||
static PyObject *quat_mul_float(QuaternionObject *quat, const float scalar)
|
||||
@ -757,7 +757,7 @@ static PyObject *quat_mul_float(QuaternionObject *quat, const float scalar)
|
||||
float tquat[4];
|
||||
copy_qt_qt(tquat, quat->quat);
|
||||
mul_qt_fl(tquat, scalar);
|
||||
return newQuaternionObject(tquat, Py_NEW, Py_TYPE(quat));
|
||||
return Quaternion_CreatePyObject(tquat, Py_NEW, Py_TYPE(quat));
|
||||
}
|
||||
|
||||
//------------------------obj * obj------------------------------
|
||||
@ -780,7 +780,7 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2)
|
||||
|
||||
if (quat1 && quat2) { /* QUAT*QUAT (cross product) */
|
||||
mul_qt_qtqt(quat, quat1->quat, quat2->quat);
|
||||
return newQuaternionObject(quat, Py_NEW, Py_TYPE(q1));
|
||||
return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(q1));
|
||||
}
|
||||
/* the only case this can happen (for a supported type is "FLOAT*QUAT") */
|
||||
else if (quat2) { /* FLOAT*QUAT */
|
||||
@ -808,7 +808,7 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2)
|
||||
copy_v3_v3(tvec, vec2->vec);
|
||||
mul_qt_v3(quat1->quat, tvec);
|
||||
|
||||
return newVectorObject(tvec, 3, Py_NEW, Py_TYPE(vec2));
|
||||
return Vector_CreatePyObject(tvec, 3, Py_NEW, Py_TYPE(vec2));
|
||||
}
|
||||
/* QUAT * FLOAT */
|
||||
else if ((((scalar= PyFloat_AsDouble(q2)) == -1.0f && PyErr_Occurred())==0)) {
|
||||
@ -836,7 +836,7 @@ static PyObject *Quaternion_neg(QuaternionObject *self)
|
||||
return NULL;
|
||||
|
||||
negate_v4_v4(tquat, self->quat);
|
||||
return newQuaternionObject(tquat, Py_NEW, Py_TYPE(self));
|
||||
return Quaternion_CreatePyObject(tquat, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
|
||||
@ -982,7 +982,7 @@ static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *UNUSED(clos
|
||||
|
||||
quat__axis_angle_sanitize(axis, NULL);
|
||||
|
||||
return (PyObject *) newVectorObject(axis, 3, Py_NEW, NULL);
|
||||
return (PyObject *) Vector_CreatePyObject(axis, 3, Py_NEW, NULL);
|
||||
}
|
||||
|
||||
static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void *UNUSED(closure))
|
||||
@ -1045,7 +1045,7 @@ static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kw
|
||||
break;
|
||||
/* PyArg_ParseTuple assures no more then 2 */
|
||||
}
|
||||
return newQuaternionObject(quat, Py_NEW, type);
|
||||
return Quaternion_CreatePyObject(quat, Py_NEW, type);
|
||||
}
|
||||
|
||||
static PyObject *quat__apply_to_copy(PyNoArgsFunction quat_func, QuaternionObject *self)
|
||||
@ -1190,13 +1190,13 @@ PyTypeObject quaternion_Type = {
|
||||
NULL, //tp_weaklist
|
||||
NULL, //tp_del
|
||||
};
|
||||
//------------------------newQuaternionObject (internal)-------------
|
||||
//------------------------Quaternion_CreatePyObject (internal)-------------
|
||||
//creates a new quaternion object
|
||||
/*pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
|
||||
(i.e. it was allocated elsewhere by MEM_mallocN())
|
||||
pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
|
||||
(i.e. it must be created here with PyMEM_malloc())*/
|
||||
PyObject *newQuaternionObject(float *quat, int type, PyTypeObject *base_type)
|
||||
PyObject *Quaternion_CreatePyObject(float *quat, int type, PyTypeObject *base_type)
|
||||
{
|
||||
QuaternionObject *self;
|
||||
|
||||
@ -1229,9 +1229,9 @@ PyObject *newQuaternionObject(float *quat, int type, PyTypeObject *base_type)
|
||||
return (PyObject *) self;
|
||||
}
|
||||
|
||||
PyObject *newQuaternionObject_cb(PyObject *cb_user, int cb_type, int cb_subtype)
|
||||
PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype)
|
||||
{
|
||||
QuaternionObject *self= (QuaternionObject *)newQuaternionObject(NULL, Py_NEW, NULL);
|
||||
QuaternionObject *self= (QuaternionObject *)Quaternion_CreatePyObject(NULL, Py_NEW, NULL);
|
||||
if (self) {
|
||||
Py_INCREF(cb_user);
|
||||
self->cb_user= cb_user;
|
||||
|
@ -48,7 +48,7 @@ be stored in py_data) or be a wrapper for data allocated through
|
||||
blender (stored in blend_data). This is an either/or struct not both*/
|
||||
|
||||
//prototypes
|
||||
PyObject *newQuaternionObject( float *quat, int type, PyTypeObject *base_type);
|
||||
PyObject *newQuaternionObject_cb(PyObject *cb_user, int cb_type, int cb_subtype);
|
||||
PyObject *Quaternion_CreatePyObject( float *quat, int type, PyTypeObject *base_type);
|
||||
PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype);
|
||||
|
||||
#endif /* MATHUTILS_QUAT_H */
|
||||
|
@ -70,7 +70,7 @@ static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED
|
||||
"more then a single arg given");
|
||||
return NULL;
|
||||
}
|
||||
return newVectorObject(vec, size, Py_NEW, type);
|
||||
return Vector_CreatePyObject(vec, size, Py_NEW, type);
|
||||
}
|
||||
|
||||
static PyObject *vec__apply_to_copy(PyNoArgsFunction vec_func, VectorObject *self)
|
||||
@ -95,7 +95,7 @@ PyDoc_STRVAR(Vector_zero_doc,
|
||||
);
|
||||
static PyObject *Vector_zero(VectorObject *self)
|
||||
{
|
||||
fill_vn(self->vec, self->size, 0.0f);
|
||||
fill_vn_fl(self->vec, self->size, 0.0f);
|
||||
|
||||
if (BaseMath_WriteCallback(self) == -1)
|
||||
return NULL;
|
||||
@ -116,19 +116,10 @@ PyDoc_STRVAR(Vector_normalize_doc,
|
||||
);
|
||||
static PyObject *Vector_normalize(VectorObject *self)
|
||||
{
|
||||
int i;
|
||||
float norm = 0.0f;
|
||||
|
||||
if (BaseMath_ReadCallback(self) == -1)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < self->size; i++) {
|
||||
norm += self->vec[i] * self->vec[i];
|
||||
}
|
||||
norm = (float) sqrt(norm);
|
||||
for (i = 0; i < self->size; i++) {
|
||||
self->vec[i] /= norm;
|
||||
}
|
||||
normalize_vn(self->vec, self->size);
|
||||
|
||||
(void)BaseMath_WriteCallback(self);
|
||||
Py_RETURN_NONE;
|
||||
@ -273,7 +264,7 @@ static PyObject *Vector_to_2d(VectorObject *self)
|
||||
if (BaseMath_ReadCallback(self) == -1)
|
||||
return NULL;
|
||||
|
||||
return newVectorObject(self->vec, 2, Py_NEW, Py_TYPE(self));
|
||||
return Vector_CreatePyObject(self->vec, 2, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
PyDoc_STRVAR(Vector_to_3d_doc,
|
||||
".. method:: to_3d()\n"
|
||||
@ -291,7 +282,7 @@ static PyObject *Vector_to_3d(VectorObject *self)
|
||||
return NULL;
|
||||
|
||||
memcpy(tvec, self->vec, sizeof(float) * MIN2(self->size, 3));
|
||||
return newVectorObject(tvec, 3, Py_NEW, Py_TYPE(self));
|
||||
return Vector_CreatePyObject(tvec, 3, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
PyDoc_STRVAR(Vector_to_4d_doc,
|
||||
".. method:: to_4d()\n"
|
||||
@ -309,7 +300,7 @@ static PyObject *Vector_to_4d(VectorObject *self)
|
||||
return NULL;
|
||||
|
||||
memcpy(tvec, self->vec, sizeof(float) * MIN2(self->size, 4));
|
||||
return newVectorObject(tvec, 4, Py_NEW, Py_TYPE(self));
|
||||
return Vector_CreatePyObject(tvec, 4, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Vector_to_tuple_doc,
|
||||
@ -484,7 +475,7 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args)
|
||||
|
||||
vec_to_quat(quat, vec, track, up);
|
||||
|
||||
return newQuaternionObject(quat, Py_NEW, NULL);
|
||||
return Quaternion_CreatePyObject(quat, Py_NEW, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -527,7 +518,7 @@ static PyObject *Vector_reflect(VectorObject *self, PyObject *value)
|
||||
normalize_v3(mirror);
|
||||
reflect_v3_v3v3(reflect, vec, mirror);
|
||||
|
||||
return newVectorObject(reflect, self->size, Py_NEW, Py_TYPE(self));
|
||||
return Vector_CreatePyObject(reflect, self->size, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Vector_cross_doc,
|
||||
@ -553,7 +544,7 @@ static PyObject *Vector_cross(VectorObject *self, PyObject *value)
|
||||
if (mathutils_array_parse(tvec, self->size, self->size, value, "Vector.cross(other), invalid 'other' arg") == -1)
|
||||
return NULL;
|
||||
|
||||
ret= (VectorObject *)newVectorObject(NULL, 3, Py_NEW, Py_TYPE(self));
|
||||
ret= (VectorObject *)Vector_CreatePyObject(NULL, 3, Py_NEW, Py_TYPE(self));
|
||||
cross_v3_v3v3(ret->vec, self->vec, tvec);
|
||||
return (PyObject *)ret;
|
||||
}
|
||||
@ -571,8 +562,6 @@ PyDoc_STRVAR(Vector_dot_doc,
|
||||
static PyObject *Vector_dot(VectorObject *self, PyObject *value)
|
||||
{
|
||||
float tvec[MAX_DIMENSIONS];
|
||||
double dot = 0.0;
|
||||
int x;
|
||||
|
||||
if (BaseMath_ReadCallback(self) == -1)
|
||||
return NULL;
|
||||
@ -580,11 +569,7 @@ static PyObject *Vector_dot(VectorObject *self, PyObject *value)
|
||||
if (mathutils_array_parse(tvec, self->size, self->size, value, "Vector.dot(other), invalid 'other' arg") == -1)
|
||||
return NULL;
|
||||
|
||||
for (x = 0; x < self->size; x++) {
|
||||
dot += (double)(self->vec[x] * tvec[x]);
|
||||
}
|
||||
|
||||
return PyFloat_FromDouble(dot);
|
||||
return PyFloat_FromDouble(dot_vn_vn(self->vec, tvec, self->size));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Vector_angle_doc,
|
||||
@ -682,7 +667,7 @@ static PyObject *Vector_rotation_difference(VectorObject *self, PyObject *value)
|
||||
|
||||
rotation_between_vecs_to_quat(quat, vec_a, vec_b);
|
||||
|
||||
return newQuaternionObject(quat, Py_NEW, NULL);
|
||||
return Quaternion_CreatePyObject(quat, Py_NEW, NULL);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Vector_project_doc,
|
||||
@ -722,7 +707,7 @@ static PyObject *Vector_project(VectorObject *self, PyObject *value)
|
||||
for (x = 0; x < size; x++) {
|
||||
vec[x] = (float)dot * tvec[x];
|
||||
}
|
||||
return newVectorObject(vec, size, Py_NEW, Py_TYPE(self));
|
||||
return Vector_CreatePyObject(vec, size, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Vector_lerp_doc,
|
||||
@ -759,7 +744,7 @@ static PyObject *Vector_lerp(VectorObject *self, PyObject *args)
|
||||
for (x = 0; x < size; x++) {
|
||||
vec[x] = (ifac * self->vec[x]) + (fac * tvec[x]);
|
||||
}
|
||||
return newVectorObject(vec, size, Py_NEW, Py_TYPE(self));
|
||||
return Vector_CreatePyObject(vec, size, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Vector_rotate_doc,
|
||||
@ -808,7 +793,7 @@ static PyObject *Vector_copy(VectorObject *self)
|
||||
if (BaseMath_ReadCallback(self) == -1)
|
||||
return NULL;
|
||||
|
||||
return newVectorObject(self->vec, self->size, Py_NEW, Py_TYPE(self));
|
||||
return Vector_CreatePyObject(self->vec, self->size, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
static PyObject *Vector_repr(VectorObject *self)
|
||||
@ -975,7 +960,7 @@ static PyObject *Vector_add(PyObject *v1, PyObject *v2)
|
||||
|
||||
add_vn_vnvn(vec, vec1->vec, vec2->vec, vec1->size);
|
||||
|
||||
return newVectorObject(vec, vec1->size, Py_NEW, Py_TYPE(v1));
|
||||
return Vector_CreatePyObject(vec, vec1->size, Py_NEW, Py_TYPE(v1));
|
||||
}
|
||||
|
||||
/* addition in-place: obj += obj */
|
||||
@ -1038,7 +1023,7 @@ static PyObject *Vector_sub(PyObject *v1, PyObject *v2)
|
||||
|
||||
sub_vn_vnvn(vec, vec1->vec, vec2->vec, vec1->size);
|
||||
|
||||
return newVectorObject(vec, vec1->size, Py_NEW, Py_TYPE(v1));
|
||||
return Vector_CreatePyObject(vec, vec1->size, Py_NEW, Py_TYPE(v1));
|
||||
}
|
||||
|
||||
/* subtraction in-place: obj -= obj */
|
||||
@ -1123,7 +1108,7 @@ static PyObject *vector_mul_float(VectorObject *vec, const float scalar)
|
||||
{
|
||||
float tvec[MAX_DIMENSIONS];
|
||||
mul_vn_vn_fl(tvec, vec->vec, vec->size, scalar);
|
||||
return newVectorObject(tvec, vec->size, Py_NEW, Py_TYPE(vec));
|
||||
return Vector_CreatePyObject(tvec, vec->size, Py_NEW, Py_TYPE(vec));
|
||||
}
|
||||
|
||||
static PyObject *Vector_mul(PyObject *v1, PyObject *v2)
|
||||
@ -1145,9 +1130,6 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2)
|
||||
|
||||
/* make sure v1 is always the vector */
|
||||
if (vec1 && vec2) {
|
||||
int i;
|
||||
double dot = 0.0f;
|
||||
|
||||
if (vec1->size != vec2->size) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"Vector multiplication: "
|
||||
@ -1156,10 +1138,7 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2)
|
||||
}
|
||||
|
||||
/*dot product*/
|
||||
for (i = 0; i < vec1->size; i++) {
|
||||
dot += (double)(vec1->vec[i] * vec2->vec[i]);
|
||||
}
|
||||
return PyFloat_FromDouble(dot);
|
||||
return PyFloat_FromDouble(dot_vn_vn(vec1->vec, vec2->vec, vec1->size));
|
||||
}
|
||||
else if (vec1) {
|
||||
if (MatrixObject_Check(v2)) {
|
||||
@ -1172,7 +1151,7 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return newVectorObject(tvec, vec1->size, Py_NEW, Py_TYPE(vec1));
|
||||
return Vector_CreatePyObject(tvec, vec1->size, Py_NEW, Py_TYPE(vec1));
|
||||
}
|
||||
else if (QuaternionObject_Check(v2)) {
|
||||
/* VEC * QUAT */
|
||||
@ -1198,7 +1177,7 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2)
|
||||
|
||||
copy_v3_v3(tvec, vec1->vec);
|
||||
mul_qt_v3(quat2->quat, tvec);
|
||||
return newVectorObject(tvec, 3, Py_NEW, Py_TYPE(vec1));
|
||||
return Vector_CreatePyObject(tvec, 3, Py_NEW, Py_TYPE(vec1));
|
||||
#endif
|
||||
/* ------ to be removed ------*/
|
||||
}
|
||||
@ -1332,7 +1311,7 @@ static PyObject *Vector_div(PyObject *v1, PyObject *v2)
|
||||
for (i = 0; i < vec1->size; i++) {
|
||||
vec[i] = vec1->vec[i] / scalar;
|
||||
}
|
||||
return newVectorObject(vec, vec1->size, Py_NEW, Py_TYPE(v1));
|
||||
return Vector_CreatePyObject(vec, vec1->size, Py_NEW, Py_TYPE(v1));
|
||||
}
|
||||
|
||||
/* divide in-place: obj /= obj */
|
||||
@ -1378,7 +1357,7 @@ static PyObject *Vector_neg(VectorObject *self)
|
||||
return NULL;
|
||||
|
||||
negate_vn_vn(tvec, self->vec, self->size);
|
||||
return newVectorObject(tvec, self->size, Py_NEW, Py_TYPE(self));
|
||||
return Vector_CreatePyObject(tvec, self->size, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
/*------------------------vec_magnitude_nosqrt (internal) - for comparing only */
|
||||
@ -1644,7 +1623,6 @@ static PyObject *Vector_getLength(VectorObject *self, void *UNUSED(closure))
|
||||
static int Vector_setLength(VectorObject *self, PyObject *value)
|
||||
{
|
||||
double dot = 0.0f, param;
|
||||
int i;
|
||||
|
||||
if (BaseMath_ReadCallback(self) == -1)
|
||||
return -1;
|
||||
@ -1661,13 +1639,11 @@ static int Vector_setLength(VectorObject *self, PyObject *value)
|
||||
return -1;
|
||||
}
|
||||
if (param == 0.0) {
|
||||
fill_vn(self->vec, self->size, 0.0f);
|
||||
fill_vn_fl(self->vec, self->size, 0.0f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < self->size; i++) {
|
||||
dot += (double)(self->vec[i] * self->vec[i]);
|
||||
}
|
||||
dot= dot_vn_vn(self->vec, self->vec, self->size);
|
||||
|
||||
if (!dot) /* cant sqrt zero */
|
||||
return 0;
|
||||
@ -1679,9 +1655,7 @@ static int Vector_setLength(VectorObject *self, PyObject *value)
|
||||
|
||||
dot= dot/param;
|
||||
|
||||
for (i = 0; i < self->size; i++) {
|
||||
self->vec[i]= self->vec[i] / (float)dot;
|
||||
}
|
||||
mul_vn_fl(self->vec, self->size, 1.0/dot);
|
||||
|
||||
(void)BaseMath_WriteCallback(self); /* checked already */
|
||||
|
||||
@ -1691,16 +1665,10 @@ static int Vector_setLength(VectorObject *self, PyObject *value)
|
||||
/* vector.length_squared */
|
||||
static PyObject *Vector_getLengthSquared(VectorObject *self, void *UNUSED(closure))
|
||||
{
|
||||
double dot = 0.0f;
|
||||
int i;
|
||||
|
||||
if (BaseMath_ReadCallback(self) == -1)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < self->size; i++) {
|
||||
dot += (double)(self->vec[i] * self->vec[i]);
|
||||
}
|
||||
return PyFloat_FromDouble(dot);
|
||||
return PyFloat_FromDouble(dot_vn_vn(self->vec, self->vec, self->size));
|
||||
}
|
||||
|
||||
/* Get a new Vector according to the provided swizzle. This function has little
|
||||
@ -1734,7 +1702,7 @@ static PyObject *Vector_getSwizzle(VectorObject *self, void *closure)
|
||||
axis_to++;
|
||||
}
|
||||
|
||||
return newVectorObject(vec, axis_to, Py_NEW, Py_TYPE(self));
|
||||
return Vector_CreatePyObject(vec, axis_to, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
/* Set the items of this vector using a swizzle.
|
||||
@ -2396,13 +2364,13 @@ PyTypeObject vector_Type = {
|
||||
NULL
|
||||
};
|
||||
|
||||
/*------------------------newVectorObject (internal)-------------
|
||||
/*------------------------Vector_CreatePyObject (internal)-------------
|
||||
creates a new vector object
|
||||
pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
|
||||
(i.e. it was allocated elsewhere by MEM_mallocN())
|
||||
pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
|
||||
(i.e. it must be created here with PyMEM_malloc())*/
|
||||
PyObject *newVectorObject(float *vec, const int size, const int type, PyTypeObject *base_type)
|
||||
PyObject *Vector_CreatePyObject(float *vec, const int size, const int type, PyTypeObject *base_type)
|
||||
{
|
||||
VectorObject *self;
|
||||
|
||||
@ -2432,7 +2400,7 @@ PyObject *newVectorObject(float *vec, const int size, const int type, PyTypeObje
|
||||
memcpy(self->vec, vec, size * sizeof(float));
|
||||
}
|
||||
else { /* new empty */
|
||||
fill_vn(self->vec, size, 0.0f);
|
||||
fill_vn_fl(self->vec, size, 0.0f);
|
||||
if (size == 4) { /* do the homogenous thing */
|
||||
self->vec[3] = 1.0f;
|
||||
}
|
||||
@ -2446,10 +2414,10 @@ PyObject *newVectorObject(float *vec, const int size, const int type, PyTypeObje
|
||||
return (PyObject *) self;
|
||||
}
|
||||
|
||||
PyObject *newVectorObject_cb(PyObject *cb_user, int size, int cb_type, int cb_subtype)
|
||||
PyObject *Vector_CreatePyObject_cb(PyObject *cb_user, int size, int cb_type, int cb_subtype)
|
||||
{
|
||||
float dummy[4] = {0.0, 0.0, 0.0, 0.0}; /* dummy init vector, callbacks will be used on access */
|
||||
VectorObject *self= (VectorObject *)newVectorObject(dummy, size, Py_NEW, NULL);
|
||||
VectorObject *self= (VectorObject *)Vector_CreatePyObject(dummy, size, Py_NEW, NULL);
|
||||
if (self) {
|
||||
Py_INCREF(cb_user);
|
||||
self->cb_user= cb_user;
|
||||
|
@ -45,7 +45,7 @@ typedef struct {
|
||||
} VectorObject;
|
||||
|
||||
/*prototypes*/
|
||||
PyObject *newVectorObject(float *vec, const int size, const int type, PyTypeObject *base_type);
|
||||
PyObject *newVectorObject_cb(PyObject *user, int size, int callback_type, int subtype);
|
||||
PyObject *Vector_CreatePyObject(float *vec, const int size, const int type, PyTypeObject *base_type);
|
||||
PyObject *Vector_CreatePyObject_cb(PyObject *user, int size, int callback_type, int subtype);
|
||||
|
||||
#endif /* MATHUTILS_VECTOR_H */
|
||||
|
@ -158,7 +158,7 @@ static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject*
|
||||
mul_v3_fl(dir, t);
|
||||
add_v3_v3v3(pvec, orig, dir);
|
||||
|
||||
return newVectorObject(pvec, 3, Py_NEW, NULL);
|
||||
return Vector_CreatePyObject(pvec, 3, Py_NEW, NULL);
|
||||
}
|
||||
|
||||
/* Line-Line intersection using algorithm from mathworld.wolfram.com */
|
||||
@ -242,8 +242,8 @@ static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject
|
||||
}
|
||||
else {
|
||||
tuple= PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(tuple, 0, newVectorObject(i1, vec1->size, Py_NEW, NULL));
|
||||
PyTuple_SET_ITEM(tuple, 1, newVectorObject(i2, vec1->size, Py_NEW, NULL));
|
||||
PyTuple_SET_ITEM(tuple, 0, Vector_CreatePyObject(i1, vec1->size, Py_NEW, NULL));
|
||||
PyTuple_SET_ITEM(tuple, 1, Vector_CreatePyObject(i2, vec1->size, Py_NEW, NULL));
|
||||
return tuple;
|
||||
}
|
||||
}
|
||||
@ -338,7 +338,7 @@ static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject* args)
|
||||
normal_quad_v3(n, vec1->vec, vec2->vec, vec3->vec, vec4->vec);
|
||||
}
|
||||
|
||||
return newVectorObject(n, 3, Py_NEW, NULL);
|
||||
return Vector_CreatePyObject(n, 3, Py_NEW, NULL);
|
||||
}
|
||||
|
||||
//--------------------------------- AREA FUNCTIONS--------------------
|
||||
@ -433,7 +433,7 @@ static PyObject *M_Geometry_intersect_line_line_2d(PyObject *UNUSED(self), PyObj
|
||||
}
|
||||
|
||||
if (isect_seg_seg_v2_point(line_a1->vec, line_a2->vec, line_b1->vec, line_b2->vec, vi) == 1) {
|
||||
return newVectorObject(vi, 2, Py_NEW, NULL);
|
||||
return Vector_CreatePyObject(vi, 2, Py_NEW, NULL);
|
||||
}
|
||||
else {
|
||||
Py_RETURN_NONE;
|
||||
@ -490,7 +490,7 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec
|
||||
}
|
||||
|
||||
if (isect_line_plane_v3(isect, line_a->vec, line_b->vec, plane_co->vec, plane_no->vec, no_flip) == 1) {
|
||||
return newVectorObject(isect, 3, Py_NEW, NULL);
|
||||
return Vector_CreatePyObject(isect, 3, Py_NEW, NULL);
|
||||
}
|
||||
else {
|
||||
Py_RETURN_NONE;
|
||||
@ -552,8 +552,8 @@ static PyObject *M_Geometry_intersect_plane_plane(PyObject *UNUSED(self), PyObje
|
||||
normalize_v3(isect_no);
|
||||
|
||||
ret= PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(ret, 0, newVectorObject(isect_co, 3, Py_NEW, NULL));
|
||||
PyTuple_SET_ITEM(ret, 1, newVectorObject(isect_no, 3, Py_NEW, NULL));
|
||||
PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(isect_co, 3, Py_NEW, NULL));
|
||||
PyTuple_SET_ITEM(ret, 1, Vector_CreatePyObject(isect_no, 3, Py_NEW, NULL));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -626,10 +626,10 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje
|
||||
use_b= FALSE;
|
||||
}
|
||||
|
||||
if (use_a) { PyTuple_SET_ITEM(ret, 0, newVectorObject(isect_a, 3, Py_NEW, NULL)); }
|
||||
if (use_a) { PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(isect_a, 3, Py_NEW, NULL)); }
|
||||
else { PyTuple_SET_ITEM(ret, 0, Py_None); Py_INCREF(Py_None); }
|
||||
|
||||
if (use_b) { PyTuple_SET_ITEM(ret, 1, newVectorObject(isect_b, 3, Py_NEW, NULL)); }
|
||||
if (use_b) { PyTuple_SET_ITEM(ret, 1, Vector_CreatePyObject(isect_b, 3, Py_NEW, NULL)); }
|
||||
else { PyTuple_SET_ITEM(ret, 1, Py_None); Py_INCREF(Py_None); }
|
||||
|
||||
return ret;
|
||||
@ -699,10 +699,10 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO
|
||||
use_b= FALSE;
|
||||
}
|
||||
|
||||
if (use_a) { PyTuple_SET_ITEM(ret, 0, newVectorObject(isect_a, 2, Py_NEW, NULL)); }
|
||||
if (use_a) { PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(isect_a, 2, Py_NEW, NULL)); }
|
||||
else { PyTuple_SET_ITEM(ret, 0, Py_None); Py_INCREF(Py_None); }
|
||||
|
||||
if (use_b) { PyTuple_SET_ITEM(ret, 1, newVectorObject(isect_b, 2, Py_NEW, NULL)); }
|
||||
if (use_b) { PyTuple_SET_ITEM(ret, 1, Vector_CreatePyObject(isect_b, 2, Py_NEW, NULL)); }
|
||||
else { PyTuple_SET_ITEM(ret, 1, Py_None); Py_INCREF(Py_None); }
|
||||
|
||||
return ret;
|
||||
@ -758,7 +758,7 @@ static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObjec
|
||||
lambda= closest_to_line_v3(pt_out, pt_in, l1, l2);
|
||||
|
||||
ret= PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(ret, 0, newVectorObject(pt_out, 3, Py_NEW, NULL));
|
||||
PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(pt_out, 3, Py_NEW, NULL));
|
||||
PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(lambda));
|
||||
return ret;
|
||||
}
|
||||
@ -939,7 +939,7 @@ static PyObject *M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObje
|
||||
vec_t1_tar->vec, vec_t2_tar->vec, vec_t3_tar->vec,
|
||||
vec_t1_src->vec, vec_t2_src->vec, vec_t3_src->vec);
|
||||
|
||||
return newVectorObject(vec, 3, Py_NEW, NULL);
|
||||
return Vector_CreatePyObject(vec, 3, Py_NEW, NULL);
|
||||
}
|
||||
|
||||
#ifndef MATH_STANDALONE
|
||||
@ -1015,7 +1015,7 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject*
|
||||
list= PyList_New(resolu);
|
||||
fp= coord_array;
|
||||
for (i=0; i<resolu; i++, fp= fp+dims) {
|
||||
PyList_SET_ITEM(list, i, newVectorObject(fp, dims, Py_NEW, NULL));
|
||||
PyList_SET_ITEM(list, i, Vector_CreatePyObject(fp, dims, Py_NEW, NULL));
|
||||
}
|
||||
MEM_freeN(coord_array);
|
||||
return list;
|
||||
|
@ -3684,7 +3684,7 @@ void RE_sample_material_color(Material *mat, float color[3], float *alpha, const
|
||||
int i, layers = CustomData_number_of_layers(&orcoDm->faceData, CD_MTFACE);
|
||||
int layer_index = CustomData_get_layer_index(&orcoDm->faceData, CD_MTFACE);
|
||||
|
||||
/* for every uv layer set coords and name */
|
||||
/* for every uv map set coords and name */
|
||||
for (i=0; i<layers; i++) {
|
||||
if(layer_index >= 0) {
|
||||
float *uv1, *uv2, *uv3;
|
||||
@ -3708,7 +3708,7 @@ void RE_sample_material_color(Material *mat, float color[3], float *alpha, const
|
||||
shi.uv[i].uv[2]= 0.0f; /* texture.c assumes there are 3 coords */
|
||||
}
|
||||
}
|
||||
/* active uv layer */
|
||||
/* active uv map */
|
||||
shi.actuv = CustomData_get_active_layer_index(&orcoDm->faceData,CD_MTFACE) - layer_index;
|
||||
shi.totuv = layers;
|
||||
}
|
||||
|
@ -40,34 +40,6 @@ blender_include_dirs(
|
||||
../blender/windowmanager
|
||||
)
|
||||
|
||||
if(WITH_CODEC_QUICKTIME)
|
||||
add_definitions(-DWITH_QUICKTIME)
|
||||
endif()
|
||||
|
||||
if(WITH_IMAGE_OPENEXR)
|
||||
add_definitions(-DWITH_OPENEXR)
|
||||
endif()
|
||||
|
||||
if(WITH_IMAGE_OPENJPEG)
|
||||
add_definitions(-DWITH_OPENJPEG)
|
||||
endif()
|
||||
|
||||
if(WITH_IMAGE_TIFF)
|
||||
add_definitions(-DWITH_TIFF)
|
||||
endif()
|
||||
|
||||
if(WITH_IMAGE_DDS)
|
||||
add_definitions(-DWITH_DDS)
|
||||
endif()
|
||||
|
||||
if(WITH_IMAGE_CINEON)
|
||||
add_definitions(-DWITH_CINEON)
|
||||
endif()
|
||||
|
||||
if(WITH_IMAGE_HDR)
|
||||
add_definitions(-DWITH_HDR)
|
||||
endif()
|
||||
|
||||
if(WITH_LIBMV)
|
||||
blender_include_dirs(../../extern/libmv)
|
||||
add_definitions(-DWITH_LIBMV)
|
||||
|
@ -79,6 +79,7 @@
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_sound.h"
|
||||
#include "BKE_image.h"
|
||||
|
||||
#include "IMB_imbuf.h" // for IMB_init
|
||||
|
||||
@ -304,7 +305,7 @@ static int print_help(int UNUSED(argc), const char **UNUSED(argv), void *data)
|
||||
printf (" $BLENDER_USER_CONFIG Directory for user configuration files.\n");
|
||||
printf (" $BLENDER_USER_SCRIPTS Directory for user scripts.\n");
|
||||
printf (" $BLENDER_SYSTEM_SCRIPTS Directory for system wide scripts.\n");
|
||||
printf (" $BLENDER_USER_DATAFILES Directory for user data files (icons, translations, ..).\n");
|
||||
printf (" $BLENDER_USER_DAT`AFILES Directory for user data files (icons, translations, ..).\n");
|
||||
printf (" $BLENDER_SYSTEM_DATAFILES Directory for system wide data files.\n");
|
||||
printf (" $BLENDER_SYSTEM_PYTHON Directory for system python libraries.\n");
|
||||
#ifdef WIN32
|
||||
@ -612,47 +613,14 @@ static int set_image_type(int argc, const char **argv, void *data)
|
||||
const char *imtype = argv[1];
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
if (scene) {
|
||||
char imtype_new;
|
||||
const char imtype_new= BKE_imtype_from_arg(imtype);
|
||||
|
||||
if (!strcmp(imtype,"TGA")) imtype_new = R_IMF_IMTYPE_TARGA;
|
||||
else if (!strcmp(imtype,"IRIS")) imtype_new = R_IMF_IMTYPE_IRIS;
|
||||
#ifdef WITH_DDS
|
||||
else if (!strcmp(imtype,"DDS")) imtype_new = R_IMF_IMTYPE_DDS;
|
||||
#endif
|
||||
else if (!strcmp(imtype,"JPEG")) imtype_new = R_IMF_IMTYPE_JPEG90;
|
||||
else if (!strcmp(imtype,"IRIZ")) imtype_new = R_IMF_IMTYPE_IRIZ;
|
||||
else if (!strcmp(imtype,"RAWTGA")) imtype_new = R_IMF_IMTYPE_RAWTGA;
|
||||
else if (!strcmp(imtype,"AVIRAW")) imtype_new = R_IMF_IMTYPE_AVIRAW;
|
||||
else if (!strcmp(imtype,"AVIJPEG")) imtype_new = R_IMF_IMTYPE_AVIJPEG;
|
||||
else if (!strcmp(imtype,"PNG")) imtype_new = R_IMF_IMTYPE_PNG;
|
||||
else if (!strcmp(imtype,"AVICODEC")) imtype_new = R_IMF_IMTYPE_AVICODEC;
|
||||
else if (!strcmp(imtype,"QUICKTIME")) imtype_new = R_IMF_IMTYPE_QUICKTIME;
|
||||
else if (!strcmp(imtype,"BMP")) imtype_new = R_IMF_IMTYPE_BMP;
|
||||
#ifdef WITH_HDR
|
||||
else if (!strcmp(imtype,"HDR")) imtype_new = R_IMF_IMTYPE_RADHDR;
|
||||
#endif
|
||||
#ifdef WITH_TIFF
|
||||
else if (!strcmp(imtype,"TIFF")) imtype_new = R_IMF_IMTYPE_TIFF;
|
||||
#endif
|
||||
#ifdef WITH_OPENEXR
|
||||
else if (!strcmp(imtype,"EXR")) imtype_new = R_IMF_IMTYPE_OPENEXR;
|
||||
else if (!strcmp(imtype,"MULTILAYER")) imtype_new = R_IMF_IMTYPE_MULTILAYER;
|
||||
#endif
|
||||
else if (!strcmp(imtype,"MPEG")) imtype_new = R_IMF_IMTYPE_FFMPEG;
|
||||
else if (!strcmp(imtype,"FRAMESERVER")) imtype_new = R_IMF_IMTYPE_FRAMESERVER;
|
||||
#ifdef WITH_CINEON
|
||||
else if (!strcmp(imtype,"CINEON")) imtype_new = R_IMF_IMTYPE_CINEON;
|
||||
else if (!strcmp(imtype,"DPX")) imtype_new = R_IMF_IMTYPE_DPX;
|
||||
#endif
|
||||
#ifdef WITH_OPENJPEG
|
||||
else if (!strcmp(imtype,"JP2")) imtype_new = R_IMF_IMTYPE_JP2;
|
||||
#endif
|
||||
else {
|
||||
if (imtype_new == R_IMF_IMTYPE_INVALID) {
|
||||
printf("\nError: Format from '-F / --render-format' not known or not compiled in this release.\n");
|
||||
imtype_new= scene->r.im_format.imtype;
|
||||
}
|
||||
|
||||
scene->r.im_format.imtype= imtype_new;
|
||||
else {
|
||||
scene->r.im_format.imtype= imtype_new;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("\nError: no blend loaded. order the arguments so '-F / --render-format' is after the blend is loaded.\n");
|
||||
|
@ -144,6 +144,7 @@ void BL_ActionActuator::SetLocalTime(float curtime)
|
||||
case ACT_ACTION_PLAY:
|
||||
// Clamp
|
||||
m_localtime = m_endframe;
|
||||
((KX_GameObject*)GetParent())->StopAction(m_layer);
|
||||
break;
|
||||
case ACT_ACTION_LOOP_END:
|
||||
// Put the time back to the beginning
|
||||
@ -237,14 +238,14 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
|
||||
RemoveAllEvents();
|
||||
}
|
||||
|
||||
// "Active" actions need to keep updating their current frame
|
||||
if (bUseContinue && (m_flag & ACT_FLAG_ACTIVE))
|
||||
{
|
||||
m_localtime = obj->GetActionFrame(m_layer);
|
||||
ResetStartTime(curtime);
|
||||
}
|
||||
|
||||
if (m_flag & ACT_FLAG_ATTEMPT_PLAY)
|
||||
SetLocalTime(curtime);
|
||||
else
|
||||
ResetStartTime(curtime);
|
||||
|
||||
// Handle a frame property if it's defined
|
||||
if ((m_flag & ACT_FLAG_ACTIVE) && m_framepropname[0] != 0)
|
||||
@ -299,6 +300,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
|
||||
else if ((m_flag & ACT_FLAG_ACTIVE) && bNegativeEvent)
|
||||
{
|
||||
m_flag &= ~ACT_FLAG_ATTEMPT_PLAY;
|
||||
m_localtime = obj->GetActionFrame(m_layer);
|
||||
bAction *curr_action = obj->GetCurrentAction(m_layer);
|
||||
if (curr_action && curr_action != m_action)
|
||||
{
|
||||
|
@ -295,7 +295,7 @@ PyObject* BL_ArmatureChannel::py_attr_get_joint_rotation(void *self_v, const str
|
||||
mul_v3_fl(joints,norm);
|
||||
break;
|
||||
}
|
||||
return newVectorObject(joints, 3, Py_NEW, NULL);
|
||||
return Vector_CreatePyObject(joints, 3, Py_NEW, NULL);
|
||||
}
|
||||
|
||||
int BL_ArmatureChannel::py_attr_set_joint_rotation(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
|
||||
@ -434,7 +434,7 @@ PyAttributeDef BL_ArmatureBone::AttributesPtr[] = {
|
||||
KX_PYATTRIBUTE_FLOAT_VECTOR_RO("arm_head",Bone,arm_head,3),
|
||||
KX_PYATTRIBUTE_FLOAT_VECTOR_RO("arm_tail",Bone,arm_tail,3),
|
||||
KX_PYATTRIBUTE_FLOAT_MATRIX_RO("arm_mat",Bone,arm_mat,4),
|
||||
KX_PYATTRIBUTE_FLOAT_MATRIX_RO("bone_mat",Bone,bone_mat,4),
|
||||
KX_PYATTRIBUTE_FLOAT_MATRIX_RO("bone_mat",Bone,bone_mat,3),
|
||||
KX_PYATTRIBUTE_RO_FUNCTION("parent",BL_ArmatureBone,py_bone_get_parent),
|
||||
KX_PYATTRIBUTE_RO_FUNCTION("children",BL_ArmatureBone,py_bone_get_children),
|
||||
{ NULL } //Sentinel
|
||||
|
@ -418,7 +418,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
|
||||
return NULL;
|
||||
}
|
||||
#ifdef USE_MATHUTILS
|
||||
return newVectorObject(val, attrdef->m_imax, Py_NEW, NULL);
|
||||
return Vector_CreatePyObject(val, attrdef->m_imax, Py_NEW, NULL);
|
||||
#else
|
||||
PyObject* resultlist = PyList_New(attrdef->m_imax);
|
||||
for (unsigned int i=0; i<attrdef->m_imax; i++)
|
||||
@ -435,7 +435,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
|
||||
return NULL;
|
||||
}
|
||||
#ifdef USE_MATHUTILS
|
||||
return newMatrixObject(val, attrdef->m_imin, attrdef->m_imax, Py_WRAP, NULL);
|
||||
return Matrix_CreatePyObject(val, attrdef->m_imin, attrdef->m_imax, Py_WRAP, NULL);
|
||||
#else
|
||||
PyObject* collist = PyList_New(attrdef->m_imin);
|
||||
for (unsigned int i=0; i<attrdef->m_imin; i++)
|
||||
@ -457,7 +457,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
|
||||
MT_Vector3 *val = reinterpret_cast<MT_Vector3*>(ptr);
|
||||
#ifdef USE_MATHUTILS
|
||||
float fval[3]= {(*val)[0], (*val)[1], (*val)[2]};
|
||||
return newVectorObject(fval, 3, Py_NEW, NULL);
|
||||
return Vector_CreatePyObject(fval, 3, Py_NEW, NULL);
|
||||
#else
|
||||
PyObject* resultlist = PyList_New(3);
|
||||
for (unsigned int i=0; i<3; i++)
|
||||
|
@ -2000,7 +2000,7 @@ int KX_GameObject::pyattr_set_visible(void *self_v, const KX_PYATTRIBUTE_DEF *at
|
||||
PyObject* KX_GameObject::pyattr_get_worldPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
||||
{
|
||||
#ifdef USE_MATHUTILS
|
||||
return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_POS_GLOBAL);
|
||||
return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_POS_GLOBAL);
|
||||
#else
|
||||
KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
|
||||
return PyObjectFrom(self->NodeGetWorldPosition());
|
||||
@ -2022,7 +2022,7 @@ int KX_GameObject::pyattr_set_worldPosition(void *self_v, const KX_PYATTRIBUTE_D
|
||||
PyObject* KX_GameObject::pyattr_get_localPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
||||
{
|
||||
#ifdef USE_MATHUTILS
|
||||
return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_POS_LOCAL);
|
||||
return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_POS_LOCAL);
|
||||
#else
|
||||
KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
|
||||
return PyObjectFrom(self->NodeGetLocalPosition());
|
||||
@ -2044,7 +2044,7 @@ int KX_GameObject::pyattr_set_localPosition(void *self_v, const KX_PYATTRIBUTE_D
|
||||
PyObject* KX_GameObject::pyattr_get_localInertia(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
||||
{
|
||||
#ifdef USE_MATHUTILS
|
||||
return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_INERTIA_LOCAL);
|
||||
return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_INERTIA_LOCAL);
|
||||
#else
|
||||
KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
|
||||
if (self->GetPhysicsController())
|
||||
@ -2056,7 +2056,7 @@ PyObject* KX_GameObject::pyattr_get_localInertia(void *self_v, const KX_PYATTRIB
|
||||
PyObject* KX_GameObject::pyattr_get_worldOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
||||
{
|
||||
#ifdef USE_MATHUTILS
|
||||
return newMatrixObject_cb(BGE_PROXY_FROM_REF(self_v), 3, 3, mathutils_kxgameob_matrix_cb_index, MATHUTILS_MAT_CB_ORI_GLOBAL);
|
||||
return Matrix_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, 3, mathutils_kxgameob_matrix_cb_index, MATHUTILS_MAT_CB_ORI_GLOBAL);
|
||||
#else
|
||||
KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
|
||||
return PyObjectFrom(self->NodeGetWorldOrientation());
|
||||
@ -2081,7 +2081,7 @@ int KX_GameObject::pyattr_set_worldOrientation(void *self_v, const KX_PYATTRIBUT
|
||||
PyObject* KX_GameObject::pyattr_get_localOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
||||
{
|
||||
#ifdef USE_MATHUTILS
|
||||
return newMatrixObject_cb(BGE_PROXY_FROM_REF(self_v), 3, 3, mathutils_kxgameob_matrix_cb_index, MATHUTILS_MAT_CB_ORI_LOCAL);
|
||||
return Matrix_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, 3, mathutils_kxgameob_matrix_cb_index, MATHUTILS_MAT_CB_ORI_LOCAL);
|
||||
#else
|
||||
KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
|
||||
return PyObjectFrom(self->NodeGetLocalOrientation());
|
||||
@ -2105,7 +2105,7 @@ int KX_GameObject::pyattr_set_localOrientation(void *self_v, const KX_PYATTRIBUT
|
||||
PyObject* KX_GameObject::pyattr_get_worldScaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
||||
{
|
||||
#ifdef USE_MATHUTILS
|
||||
return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_SCALE_GLOBAL);
|
||||
return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_SCALE_GLOBAL);
|
||||
#else
|
||||
KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
|
||||
return PyObjectFrom(self->NodeGetWorldScaling());
|
||||
@ -2115,7 +2115,7 @@ PyObject* KX_GameObject::pyattr_get_worldScaling(void *self_v, const KX_PYATTRIB
|
||||
PyObject* KX_GameObject::pyattr_get_localScaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
||||
{
|
||||
#ifdef USE_MATHUTILS
|
||||
return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_SCALE_LOCAL);
|
||||
return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_SCALE_LOCAL);
|
||||
#else
|
||||
KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
|
||||
return PyObjectFrom(self->NodeGetLocalScaling());
|
||||
@ -2138,7 +2138,7 @@ int KX_GameObject::pyattr_set_localScaling(void *self_v, const KX_PYATTRIBUTE_DE
|
||||
PyObject* KX_GameObject::pyattr_get_worldLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
||||
{
|
||||
#ifdef USE_MATHUTILS
|
||||
return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_LINVEL_GLOBAL);
|
||||
return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_LINVEL_GLOBAL);
|
||||
#else
|
||||
KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
|
||||
return PyObjectFrom(GetLinearVelocity(false));
|
||||
@ -2160,7 +2160,7 @@ int KX_GameObject::pyattr_set_worldLinearVelocity(void *self_v, const KX_PYATTRI
|
||||
PyObject* KX_GameObject::pyattr_get_localLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
||||
{
|
||||
#ifdef USE_MATHUTILS
|
||||
return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_LINVEL_LOCAL);
|
||||
return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_LINVEL_LOCAL);
|
||||
#else
|
||||
KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
|
||||
return PyObjectFrom(GetLinearVelocity(true));
|
||||
@ -2182,7 +2182,7 @@ int KX_GameObject::pyattr_set_localLinearVelocity(void *self_v, const KX_PYATTRI
|
||||
PyObject* KX_GameObject::pyattr_get_worldAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
||||
{
|
||||
#ifdef USE_MATHUTILS
|
||||
return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_ANGVEL_GLOBAL);
|
||||
return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_ANGVEL_GLOBAL);
|
||||
#else
|
||||
KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
|
||||
return PyObjectFrom(GetAngularVelocity(false));
|
||||
@ -2204,7 +2204,7 @@ int KX_GameObject::pyattr_set_worldAngularVelocity(void *self_v, const KX_PYATTR
|
||||
PyObject* KX_GameObject::pyattr_get_localAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
||||
{
|
||||
#ifdef USE_MATHUTILS
|
||||
return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_ANGVEL_LOCAL);
|
||||
return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_ANGVEL_LOCAL);
|
||||
#else
|
||||
KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
|
||||
return PyObjectFrom(GetAngularVelocity(true));
|
||||
@ -2297,7 +2297,7 @@ PyObject* KX_GameObject::pyattr_get_meshes(void *self_v, const KX_PYATTRIBUTE_DE
|
||||
PyObject* KX_GameObject::pyattr_get_obcolor(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
||||
{
|
||||
#ifdef USE_MATHUTILS
|
||||
return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 4, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_OBJECT_COLOR);
|
||||
return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 4, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_OBJECT_COLOR);
|
||||
#else
|
||||
KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
|
||||
return PyObjectFrom(self->GetObjectColor());
|
||||
|
@ -462,7 +462,7 @@ Mathutils_Callback mathutils_obactu_vector_cb = {
|
||||
|
||||
PyObject* KX_ObjectActuator::pyattr_get_linV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
||||
{
|
||||
return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxobactu_vector_cb_index, MATHUTILS_VEC_CB_LINV);
|
||||
return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxobactu_vector_cb_index, MATHUTILS_VEC_CB_LINV);
|
||||
}
|
||||
|
||||
int KX_ObjectActuator::pyattr_set_linV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
|
||||
@ -478,7 +478,7 @@ int KX_ObjectActuator::pyattr_set_linV(void *self_v, const KX_PYATTRIBUTE_DEF *a
|
||||
|
||||
PyObject* KX_ObjectActuator::pyattr_get_angV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
||||
{
|
||||
return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxobactu_vector_cb_index, MATHUTILS_VEC_CB_ANGV);
|
||||
return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxobactu_vector_cb_index, MATHUTILS_VEC_CB_ANGV);
|
||||
}
|
||||
|
||||
int KX_ObjectActuator::pyattr_set_angV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
|
||||
|
@ -100,7 +100,7 @@ PyObject* PyObjectFrom(const MT_Matrix4x4 &mat)
|
||||
#ifdef USE_MATHUTILS
|
||||
float fmat[16];
|
||||
mat.getValue(fmat);
|
||||
return newMatrixObject(fmat, 4, 4, Py_NEW, NULL);
|
||||
return Matrix_CreatePyObject(fmat, 4, 4, Py_NEW, NULL);
|
||||
#else
|
||||
PyObject *collist = PyList_New(4);
|
||||
PyObject *col;
|
||||
@ -124,7 +124,7 @@ PyObject* PyObjectFrom(const MT_Matrix3x3 &mat)
|
||||
#ifdef USE_MATHUTILS
|
||||
float fmat[9];
|
||||
mat.getValue3x3(fmat);
|
||||
return newMatrixObject(fmat, 3, 3, Py_NEW, NULL);
|
||||
return Matrix_CreatePyObject(fmat, 3, 3, Py_NEW, NULL);
|
||||
#else
|
||||
PyObject *collist = PyList_New(3);
|
||||
PyObject *col;
|
||||
@ -147,7 +147,7 @@ PyObject* PyObjectFrom(const MT_Quaternion &qrot)
|
||||
{
|
||||
/* NOTE, were re-ordering here for Mathutils compat */
|
||||
float fvec[4]= {qrot[3], qrot[0], qrot[1], qrot[2]};
|
||||
return newQuaternionObject(fvec, Py_NEW, NULL);
|
||||
return Quaternion_CreatePyObject(fvec, Py_NEW, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -155,7 +155,7 @@ PyObject* PyObjectFrom(const MT_Tuple4 &vec)
|
||||
{
|
||||
#ifdef USE_MATHUTILS
|
||||
float fvec[4]= {vec[0], vec[1], vec[2], vec[3]};
|
||||
return newVectorObject(fvec, 4, Py_NEW, NULL);
|
||||
return Vector_CreatePyObject(fvec, 4, Py_NEW, NULL);
|
||||
#else
|
||||
PyObject *list = PyList_New(4);
|
||||
PyList_SET_ITEM(list, 0, PyFloat_FromDouble(vec[0]));
|
||||
@ -170,7 +170,7 @@ PyObject* PyObjectFrom(const MT_Tuple3 &vec)
|
||||
{
|
||||
#ifdef USE_MATHUTILS
|
||||
float fvec[3]= {vec[0], vec[1], vec[2]};
|
||||
return newVectorObject(fvec, 3, Py_NEW, NULL);
|
||||
return Vector_CreatePyObject(fvec, 3, Py_NEW, NULL);
|
||||
#else
|
||||
PyObject *list = PyList_New(3);
|
||||
PyList_SET_ITEM(list, 0, PyFloat_FromDouble(vec[0]));
|
||||
@ -184,7 +184,7 @@ PyObject* PyObjectFrom(const MT_Tuple2 &vec)
|
||||
{
|
||||
#ifdef USE_MATHUTILS
|
||||
float fvec[2]= {vec[0], vec[1]};
|
||||
return newVectorObject(fvec, 2, Py_NEW, NULL);
|
||||
return Vector_CreatePyObject(fvec, 2, Py_NEW, NULL);
|
||||
#else
|
||||
PyObject *list = PyList_New(2);
|
||||
PyList_SET_ITEM(list, 0, PyFloat_FromDouble(vec[0]));
|
||||
|
Loading…
Reference in New Issue
Block a user