- move more active properties into their collections:
scene.active_keying_set --> scene.keying_sets.active ...same for active_uv_texture. active_vertex_color, active_keyconfig, - move mesh.add_uv_layer() and mesh.add_vertex_color() into their collections also have them return the newly created layer and dont set the layer active. uvtex = mesh.uv_layers.new(name) vcol = mesh.vertex_colors.new(name)
This commit is contained in:
@@ -567,7 +567,7 @@ def extract_triangles(mesh):
|
||||
f_v = face.vertices
|
||||
# f_v = face.v
|
||||
|
||||
uf = mesh.active_uv_texture.data[i] if do_uv else None
|
||||
uf = mesh.uv_textures.active.data[i] if do_uv else None
|
||||
|
||||
if do_uv:
|
||||
f_uv = uf.uv
|
||||
@@ -998,7 +998,7 @@ def write(filename, context):
|
||||
if not mat_ls:
|
||||
mat = mat_name = None
|
||||
|
||||
for f, uf in zip(data.faces, data.active_uv_texture.data):
|
||||
for f, uf in zip(data.faces, data.uv_textures.active.data):
|
||||
if mat_ls:
|
||||
mat_index = f.material_index
|
||||
# mat_index = f.mat
|
||||
|
||||
@@ -1630,7 +1630,7 @@ def write(filename, batch_objects = None, \
|
||||
# if me.vertexColors:
|
||||
collayers = me.vertex_colors
|
||||
# collayers = me.getColorLayerNames()
|
||||
collayer_orig = me.active_vertex_color
|
||||
collayer_orig = me.vertex_colors.active
|
||||
# collayer_orig = me.activeColorLayer
|
||||
for colindex, collayer in enumerate(collayers):
|
||||
# me.activeColorLayer = collayer
|
||||
@@ -1700,7 +1700,7 @@ def write(filename, batch_objects = None, \
|
||||
if do_uvs:
|
||||
uvlayers = me.uv_textures
|
||||
# uvlayers = me.getUVLayerNames()
|
||||
uvlayer_orig = me.active_uv_texture
|
||||
uvlayer_orig = me.uv_textures.active
|
||||
# uvlayer_orig = me.activeUVLayer
|
||||
for uvindex, uvlayer in enumerate(me.uv_textures):
|
||||
# for uvindex, uvlayer in enumerate(uvlayers):
|
||||
@@ -1834,8 +1834,8 @@ def write(filename, batch_objects = None, \
|
||||
|
||||
mats = my_mesh.blenMaterialList
|
||||
|
||||
if me.active_uv_texture:
|
||||
uv_faces = me.active_uv_texture.data
|
||||
if me.uv_textures.active:
|
||||
uv_faces = me.uv_textures.active.data
|
||||
else:
|
||||
uv_faces = [None] * len(me.faces)
|
||||
|
||||
@@ -2103,7 +2103,7 @@ def write(filename, batch_objects = None, \
|
||||
material_mapping_local = {}
|
||||
if len(me.uv_textures) > 0:
|
||||
# if me.faceUV:
|
||||
uvlayer_orig = me.active_uv_texture
|
||||
uvlayer_orig = me.uv_textures.active
|
||||
# uvlayer_orig = me.activeUVLayer
|
||||
for uvlayer in me.uv_textures:
|
||||
# for uvlayer in me.getUVLayerNames():
|
||||
|
||||
@@ -418,7 +418,7 @@ def write_file(filepath, objects, scene,
|
||||
|
||||
if EXPORT_UV:
|
||||
faceuv = len(me.uv_textures) > 0
|
||||
uv_layer = me.active_uv_texture.data[:]
|
||||
uv_layer = me.uv_textures.active.data[:]
|
||||
else:
|
||||
faceuv = False
|
||||
|
||||
@@ -542,7 +542,7 @@ def write_file(filepath, objects, scene,
|
||||
uv_face_mapping = [[0,0,0,0] for i in range(len(face_index_pairs))] # a bit of a waste for tri's :/
|
||||
|
||||
uv_dict = {} # could use a set() here
|
||||
uv_layer = me.active_uv_texture.data
|
||||
uv_layer = me.uv_textures.active.data
|
||||
for f, f_index in face_index_pairs:
|
||||
for uv_index, uv in enumerate(uv_layer[f_index].uv):
|
||||
uvkey = veckey2d(uv)
|
||||
|
||||
@@ -129,7 +129,7 @@ def write(filename, scene, ob, \
|
||||
vertexColors = False
|
||||
|
||||
if faceUV:
|
||||
active_uv_layer = mesh.active_uv_texture
|
||||
active_uv_layer = mesh.uv_textures.active
|
||||
if not active_uv_layer:
|
||||
EXPORT_UV = False
|
||||
faceUV = None
|
||||
@@ -137,7 +137,7 @@ def write(filename, scene, ob, \
|
||||
active_uv_layer = active_uv_layer.data
|
||||
|
||||
if vertexColors:
|
||||
active_col_layer = mesh.active_vertex_color
|
||||
active_col_layer = mesh.vertex_colors.active
|
||||
if not active_col_layer:
|
||||
EXPORT_COLORS = False
|
||||
vertexColors = None
|
||||
|
||||
@@ -402,9 +402,9 @@ class x3d_class:
|
||||
if len(mesh.faces) == 0: return
|
||||
mode = []
|
||||
# mode = 0
|
||||
if mesh.active_uv_texture:
|
||||
if mesh.uv_textures.active:
|
||||
# if mesh.faceUV:
|
||||
for face in mesh.active_uv_texture.data:
|
||||
for face in mesh.uv_textures.active.data:
|
||||
# for face in mesh.faces:
|
||||
if face.use_halo and 'HALO' not in mode:
|
||||
mode += ['HALO']
|
||||
@@ -463,7 +463,7 @@ class x3d_class:
|
||||
hasImageTexture=0
|
||||
is_smooth = False
|
||||
|
||||
if len(maters) > 0 or mesh.active_uv_texture:
|
||||
if len(maters) > 0 or mesh.uv_textures.active:
|
||||
# if len(maters) > 0 or mesh.faceUV:
|
||||
self.writeIndented("<Appearance>\n", 1)
|
||||
# right now this script can only handle a single material per mesh.
|
||||
@@ -480,9 +480,9 @@ class x3d_class:
|
||||
|
||||
#-- textures
|
||||
face = None
|
||||
if mesh.active_uv_texture:
|
||||
if mesh.uv_textures.active:
|
||||
# if mesh.faceUV:
|
||||
for face in mesh.active_uv_texture.data:
|
||||
for face in mesh.uv_textures.active.data:
|
||||
# for face in mesh.faces:
|
||||
if face.image:
|
||||
# if (hasImageTexture == 0) and (face.image):
|
||||
@@ -525,7 +525,7 @@ class x3d_class:
|
||||
self.file.write("creaseAngle=\"%s\" " % (round(creaseAngle,self.cp)))
|
||||
|
||||
#--- output textureCoordinates if UV texture used
|
||||
if mesh.active_uv_texture:
|
||||
if mesh.uv_textures.active:
|
||||
# if mesh.faceUV:
|
||||
if self.matonly == 1 and self.share == 1:
|
||||
self.writeFaceColors(mesh)
|
||||
@@ -540,7 +540,7 @@ class x3d_class:
|
||||
self.writeCoordinates(ob, mesh, meshName, EXPORT_TRI)
|
||||
|
||||
#--- output textureCoordinates if UV texture used
|
||||
if mesh.active_uv_texture:
|
||||
if mesh.uv_textures.active:
|
||||
# if mesh.faceUV:
|
||||
if hasImageTexture == 1:
|
||||
self.writeTextureCoordinates(mesh)
|
||||
@@ -614,7 +614,7 @@ class x3d_class:
|
||||
texIndexList=[]
|
||||
j=0
|
||||
|
||||
for face in mesh.active_uv_texture.data:
|
||||
for face in mesh.uv_textures.active.data:
|
||||
# for face in mesh.faces:
|
||||
# workaround, since tface.uv iteration is wrong atm
|
||||
uvs = face.uv
|
||||
@@ -646,10 +646,10 @@ class x3d_class:
|
||||
def writeFaceColors(self, mesh):
|
||||
if self.writingcolor == 0:
|
||||
self.file.write("colorPerVertex=\"false\" ")
|
||||
elif mesh.active_vertex_color:
|
||||
elif mesh.vertex_colors.active:
|
||||
# else:
|
||||
self.writeIndented("<Color color=\"", 1)
|
||||
for face in mesh.active_vertex_color.data:
|
||||
for face in mesh.vertex_colors.active.data:
|
||||
c = face.color1
|
||||
if self.verbose > 2:
|
||||
print("Debug: face.col r=%d g=%d b=%d" % (c[0], c[1], c[2]))
|
||||
@@ -961,9 +961,9 @@ class x3d_class:
|
||||
faceMap={}
|
||||
nFaceIndx=0
|
||||
|
||||
if mesh.active_uv_texture:
|
||||
if mesh.uv_textures.active:
|
||||
# if mesh.faceUV:
|
||||
for face in mesh.active_uv_texture.data:
|
||||
for face in mesh.uv_textures.active.data:
|
||||
# for face in mesh.faces
|
||||
sidename = "two" if face.use_twoside else "one"
|
||||
|
||||
|
||||
@@ -346,8 +346,8 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
|
||||
bmesh.faces.foreach_set("vertices_raw", eekadoodle_faces)
|
||||
|
||||
if bmesh.faces and contextMeshUV:
|
||||
bmesh.add_uv_texture()
|
||||
uv_faces = bmesh.active_uv_texture.data[:]
|
||||
bmesh.uv_textures.new()
|
||||
uv_faces = bmesh.uv_textures.active.data[:]
|
||||
else:
|
||||
uv_faces = None
|
||||
|
||||
|
||||
@@ -692,9 +692,7 @@ def create_mesh(new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc, v
|
||||
# face_mapping= me.faces.extend([f[0] for f in faces], indexList=True)
|
||||
|
||||
if verts_tex and me.faces:
|
||||
me.add_uv_texture()
|
||||
# me.faceUV= 1
|
||||
# TEXMODE= Mesh.FaceModes['TEX']
|
||||
me.uv_textures.new()
|
||||
|
||||
context_material_old= -1 # avoid a dict lookup
|
||||
mat= 0 # rare case it may be un-initialized.
|
||||
|
||||
@@ -427,13 +427,13 @@ class JoinUVs(bpy.types.Operator):
|
||||
if is_editmode:
|
||||
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
|
||||
|
||||
if not mesh.active_uv_texture:
|
||||
if not mesh.uv_textures:
|
||||
self.report({'WARNING'}, "Object: %s, Mesh: '%s' has no UVs\n" % (obj.name, mesh.name))
|
||||
else:
|
||||
len_faces = len(mesh.faces)
|
||||
|
||||
uv_array = array.array('f', [0.0] * 8) * len_faces # seems to be the fastest way to create an array
|
||||
mesh.active_uv_texture.data.foreach_get("uv_raw", uv_array)
|
||||
mesh.uv_textures.active.data.foreach_get("uv_raw", uv_array)
|
||||
|
||||
objects = context.selected_editable_objects[:]
|
||||
|
||||
@@ -451,10 +451,9 @@ class JoinUVs(bpy.types.Operator):
|
||||
if len(mesh_other.faces) != len_faces:
|
||||
self.report({'WARNING'}, "Object: %s, Mesh: '%s' has %d faces, expected %d\n" % (obj_other.name, mesh_other.name, len(mesh_other.faces), len_faces))
|
||||
else:
|
||||
uv_other = mesh_other.active_uv_texture
|
||||
uv_other = mesh_other.uv_textures.active
|
||||
if not uv_other:
|
||||
mesh_other.add_uv_texture() # should return the texture it adds
|
||||
uv_other = mesh_other.active_uv_texture
|
||||
uv_other = mesh_other.uv_textures.new() # should return the texture it adds
|
||||
|
||||
# finally do the copy
|
||||
uv_other.data.foreach_set("uv_raw", uv_array)
|
||||
|
||||
@@ -50,7 +50,7 @@ class AddPresetBase():
|
||||
if getattr(self, "save_keyconfig", False):
|
||||
bpy.ops.wm.keyconfig_export(filepath=filepath, kc_name=self.properties.name)
|
||||
file_preset = open(filepath, 'a')
|
||||
file_preset.write("wm.active_keyconfig = kc\n\n")
|
||||
file_preset.write("wm.keyconfigs.active = kc\n\n")
|
||||
else:
|
||||
file_preset = open(filepath, 'w')
|
||||
file_preset.write("import bpy\n")
|
||||
|
||||
@@ -69,7 +69,7 @@ class ExportUVLayout(bpy.types.Operator):
|
||||
def _face_uv_iter(self, context):
|
||||
obj = context.active_object
|
||||
mesh = obj.data
|
||||
uv_layer = mesh.active_uv_texture.data
|
||||
uv_layer = mesh.uv_textures.active.data
|
||||
uv_layer_len = len(uv_layer)
|
||||
|
||||
if not self.properties.export_all:
|
||||
|
||||
@@ -28,8 +28,8 @@ def extend(obj, operator, EXTEND_MODE):
|
||||
me = obj.data
|
||||
me_verts = me.vertices
|
||||
# script will fail without UVs
|
||||
if not me.active_uv_texture:
|
||||
me.add_uv_texture()
|
||||
if not me.uv_textures:
|
||||
me.uv_textures.new()
|
||||
|
||||
|
||||
# Toggle Edit mode
|
||||
@@ -57,10 +57,10 @@ def extend(obj, operator, EXTEND_MODE):
|
||||
vidx_source = face_source.vertices
|
||||
vidx_target = face_target.vertices
|
||||
|
||||
faceUVsource = me.active_uv_texture.data[face_source.index]
|
||||
faceUVsource = me.uv_textures.active.data[face_source.index]
|
||||
uvs_source = [faceUVsource.uv1, faceUVsource.uv2, faceUVsource.uv3, faceUVsource.uv4]
|
||||
|
||||
faceUVtarget = me.active_uv_texture.data[face_target.index]
|
||||
faceUVtarget = me.uv_textures.active.data[face_target.index]
|
||||
uvs_target = [faceUVtarget.uv1, faceUVtarget.uv2, faceUVtarget.uv3, faceUVtarget.uv4]
|
||||
|
||||
# vertex index is the key, uv is the value
|
||||
@@ -138,8 +138,8 @@ def extend(obj, operator, EXTEND_MODE):
|
||||
uvs_vhash_target[edgepair_outer_target[iA]][:] = uvs_vhash_source[edgepair_inner_source[1]] + (uvs_vhash_source[edgepair_inner_source[1]] - uvs_vhash_source[edgepair_outer_source[0]])
|
||||
|
||||
|
||||
if me.active_uv_texture == None:
|
||||
me.add_uv_texture
|
||||
if not me.uv_textures:
|
||||
me.uv_textures.new()
|
||||
|
||||
face_act = me.faces.active
|
||||
if face_act == -1:
|
||||
|
||||
@@ -892,10 +892,10 @@ def main(context, island_margin, projection_limit):
|
||||
# Tag as used
|
||||
me.tag = True
|
||||
|
||||
if len(me.uv_textures)==0: # Mesh has no UV Coords, dont bother.
|
||||
me.add_uv_texture()
|
||||
if not me.uv_textures: # Mesh has no UV Coords, dont bother.
|
||||
me.uv_textures.new()
|
||||
|
||||
uv_layer = me.active_uv_texture.data
|
||||
uv_layer = me.uv_textures.active.data
|
||||
me_verts = list(me.vertices)
|
||||
|
||||
if USER_ONLY_SELECTED_FACES:
|
||||
|
||||
@@ -375,7 +375,7 @@ kmi.properties.value_2 = 'CONNECTED'
|
||||
kmi = km.items.add('mesh.select_all', 'SELECTMOUSE', 'CLICK')
|
||||
kmi.properties.action = 'DESELECT'
|
||||
|
||||
wm.active_keyconfig = kc
|
||||
wm.keyconfigs.active = kc
|
||||
|
||||
bpy.context.user_preferences.edit.use_drag_immediately = True
|
||||
bpy.context.user_preferences.edit.use_insertkey_xyz_to_rgb = False
|
||||
|
||||
@@ -9,11 +9,11 @@ def main(context):
|
||||
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
|
||||
|
||||
|
||||
if not mesh.active_uv_texture:
|
||||
bpy.ops.mesh.uv_texture_add()
|
||||
if not mesh.uv_textures:
|
||||
uvtex = bpy.ops.mesh.uv_texture_add()
|
||||
|
||||
# adjust UVs
|
||||
for i, uv in enumerate(mesh.active_uv_texture.data):
|
||||
for i, uv in enumerate(uvtex.data):
|
||||
uvs = uv.uv1, uv.uv2, uv.uv3, uv.uv4
|
||||
for j, v_idx in enumerate(mesh.faces[i].vertices):
|
||||
if uv.select_uv[j]:
|
||||
|
||||
@@ -126,7 +126,7 @@ class DATA_PT_bone_groups(ArmatureButtonsPanel, bpy.types.Panel):
|
||||
col.operator("pose.group_add", icon='ZOOMIN', text="")
|
||||
col.operator("pose.group_remove", icon='ZOOMOUT', text="")
|
||||
|
||||
group = pose.active_bone_group
|
||||
group = pose.bone_groups.active
|
||||
if group:
|
||||
col = layout.column()
|
||||
col.active = (ob.proxy is None)
|
||||
|
||||
@@ -272,7 +272,7 @@ class DATA_PT_uv_texture(MeshButtonsPanel, bpy.types.Panel):
|
||||
col.operator("mesh.uv_texture_add", icon='ZOOMIN', text="")
|
||||
col.operator("mesh.uv_texture_remove", icon='ZOOMOUT', text="")
|
||||
|
||||
lay = me.active_uv_texture
|
||||
lay = me.uv_textures.active
|
||||
if lay:
|
||||
layout.prop(lay, "name")
|
||||
|
||||
@@ -341,7 +341,7 @@ class DATA_PT_vertex_colors(MeshButtonsPanel, bpy.types.Panel):
|
||||
col.operator("mesh.vertex_color_add", icon='ZOOMIN', text="")
|
||||
col.operator("mesh.vertex_color_remove", icon='ZOOMOUT', text="")
|
||||
|
||||
lay = me.active_vertex_color
|
||||
lay = me.vertex_colors.active
|
||||
if lay:
|
||||
layout.prop(lay, "name")
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ class SCENE_PT_keying_sets(SceneButtonsPanel, bpy.types.Panel):
|
||||
col.operator("anim.keying_set_add", icon='ZOOMIN', text="")
|
||||
col.operator("anim.keying_set_remove", icon='ZOOMOUT', text="")
|
||||
|
||||
ks = scene.active_keying_set
|
||||
ks = scene.keying_sets.active
|
||||
if ks and ks.is_path_absolute:
|
||||
row = layout.row()
|
||||
|
||||
@@ -106,13 +106,14 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel, bpy.types.Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return (context.scene.active_keying_set and context.scene.active_keying_set.is_path_absolute)
|
||||
ks = context.scene.keying_sets.active
|
||||
return (ks and ks.is_path_absolute)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
scene = context.scene
|
||||
ks = scene.active_keying_set
|
||||
ks = scene.keying_sets.active
|
||||
|
||||
row = layout.row()
|
||||
row.label(text="Paths:")
|
||||
@@ -126,7 +127,7 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel, bpy.types.Panel):
|
||||
col.operator("anim.keying_set_path_add", icon='ZOOMIN', text="")
|
||||
col.operator("anim.keying_set_path_remove", icon='ZOOMOUT', text="")
|
||||
|
||||
ksp = ks.active_path
|
||||
ksp = ks.paths.active
|
||||
if ksp:
|
||||
col = layout.column()
|
||||
col.label(text="Target:")
|
||||
@@ -227,7 +228,7 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
|
||||
raise Exception("Could not open file.")
|
||||
|
||||
scene = context.scene
|
||||
ks = scene.active_keying_set
|
||||
ks = scene.keying_sets.active
|
||||
|
||||
|
||||
f.write("# Keying Set: %s\n" % ks.name)
|
||||
|
||||
@@ -316,7 +316,7 @@ class IMAGE_HT_header(bpy.types.Header):
|
||||
row.prop(toolsettings, "snap_element", text="", icon_only=True)
|
||||
|
||||
# mesh = context.edit_object.data
|
||||
# row.prop_search(mesh, "active_uv_layer", mesh, "uv_textures")
|
||||
# row.prop_search_self(mesh, "active", "uv_textures")
|
||||
|
||||
if ima:
|
||||
# layers
|
||||
|
||||
@@ -28,7 +28,7 @@ class OUTLINER_HT_header(bpy.types.Header):
|
||||
|
||||
space = context.space_data
|
||||
scene = context.scene
|
||||
ks = context.scene.active_keying_set
|
||||
ks = context.scene.keying_sets.active
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.template_header()
|
||||
@@ -53,7 +53,7 @@ class OUTLINER_HT_header(bpy.types.Header):
|
||||
|
||||
if ks:
|
||||
row = layout.row(align=False)
|
||||
row.prop_search(scene, "active_keying_set", scene, "keying_sets", text="")
|
||||
row.prop_search_self(scene, "active", "keying_sets", text="")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.operator("anim.keyframe_insert", text="", icon='KEY_HLT')
|
||||
|
||||
@@ -77,7 +77,7 @@ class TIME_HT_header(bpy.types.Header):
|
||||
layout.separator()
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop_search(scene, "active_keying_set", scene, "keying_sets_all", text="")
|
||||
row.prop_search_self(scene, "active", "keying_sets", text="")
|
||||
row.operator("anim.keyframe_insert", text="", icon='KEY_HLT')
|
||||
row.operator("anim.keyframe_delete", text="", icon='KEY_DEHLT')
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
import bpy
|
||||
import os
|
||||
|
||||
KM_MOD_PREFIX = "keyconfig_"
|
||||
|
||||
KM_HIERARCHY = [
|
||||
('Window', 'EMPTY', 'WINDOW', []), # file save, window change, exit
|
||||
@@ -354,8 +353,8 @@ class InputKeyMapPanel(bpy.types.Panel):
|
||||
|
||||
def draw_keymaps(self, context, layout):
|
||||
wm = context.manager
|
||||
kc = wm.active_keyconfig
|
||||
defkc = wm.default_keyconfig
|
||||
kc = wm.keyconfigs.active
|
||||
defkc = wm.keyconfigs.default
|
||||
|
||||
col = layout.column()
|
||||
sub = col.column()
|
||||
@@ -364,8 +363,8 @@ class InputKeyMapPanel(bpy.types.Panel):
|
||||
subcol = subsplit.column()
|
||||
|
||||
row = subcol.row()
|
||||
row.prop_search(wm, "active_keyconfig", wm, "keyconfigs", text="Key Config:")
|
||||
layout.set_context_pointer("keyconfig", wm.active_keyconfig)
|
||||
row.prop_search_self(wm, "active", "keyconfigs", text="Key Config:")
|
||||
layout.set_context_pointer("keyconfig", wm.keyconfigs.active)
|
||||
row.operator("wm.keyconfig_remove", text="", icon='X')
|
||||
|
||||
row.prop(context.space_data, "filter_text", icon="VIEWZOOM")
|
||||
@@ -487,7 +486,7 @@ class WM_OT_keyconfig_test(bpy.types.Operator):
|
||||
|
||||
def execute(self, context):
|
||||
wm = context.manager
|
||||
kc = wm.default_keyconfig
|
||||
kc = wm.keyconfigs.default
|
||||
|
||||
if self.testConfig(kc):
|
||||
print("CONFLICT")
|
||||
@@ -563,7 +562,7 @@ class WM_OT_keyconfig_import(bpy.types.Operator):
|
||||
reload(mod)
|
||||
|
||||
wm = bpy.context.manager
|
||||
wm.active_keyconfig = wm.keyconfigs[config_name]
|
||||
wm.keyconfigs.active = wm.keyconfigs[config_name]
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
@@ -595,7 +594,7 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
|
||||
raise Exception("Could not open file")
|
||||
|
||||
wm = context.manager
|
||||
kc = wm.active_keyconfig
|
||||
kc = wm.keyconfigs.active
|
||||
|
||||
if self.properties.kc_name != '':
|
||||
name = self.properties.kc_name
|
||||
@@ -624,7 +623,7 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
|
||||
edited_kc = FakeKeyConfig()
|
||||
edited_kc.keymaps.extend(context.user_preferences.inputs.edited_keymaps)
|
||||
# merge edited keymaps with non-default keyconfig, if it exists
|
||||
if kc != wm.default_keyconfig:
|
||||
if kc != wm.keyconfigs.default:
|
||||
export_keymaps = _merge_keymaps(edited_kc, kc)
|
||||
else:
|
||||
export_keymaps = _merge_keymaps(edited_kc, edited_kc)
|
||||
@@ -695,7 +694,7 @@ class WM_OT_keymap_restore(bpy.types.Operator):
|
||||
wm = context.manager
|
||||
|
||||
if self.properties.all:
|
||||
for km in wm.default_keyconfig.keymaps:
|
||||
for km in wm.keyconfigs.default.keymaps:
|
||||
km.restore_to_default()
|
||||
else:
|
||||
km = context.keymap
|
||||
@@ -729,7 +728,7 @@ class WM_OT_keyitem_add(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
wm = context.manager
|
||||
km = context.keymap
|
||||
kc = wm.default_keyconfig
|
||||
kc = wm.keyconfigs.default
|
||||
|
||||
if km.is_modal:
|
||||
km.items.add_modal("", 'A', 'PRESS') # kmi
|
||||
@@ -768,13 +767,13 @@ class WM_OT_keyconfig_remove(bpy.types.Operator):
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
wm = context.manager
|
||||
return wm.active_keyconfig.is_user_defined
|
||||
return wm.keyconfigs.active.is_user_defined
|
||||
|
||||
def execute(self, context):
|
||||
import sys
|
||||
wm = context.manager
|
||||
|
||||
keyconfig = wm.active_keyconfig
|
||||
keyconfig = wm.keyconfigs.active
|
||||
|
||||
module = sys.modules.get(keyconfig.name)
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ void *CustomData_add_layer(struct CustomData *data, int type, int alloctype,
|
||||
void *layer, int totelem);
|
||||
/*same as above but accepts a name */
|
||||
void *CustomData_add_layer_named(struct CustomData *data, int type, int alloctype,
|
||||
void *layer, int totelem, char *name);
|
||||
void *layer, int totelem, const char *name);
|
||||
|
||||
/* frees the active or first data layer with the give type.
|
||||
* returns 1 on succes, 0 if no layer with the given type is found
|
||||
|
||||
@@ -1213,7 +1213,7 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data,
|
||||
data->layers[index].flag = flag;
|
||||
data->layers[index].data = newlayerdata;
|
||||
|
||||
if(name) {
|
||||
if(name || (name=typeInfo->defaultname)) {
|
||||
strcpy(data->layers[index].name, name);
|
||||
CustomData_set_layer_unique_name(data, index);
|
||||
}
|
||||
@@ -1254,7 +1254,7 @@ void *CustomData_add_layer(CustomData *data, int type, int alloctype,
|
||||
|
||||
/*same as above but accepts a name*/
|
||||
void *CustomData_add_layer_named(CustomData *data, int type, int alloctype,
|
||||
void *layerdata, int totelem, char *name)
|
||||
void *layerdata, int totelem, const char *name)
|
||||
{
|
||||
CustomDataLayer *layer;
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ struct UvVertMap *EM_make_uv_vert_map(struct EditMesh *em, int selected, int do_
|
||||
struct UvMapVert *EM_get_uv_map_vert(struct UvVertMap *vmap, unsigned int v);
|
||||
void EM_free_uv_vert_map(struct UvVertMap *vmap);
|
||||
|
||||
void EM_add_data_layer(struct EditMesh *em, struct CustomData *data, int type);
|
||||
void EM_add_data_layer(struct EditMesh *em, struct CustomData *data, int type, const char *name);
|
||||
void EM_free_data_layer(struct EditMesh *em, struct CustomData *data, int type);
|
||||
|
||||
void EM_make_hq_normals(struct EditMesh *em);
|
||||
@@ -216,9 +216,9 @@ void ED_mesh_calc_normals(struct Mesh *me);
|
||||
void ED_mesh_material_add(struct Mesh *me, struct Material *ma);
|
||||
void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges);
|
||||
|
||||
int ED_mesh_uv_texture_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me);
|
||||
int ED_mesh_uv_texture_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set);
|
||||
int ED_mesh_uv_texture_remove(struct bContext *C, struct Object *ob, struct Mesh *me);
|
||||
int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me);
|
||||
int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set);
|
||||
int ED_mesh_color_remove(struct bContext *C, struct Object *ob, struct Mesh *me);
|
||||
|
||||
#endif /* ED_MESH_H */
|
||||
|
||||
@@ -967,13 +967,13 @@ static void update_data_blocks(EditMesh *em, CustomData *olddata, CustomData *da
|
||||
}
|
||||
}
|
||||
|
||||
void EM_add_data_layer(EditMesh *em, CustomData *data, int type)
|
||||
void EM_add_data_layer(EditMesh *em, CustomData *data, int type, const char *name)
|
||||
{
|
||||
CustomData olddata;
|
||||
|
||||
olddata= *data;
|
||||
olddata.layers= (olddata.layers)? MEM_dupallocN(olddata.layers): NULL;
|
||||
CustomData_add_layer(data, type, CD_CALLOC, NULL, 0);
|
||||
CustomData_add_layer_named(data, type, CD_CALLOC, NULL, 0, name);
|
||||
|
||||
update_data_blocks(em, &olddata, data);
|
||||
if (olddata.layers) MEM_freeN(olddata.layers);
|
||||
|
||||
@@ -157,7 +157,7 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
|
||||
}
|
||||
}
|
||||
|
||||
int ED_mesh_uv_texture_add(bContext *C, Scene *scene, Object *ob, Mesh *me)
|
||||
int ED_mesh_uv_texture_add(bContext *C, Scene *scene, Object *ob, Mesh *me, const char *name, int active_set)
|
||||
{
|
||||
EditMesh *em;
|
||||
int layernum;
|
||||
@@ -167,22 +167,25 @@ int ED_mesh_uv_texture_add(bContext *C, Scene *scene, Object *ob, Mesh *me)
|
||||
|
||||
layernum= CustomData_number_of_layers(&em->fdata, CD_MTFACE);
|
||||
if(layernum >= MAX_MTFACE)
|
||||
return OPERATOR_CANCELLED;
|
||||
return 0;
|
||||
|
||||
EM_add_data_layer(em, &em->fdata, CD_MTFACE);
|
||||
CustomData_set_layer_active(&em->fdata, CD_MTFACE, layernum);
|
||||
EM_add_data_layer(em, &em->fdata, CD_MTFACE, name);
|
||||
if(active_set || layernum==0)
|
||||
CustomData_set_layer_active(&em->fdata, CD_MTFACE, layernum);
|
||||
}
|
||||
else {
|
||||
layernum= CustomData_number_of_layers(&me->fdata, CD_MTFACE);
|
||||
if(layernum >= MAX_MTFACE)
|
||||
return OPERATOR_CANCELLED;
|
||||
return 0;
|
||||
|
||||
if(me->mtface)
|
||||
CustomData_add_layer(&me->fdata, CD_MTFACE, CD_DUPLICATE, me->mtface, me->totface);
|
||||
CustomData_add_layer_named(&me->fdata, CD_MTFACE, CD_DUPLICATE, me->mtface, me->totface, name);
|
||||
else
|
||||
CustomData_add_layer(&me->fdata, CD_MTFACE, CD_DEFAULT, NULL, me->totface);
|
||||
CustomData_add_layer_named(&me->fdata, CD_MTFACE, CD_DEFAULT, NULL, me->totface, name);
|
||||
|
||||
if(active_set || layernum==0)
|
||||
CustomData_set_layer_active(&me->fdata, CD_MTFACE, layernum);
|
||||
|
||||
CustomData_set_layer_active(&me->fdata, CD_MTFACE, layernum);
|
||||
mesh_update_customdata_pointers(me);
|
||||
}
|
||||
|
||||
@@ -198,7 +201,7 @@ int ED_mesh_uv_texture_remove(bContext *C, Object *ob, Mesh *me)
|
||||
CustomDataLayer *cdl;
|
||||
int index;
|
||||
|
||||
index= CustomData_get_active_layer_index(data, CD_MTFACE);
|
||||
index= CustomData_get_active_layer_index(data, CD_MTFACE);
|
||||
cdl= (index == -1) ? NULL: &data->layers[index];
|
||||
|
||||
if(!cdl)
|
||||
@@ -211,7 +214,7 @@ int ED_mesh_uv_texture_remove(bContext *C, Object *ob, Mesh *me)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me)
|
||||
int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me, const char *name, int active_set)
|
||||
{
|
||||
EditMesh *em;
|
||||
MCol *mcol;
|
||||
@@ -224,8 +227,9 @@ int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me)
|
||||
if(layernum >= MAX_MCOL)
|
||||
return 0;
|
||||
|
||||
EM_add_data_layer(em, &em->fdata, CD_MCOL);
|
||||
CustomData_set_layer_active(&em->fdata, CD_MCOL, layernum);
|
||||
EM_add_data_layer(em, &em->fdata, CD_MCOL, name);
|
||||
if(active_set || layernum==0)
|
||||
CustomData_set_layer_active(&em->fdata, CD_MCOL, layernum);
|
||||
}
|
||||
else {
|
||||
layernum= CustomData_number_of_layers(&me->fdata, CD_MCOL);
|
||||
@@ -235,11 +239,13 @@ int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me)
|
||||
mcol= me->mcol;
|
||||
|
||||
if(me->mcol)
|
||||
CustomData_add_layer(&me->fdata, CD_MCOL, CD_DUPLICATE, me->mcol, me->totface);
|
||||
CustomData_add_layer_named(&me->fdata, CD_MCOL, CD_DUPLICATE, me->mcol, me->totface, name);
|
||||
else
|
||||
CustomData_add_layer(&me->fdata, CD_MCOL, CD_DEFAULT, NULL, me->totface);
|
||||
CustomData_add_layer_named(&me->fdata, CD_MCOL, CD_DEFAULT, NULL, me->totface, name);
|
||||
|
||||
if(active_set || layernum==0)
|
||||
CustomData_set_layer_active(&me->fdata, CD_MCOL, layernum);
|
||||
|
||||
CustomData_set_layer_active(&me->fdata, CD_MCOL, layernum);
|
||||
mesh_update_customdata_pointers(me);
|
||||
|
||||
if(!mcol)
|
||||
@@ -286,7 +292,7 @@ static int uv_texture_add_exec(bContext *C, wmOperator *op)
|
||||
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
Mesh *me= ob->data;
|
||||
|
||||
if(!ED_mesh_uv_texture_add(C, scene, ob, me))
|
||||
if(!ED_mesh_uv_texture_add(C, scene, ob, me, NULL, TRUE))
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
@@ -420,7 +426,7 @@ static int vertex_color_add_exec(bContext *C, wmOperator *op)
|
||||
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
Mesh *me= ob->data;
|
||||
|
||||
if(!ED_mesh_color_add(C, scene, ob, me))
|
||||
if(!ED_mesh_color_add(C, scene, ob, me, NULL, TRUE))
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
||||
@@ -1341,7 +1341,7 @@ static void vgroup_assign_verts(Object *ob, float weight)
|
||||
EditMesh *em = BKE_mesh_get_editmesh(me);
|
||||
|
||||
if(!CustomData_has_layer(&em->vdata, CD_MDEFORMVERT))
|
||||
EM_add_data_layer(em, &em->vdata, CD_MDEFORMVERT);
|
||||
EM_add_data_layer(em, &em->vdata, CD_MDEFORMVERT, NULL);
|
||||
|
||||
/* Go through the list of editverts and assign them */
|
||||
for(eve=em->verts.first; eve; eve=eve->next){
|
||||
|
||||
@@ -107,7 +107,7 @@ void ED_uvedit_assign_image(Scene *scene, Object *obedit, Image *ima, Image *pre
|
||||
|
||||
/* ensure we have a uv layer */
|
||||
if(!CustomData_has_layer(&em->fdata, CD_MTFACE)) {
|
||||
EM_add_data_layer(em, &em->fdata, CD_MTFACE);
|
||||
EM_add_data_layer(em, &em->fdata, CD_MTFACE, NULL);
|
||||
update= 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ static int ED_uvedit_ensure_uvs(bContext *C, Scene *scene, Object *obedit)
|
||||
}
|
||||
|
||||
if(em && em->faces.first)
|
||||
EM_add_data_layer(em, &em->fdata, CD_MTFACE);
|
||||
EM_add_data_layer(em, &em->fdata, CD_MTFACE, NULL);
|
||||
|
||||
if(!ED_uvedit_test(obedit)) {
|
||||
BKE_mesh_end_editmesh(obedit->data, em);
|
||||
|
||||
@@ -537,6 +537,8 @@ static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
FunctionRNA *func;
|
||||
PropertyRNA *parm;
|
||||
|
||||
PropertyRNA *prop;
|
||||
|
||||
RNA_def_property_srna(cprop, "KeyingSetPaths");
|
||||
srna= RNA_def_struct(brna, "KeyingSetPaths", NULL);
|
||||
RNA_def_struct_sdna(srna, "KeyingSet");
|
||||
@@ -576,6 +578,13 @@ static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
func= RNA_def_function(srna, "clear", "rna_KeyingSet_paths_clear");
|
||||
RNA_def_function_ui_description(func, "Remove all the paths from the Keying Set.");
|
||||
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
||||
|
||||
prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "KeyingSetPath");
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_editable_func(prop, "rna_KeyingSet_active_ksPath_editable");
|
||||
RNA_def_property_pointer_funcs(prop, "rna_KeyingSet_active_ksPath_get", "rna_KeyingSet_active_ksPath_set", NULL, NULL);
|
||||
RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
|
||||
}
|
||||
|
||||
static void rna_def_keyingset(BlenderRNA *brna)
|
||||
@@ -605,13 +614,7 @@ static void rna_def_keyingset(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Paths", "Keying Set Paths to define settings that get keyframed together");
|
||||
rna_def_keyingset_paths(brna, prop);
|
||||
|
||||
prop= RNA_def_property(srna, "active_path", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "KeyingSetPath");
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_editable_func(prop, "rna_KeyingSet_active_ksPath_editable");
|
||||
RNA_def_property_pointer_funcs(prop, "rna_KeyingSet_active_ksPath_get", "rna_KeyingSet_active_ksPath_set", NULL, NULL);
|
||||
RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
|
||||
|
||||
/* TODO, move to collection */
|
||||
prop= RNA_def_property(srna, "active_path_index", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "active_path");
|
||||
RNA_def_property_int_funcs(prop, "rna_KeyingSet_active_ksPath_index_get", "rna_KeyingSet_active_ksPath_index_set", "rna_KeyingSet_active_ksPath_index_range");
|
||||
|
||||
@@ -1064,6 +1064,32 @@ static int rna_Mesh_tot_face_get(PointerRNA *ptr)
|
||||
return me->edit_mesh ? me->edit_mesh->totfacesel : 0;
|
||||
}
|
||||
|
||||
static CustomDataLayer *rna_Mesh_vertex_color_new(struct Mesh *me, struct bContext *C, char *name)
|
||||
{
|
||||
CustomData *fdata;
|
||||
CustomDataLayer *cdl;
|
||||
int index;
|
||||
ED_mesh_color_add(C, NULL, NULL, me, name, FALSE);
|
||||
|
||||
fdata= rna_mesh_fdata(me);
|
||||
index= CustomData_number_of_layers(fdata, CD_MCOL) - 1;
|
||||
cdl= (index == -1)? NULL: &fdata->layers[index];
|
||||
return cdl;
|
||||
}
|
||||
|
||||
static CustomDataLayer *rna_Mesh_uv_texture_new(struct Mesh *me, struct bContext *C, char *name)
|
||||
{
|
||||
CustomData *fdata;
|
||||
CustomDataLayer *cdl;
|
||||
int index;
|
||||
ED_mesh_uv_texture_add(C, NULL, NULL, me, name, FALSE);
|
||||
|
||||
fdata= rna_mesh_fdata(me);
|
||||
index= CustomData_number_of_layers(fdata, CD_MTFACE) - 1;
|
||||
cdl= (index == -1)? NULL: &fdata->layers[index];
|
||||
return cdl;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void rna_def_mvert_group(BlenderRNA *brna)
|
||||
@@ -1630,6 +1656,78 @@ static void rna_def_mesh_faces(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
}
|
||||
|
||||
|
||||
/* mesh.vertex_colors */
|
||||
static void rna_def_vertex_colors(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
FunctionRNA *func;
|
||||
PropertyRNA *parm;
|
||||
|
||||
RNA_def_property_srna(cprop, "VertexColors");
|
||||
srna= RNA_def_struct(brna, "VertexColors", NULL);
|
||||
RNA_def_struct_sdna(srna, "Mesh");
|
||||
RNA_def_struct_ui_text(srna, "Vertex Colors", "Collection of vertex colors");
|
||||
|
||||
func= RNA_def_function(srna, "new", "rna_Mesh_vertex_color_new");
|
||||
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
||||
RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh.");
|
||||
parm= RNA_def_string(func, "name", "UVTex", 0, "", "UV Texture name.");
|
||||
parm= RNA_def_pointer(func, "layer", "MeshColorLayer", "", "The newly created layer.");
|
||||
RNA_def_function_return(func, parm);
|
||||
|
||||
/*
|
||||
func= RNA_def_function(srna, "remove", "rna_Mesh_vertex_color_remove");
|
||||
RNA_def_function_ui_description(func, "Remove a vertex color layer.");
|
||||
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
||||
parm= RNA_def_pointer(func, "layer", "Layer", "", "The layer to remove.");
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
*/
|
||||
prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
|
||||
RNA_def_property_struct_type(prop, "MeshColorLayer");
|
||||
RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_vertex_color_get", "rna_Mesh_active_vertex_color_set", NULL, NULL);
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Active Vertex Color Layer", "Active vertex color layer");
|
||||
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
||||
}
|
||||
|
||||
/* mesh.uv_layers */
|
||||
static void rna_def_uv_textures(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
FunctionRNA *func;
|
||||
PropertyRNA *parm;
|
||||
|
||||
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");
|
||||
|
||||
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.");
|
||||
parm= RNA_def_string(func, "name", "UVTex", 0, "", "UV Texture name.");
|
||||
parm= RNA_def_pointer(func, "layer", "MeshColorLayer", "", "The newly created layer.");
|
||||
RNA_def_function_return(func, parm);
|
||||
|
||||
/*
|
||||
func= RNA_def_function(srna, "remove", "rna_Mesh_uv_layers_remove");
|
||||
RNA_def_function_ui_description(func, "Remove a vertex color layer.");
|
||||
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
||||
parm= RNA_def_pointer(func, "layer", "Layer", "", "The layer to remove.");
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
*/
|
||||
prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
|
||||
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_update(prop, 0, "rna_Mesh_update_data");
|
||||
}
|
||||
|
||||
static void rna_def_mesh(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
@@ -1672,13 +1770,7 @@ static void rna_def_mesh(BlenderRNA *brna)
|
||||
RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_textures_begin", 0, 0, 0, "rna_Mesh_uv_textures_length", 0, 0);
|
||||
RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
|
||||
RNA_def_property_ui_text(prop, "UV Textures", "");
|
||||
|
||||
prop= RNA_def_property(srna, "active_uv_texture", PROP_POINTER, PROP_UNSIGNED);
|
||||
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_update(prop, 0, "rna_Mesh_update_data");
|
||||
rna_def_uv_textures(brna, prop);
|
||||
|
||||
prop= RNA_def_property(srna, "active_uv_texture_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");
|
||||
@@ -1712,14 +1804,9 @@ static void rna_def_mesh(BlenderRNA *brna)
|
||||
RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_colors_begin", 0, 0, 0, "rna_Mesh_vertex_colors_length", 0, 0);
|
||||
RNA_def_property_struct_type(prop, "MeshColorLayer");
|
||||
RNA_def_property_ui_text(prop, "Vertex Colors", "");
|
||||
rna_def_vertex_colors(brna, prop);
|
||||
|
||||
prop= RNA_def_property(srna, "active_vertex_color", PROP_POINTER, PROP_UNSIGNED);
|
||||
RNA_def_property_struct_type(prop, "MeshColorLayer");
|
||||
RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_vertex_color_get", "rna_Mesh_active_vertex_color_set", NULL, NULL);
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Active Vertex Color Layer", "Active vertex color layer");
|
||||
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
||||
|
||||
/* TODO, remove and make a collection property */
|
||||
prop= RNA_def_property(srna, "active_vertex_color_index", PROP_INT, PROP_UNSIGNED);
|
||||
RNA_def_property_int_funcs(prop, "rna_Mesh_active_vertex_color_index_get", "rna_Mesh_active_vertex_color_index_set", "rna_Mesh_active_vertex_color_index_range");
|
||||
RNA_def_property_ui_text(prop, "Active Vertex Color Index", "Active vertex color index");
|
||||
|
||||
@@ -37,15 +37,6 @@
|
||||
|
||||
#ifdef RNA_RUNTIME
|
||||
|
||||
static void rna_Mesh_uv_texture_add(struct Mesh *me, struct bContext *C)
|
||||
{
|
||||
ED_mesh_uv_texture_add(C, NULL, NULL, me);
|
||||
}
|
||||
|
||||
static void rna_Mesh_vertex_color_add(struct Mesh *me, struct bContext *C)
|
||||
{
|
||||
ED_mesh_color_add(C, NULL, NULL, me);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
@@ -68,14 +59,6 @@ void RNA_api_mesh(StructRNA *srna)
|
||||
parm= RNA_def_int(func, "faces", 0, 0, INT_MAX, "Number", "Number of faces to add.", 0, INT_MAX);
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
|
||||
func= RNA_def_function(srna, "add_uv_texture", "rna_Mesh_uv_texture_add");
|
||||
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
||||
RNA_def_function_ui_description(func, "Add a UV texture layer to Mesh.");
|
||||
|
||||
func= RNA_def_function(srna, "add_vertex_color", "rna_Mesh_vertex_color_add");
|
||||
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
||||
RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh.");
|
||||
|
||||
func= RNA_def_function(srna, "calc_normals", "ED_mesh_calc_normals");
|
||||
RNA_def_function_ui_description(func, "Calculate vertex normals.");
|
||||
|
||||
|
||||
@@ -1135,6 +1135,28 @@ static void rna_def_pose_ikparam(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "IK Solver", "IK solver for which these parameters are defined, 0 for Legacy, 1 for iTaSC");
|
||||
}
|
||||
|
||||
/* pose.bone_groups */
|
||||
static void rna_def_bone_groups(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
// FunctionRNA *func;
|
||||
// PropertyRNA *parm;
|
||||
|
||||
RNA_def_property_srna(cprop, "BoneGroups");
|
||||
srna= RNA_def_struct(brna, "BoneGroups", NULL);
|
||||
RNA_def_struct_sdna(srna, "bPose");
|
||||
RNA_def_struct_ui_text(srna, "Bone Groups", "Collection of bone groups");
|
||||
|
||||
prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "BoneGroup");
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_pointer_funcs(prop, "rna_Pose_active_bone_group_get", "rna_Pose_active_bone_group_set", NULL, NULL);
|
||||
RNA_def_property_ui_text(prop, "Active Bone Group", "Active bone group for this pose");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
|
||||
}
|
||||
|
||||
static void rna_def_pose(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
@@ -1156,13 +1178,7 @@ static void rna_def_pose(BlenderRNA *brna)
|
||||
RNA_def_property_collection_sdna(prop, NULL, "agroups", NULL);
|
||||
RNA_def_property_struct_type(prop, "BoneGroup");
|
||||
RNA_def_property_ui_text(prop, "Bone Groups", "Groups of the bones");
|
||||
|
||||
prop= RNA_def_property(srna, "active_bone_group", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "BoneGroup");
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_pointer_funcs(prop, "rna_Pose_active_bone_group_get", "rna_Pose_active_bone_group_set", NULL, NULL);
|
||||
RNA_def_property_ui_text(prop, "Active Bone Group", "Active bone group for this pose");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
|
||||
rna_def_bone_groups(brna, prop);
|
||||
|
||||
prop= RNA_def_property(srna, "active_bone_group_index", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "active_group");
|
||||
|
||||
@@ -2905,6 +2905,43 @@ static void rna_def_timeline_markers(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
|
||||
}
|
||||
|
||||
/* scene.keying_sets */
|
||||
static void rna_def_scene_keying_sets(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
// FunctionRNA *func;
|
||||
// PropertyRNA *parm;
|
||||
|
||||
RNA_def_property_srna(cprop, "KeyingSets");
|
||||
srna= RNA_def_struct(brna, "KeyingSets", NULL);
|
||||
RNA_def_struct_sdna(srna, "Scene");
|
||||
RNA_def_struct_ui_text(srna, "Keying Sets", "Scene keying sets");
|
||||
|
||||
/*
|
||||
func= RNA_def_function(srna, "new", "rna_Curve_spline_new");
|
||||
RNA_def_function_ui_description(func, "Add a new spline to the curve.");
|
||||
parm= RNA_def_enum(func, "type", curve_type_items, CU_POLY, "", "type for the new spline.");
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
parm= RNA_def_pointer(func, "spline", "Spline", "", "The newly created spline.");
|
||||
RNA_def_function_return(func, parm);
|
||||
|
||||
func= RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
|
||||
RNA_def_function_ui_description(func, "Remove a spline from a curve.");
|
||||
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
||||
parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove.");
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
*/
|
||||
|
||||
prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "KeyingSet");
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get", "rna_Scene_active_keying_set_set", NULL, NULL);
|
||||
RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
|
||||
RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
|
||||
}
|
||||
|
||||
void RNA_def_scene(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
@@ -3089,6 +3126,7 @@ void RNA_def_scene(BlenderRNA *brna)
|
||||
RNA_def_property_struct_type(prop, "KeyingSet");
|
||||
RNA_def_property_ui_text(prop, "Absolute Keying Sets", "Absolute Keying Sets for this Scene");
|
||||
RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
|
||||
rna_def_scene_keying_sets(brna, prop);
|
||||
|
||||
prop= RNA_def_property(srna, "keying_sets_all", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_collection_funcs(prop, "rna_Scene_all_keyingsets_begin", "rna_Scene_all_keyingsets_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0);
|
||||
@@ -3096,13 +3134,7 @@ void RNA_def_scene(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "All Keying Sets", "All Keying Sets available for use (builtins and Absolute Keying Sets for this Scene)");
|
||||
RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
|
||||
|
||||
prop= RNA_def_property(srna, "active_keying_set", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "KeyingSet");
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get", "rna_Scene_active_keying_set_set", NULL, NULL);
|
||||
RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
|
||||
RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
|
||||
|
||||
/* TODO, move into the collection */
|
||||
prop= RNA_def_property(srna, "active_keying_set_index", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "active_keyingset");
|
||||
RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get", "rna_Scene_active_keying_set_index_set", NULL);
|
||||
|
||||
@@ -1237,6 +1237,45 @@ static void rna_def_window(BlenderRNA *brna)
|
||||
RNA_def_property_update(prop, 0, "rna_Window_screen_update");
|
||||
}
|
||||
|
||||
/* curve.splines */
|
||||
static void rna_def_wm_keyconfigs(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
//FunctionRNA *func;
|
||||
//PropertyRNA *parm;
|
||||
|
||||
RNA_def_property_srna(cprop, "KeyConfigurations");
|
||||
srna= RNA_def_struct(brna, "KeyConfigurations", NULL);
|
||||
RNA_def_struct_sdna(srna, "wmWindowManager");
|
||||
RNA_def_struct_ui_text(srna, "KeyConfigs", "Collection of KeyConfigs");
|
||||
/*
|
||||
func= RNA_def_function(srna, "new", "rna_Curve_spline_new");
|
||||
RNA_def_function_ui_description(func, "Add a new spline to the curve.");
|
||||
parm= RNA_def_enum(func, "type", curve_type_items, CU_POLY, "", "type for the new spline.");
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
parm= RNA_def_pointer(func, "spline", "Spline", "", "The newly created spline.");
|
||||
RNA_def_function_return(func, parm);
|
||||
|
||||
func= RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
|
||||
RNA_def_function_ui_description(func, "Remove a spline from a curve.");
|
||||
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
||||
parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove.");
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
*/
|
||||
prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "KeyConfig");
|
||||
RNA_def_property_pointer_funcs(prop, "rna_WindowManager_active_keyconfig_get", "rna_WindowManager_active_keyconfig_set", NULL, NULL);
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Active KeyConfig", "Active wm KeyConfig");
|
||||
|
||||
prop= RNA_def_property(srna, "default", PROP_POINTER, PROP_NEVER_NULL);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "defaultconf");
|
||||
RNA_def_property_struct_type(prop, "KeyConfig");
|
||||
RNA_def_property_ui_text(prop, "Default Key Configuration", "");
|
||||
}
|
||||
|
||||
static void rna_def_windowmanager(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
@@ -1258,17 +1297,7 @@ static void rna_def_windowmanager(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "keyconfigs", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "KeyConfig");
|
||||
RNA_def_property_ui_text(prop, "Key Configurations", "Registered key configurations");
|
||||
|
||||
prop= RNA_def_property(srna, "active_keyconfig", PROP_POINTER, PROP_NEVER_NULL);
|
||||
RNA_def_property_struct_type(prop, "KeyConfig");
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_pointer_funcs(prop, "rna_WindowManager_active_keyconfig_get", "rna_WindowManager_active_keyconfig_set", 0, NULL);
|
||||
RNA_def_property_ui_text(prop, "Active Key Configuration", "");
|
||||
|
||||
prop= RNA_def_property(srna, "default_keyconfig", PROP_POINTER, PROP_NEVER_NULL);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "defaultconf");
|
||||
RNA_def_property_struct_type(prop, "KeyConfig");
|
||||
RNA_def_property_ui_text(prop, "Default Key Configuration", "");
|
||||
rna_def_wm_keyconfigs(brna, prop);
|
||||
|
||||
RNA_api_wm(srna);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user