Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-08-27 16:29:15 +0300
committerHans Goudey <h.goudey@me.com>2021-08-27 16:29:15 +0300
commit104ba1c5682016a55b8a8ed06be52e0c05e913e9 (patch)
tree2c04f9a2d776b005a4791b646ced1ccf0b2d9daf
parent53c7859c9135eeb5274008d4d6caa8364ea0c308 (diff)
Update addons for D9697 "_RNA_UI" removal
This is a followup patch for D9697 which applies the changes to the addon reporistory. Almost all of the changes are in rigify, but there is one change in "curve_tools" and two trivial changes in IO addons. Differential Revision: https://developer.blender.org/D9919
-rw-r--r--add_camera_rigs/build_rigs.py28
-rw-r--r--curve_tools/auto_loft.py16
-rw-r--r--io_scene_fbx/export_fbx_bin.py2
-rw-r--r--io_scene_gltf2/blender/com/gltf2_blender_extras.py2
-rw-r--r--rigify/generate.py2
-rw-r--r--rigify/utils/mechanism.py24
6 files changed, 28 insertions, 46 deletions
diff --git a/add_camera_rigs/build_rigs.py b/add_camera_rigs/build_rigs.py
index 6b47fef8..e3f61632 100644
--- a/add_camera_rigs/build_rigs.py
+++ b/add_camera_rigs/build_rigs.py
@@ -20,7 +20,6 @@ import bpy
from bpy.types import Operator
from bpy_extras import object_utils
from mathutils import Vector
-from rna_prop_ui import rna_idprop_ui_prop_get
from math import pi
from .create_widgets import (create_root_widget,
@@ -158,11 +157,8 @@ def setup_3d_rig(rig, cam):
# Lens property
pb = pose_bones['Camera']
pb["lens"] = 50.0
- prop = rna_idprop_ui_prop_get(pb, "lens", create=True)
- prop["default"] = 50.0
- prop["min"] = 1.0
- prop["max"] = 1000000.0
- prop["soft_max"] = 5000.0
+ ui_data = pb.id_properties_ui("lens")
+ ui_data.update(min=1.0, max=1000000.0, soft_max = 5000.0, default=50.0)
# Build the widgets
root_widget = create_root_widget("Camera_Root")
@@ -327,12 +323,8 @@ def create_2d_bones(context, rig, cam):
# Property to switch between rotation and switch mode
pose_bones["Camera"]['rotation_shift'] = 0.0
- prop = rna_idprop_ui_prop_get(pose_bones["Camera"], 'rotation_shift', create=True)
- prop["min"] = 0.0
- prop["max"] = 1.0
- prop["soft_min"] = 0.0
- prop["soft_max"] = 1.0
- prop["description"] = 'rotation_shift'
+ ui_data = pose_bones["Camera"].id_properties_ui('rotation_shift')
+ ui_data.update(min=0.0, max=1.0, soft_max = 5000.0, description="rotation_shift")
# Rotation / shift switch driver
driver = con.driver_add('influence').driver
@@ -526,18 +518,14 @@ def build_camera_rig(context, mode):
# DOF Focus Distance property
pb = pose_bones['Camera']
pb["focus_distance"] = 10.0
- prop = rna_idprop_ui_prop_get(pb, "focus_distance", create=True)
- prop["default"] = 10.0
- prop["min"] = 0.0
+ ui_data = pb.id_properties_ui('focus_distance')
+ ui_data.update(min=0.0, default=10.0)
# DOF F-Stop property
pb = pose_bones['Camera']
pb["aperture_fstop"] = 2.8
- prop = rna_idprop_ui_prop_get(pb, "aperture_fstop", create=True)
- prop["default"] = 2.8
- prop["min"] = 0.0
- prop["soft_min"] = 0.1
- prop["soft_max"] = 128.0
+ ui_data = pb.id_properties_ui('aperture_fstop')
+ ui_data.update(min=0.0, soft_min=0.1, soft_max=128.0, default=2.8)
# Add drivers to link the camera properties to the custom props
# on the armature
diff --git a/curve_tools/auto_loft.py b/curve_tools/auto_loft.py
index c0711196..17705cc9 100644
--- a/curve_tools/auto_loft.py
+++ b/curve_tools/auto_loft.py
@@ -30,13 +30,10 @@ class OperatorAutoLoftCurves(Operator):
context.collection.objects.link(loftobj)
loftobj["autoloft"] = True
- if loftobj.get('_RNA_UI') is None:
- loftobj['_RNA_UI'] = {}
- loftobj['_RNA_UI']["autoloft"] = {
- "name": "Auto Loft",
- "description": "Auto loft from %s to %s" % (curve0.name, curve1.name),
- "curve0": curve0.name,
- "curve1": curve1.name}
+ ui_data = loftobj.id_properties_ui("autoloft")
+ ui_data.update(description="Auto loft from %s to %s" % (curve0.name, curve1.name))
+ loftobj["autoloft_curve0"] = curve0.name
+ loftobj["autoloft_curve1"] = curve1.name
return {'FINISHED'}
@@ -59,9 +56,8 @@ class AutoLoftModalOperator(Operator):
#print("TIMER", lofters)
for loftmesh in lofters:
- rna = loftmesh['_RNA_UI']["autoloft"].to_dict()
- curve0 = scene.objects.get(rna["curve0"])
- curve1 = scene.objects.get(rna["curve1"])
+ curve0 = scene.objects.get(loftmesh['autoloft_curve0'])
+ curve1 = scene.objects.get(loftmesh['autoloft_curve1'])
if curve0 and curve1:
ls = surfaces.LoftedSurface(curves.Curve(curve0), curves.Curve(curve1), loftmesh.name)
ls.bMesh.to_mesh(loftmesh.data)
diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index bafdf1ef..3950ed5b 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -542,7 +542,7 @@ def fbx_data_element_custom_properties(props, bid):
rna_properties = {prop.identifier for prop in bid.bl_rna.properties if prop.is_runtime}
for k, v in items:
- if k == '_RNA_UI' or k in rna_properties:
+ if k in rna_properties:
continue
list_val = getattr(v, "to_list", lambda: None)()
diff --git a/io_scene_gltf2/blender/com/gltf2_blender_extras.py b/io_scene_gltf2/blender/com/gltf2_blender_extras.py
index 26528aa4..6c93e7b4 100644
--- a/io_scene_gltf2/blender/com/gltf2_blender_extras.py
+++ b/io_scene_gltf2/blender/com/gltf2_blender_extras.py
@@ -18,7 +18,7 @@ from .gltf2_blender_json import is_json_convertible
# Custom properties, which are in most cases present and should not be imported/exported.
-BLACK_LIST = ['cycles', 'cycles_visibility', 'cycles_curves', '_RNA_UI', 'glTF2ExportSettings']
+BLACK_LIST = ['cycles', 'cycles_visibility', 'cycles_curves', 'glTF2ExportSettings']
def generate_extras(blender_element):
diff --git a/rigify/generate.py b/rigify/generate.py
index aa9a9a84..caff2633 100644
--- a/rigify/generate.py
+++ b/rigify/generate.py
@@ -21,7 +21,6 @@
import bpy
import re
import time
-from rna_prop_ui import rna_idprop_ui_prop_get
from .utils.errors import MetarigError
from .utils.bones import new_bone
@@ -415,7 +414,6 @@ class Generator(base_generate.BaseGenerator):
#------------------------------------------
# Put the rig_name in the armature custom properties
- rna_idprop_ui_prop_get(obj.data, "rig_id", create=True)
obj.data["rig_id"] = self.rig_id
self.script = rig_ui_template.ScriptGenerator(self)
diff --git a/rigify/utils/mechanism.py b/rigify/utils/mechanism.py
index 92e161f6..00aef154 100644
--- a/rigify/utils/mechanism.py
+++ b/rigify/utils/mechanism.py
@@ -23,7 +23,7 @@ import re
from bpy.types import bpy_prop_collection, Material
-from rna_prop_ui import rna_idprop_ui_create, rna_idprop_ui_prop_get
+from rna_prop_ui import rna_idprop_ui_create
from rna_prop_ui import rna_idprop_quote_path as quote_property
from .misc import force_lazy
@@ -137,7 +137,7 @@ def make_property(
"""
# Some keyword argument defaults differ
- return rna_idprop_ui_create(
+ rna_idprop_ui_create(
owner, name, default = default,
min = min, max = max, soft_min = soft_min, soft_max = soft_max,
description = description or name,
@@ -440,8 +440,9 @@ def deactivate_custom_properties(obj, *, reset=True):
for key, value in obj.items():
valtype = type(value)
if valtype in {int, float}:
- info = rna_idprop_ui_prop_get(obj, key, create=False) or {}
- obj[key] = valtype(info.get("default", 0))
+ ui_data = obj.id_properties_ui(key)
+ rna_data = ui_data.as_dict()
+ obj[key] = valtype(rna_data.get("default", 0))
def reactivate_custom_properties(obj):
@@ -462,21 +463,19 @@ def reactivate_custom_properties(obj):
def copy_custom_properties(src, dest, *, prefix='', dest_prefix='', link_driver=False, overridable=True):
"""Copy custom properties with filtering by prefix. Optionally link using drivers."""
res = []
- exclude = {'_RNA_UI', 'rigify_parameters', 'rigify_type'}
+ exclude = {'rigify_parameters', 'rigify_type'}
for key, value in src.items():
if key.startswith(prefix) and key not in exclude:
new_key = dest_prefix + key[len(prefix):]
- info = rna_idprop_ui_prop_get(src, key, create=False)
+ ui_data_src = src.id_properties_ui(key)
+
if src != dest or new_key != key:
dest[new_key] = value
- if info:
- info2 = rna_idprop_ui_prop_get(dest, new_key, create=True)
- for ki, vi in info.items():
- info2[ki] = vi
+ dest.id_properties_ui(new_key).update_from(ui_data_src)
if link_driver:
make_driver(src, quote_property(key), variables=[(dest.id_data, dest, new_key)])
@@ -484,7 +483,7 @@ def copy_custom_properties(src, dest, *, prefix='', dest_prefix='', link_driver=
if overridable:
dest.property_overridable_library_set(quote_property(new_key), True)
- res.append((key, new_key, value, info))
+ res.append((key, new_key, value))
return res
@@ -500,7 +499,7 @@ def copy_custom_properties_with_ui(rig, src, dest_bone, *, ui_controls=None, **o
if mapping:
panel = rig.script.panel_with_selected_check(rig, ui_controls or rig.bones.flatten('ctrl'))
- for key,new_key,value,info in sorted(mapping, key=lambda item: item[1]):
+ for key,new_key,value in sorted(mapping, key=lambda item: item[1]):
name = new_key
# Replace delimiters with spaces
@@ -513,6 +512,7 @@ def copy_custom_properties_with_ui(rig, src, dest_bone, *, ui_controls=None, **o
if name.lower() == name:
name = name.title()
+ info = bone.id_properties_ui(new_key).as_dict()
slider = type(value) is float and info and info.get("min", None) == 0 and info.get("max", None) == 1
panel.custom_prop(dest_bone, new_key, text=name, slider=slider)