fixes for python api docs.
also move foreach_get/set examples into their own py example files (prefer not to have example code built into blenders binary).
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"""
|
||||
Get/Set Example
|
||||
++++++++++++++
|
||||
+++++++++++++++
|
||||
|
||||
Get/Set functions can be used for boolean, int, float, string and enum properties.
|
||||
If these callbacks are defined the property will not be stored in the ID properties
|
||||
|
@@ -1,6 +1,7 @@
|
||||
"""
|
||||
Basic UIList Example
|
||||
+++++++++++++++++++
|
||||
++++++++++++++++++++
|
||||
|
||||
This script is the UIList subclass used to show material slots, with a bunch of additional commentaries.
|
||||
|
||||
Notice the name of the class, this naming convention is similar as the one for panels or menus.
|
||||
@@ -73,8 +74,8 @@ class UIListPanelExample(bpy.types.Panel):
|
||||
# with no custom draw code, use "UI_UL_list").
|
||||
layout.template_list("MATERIAL_UL_matslots_example", "", obj, "material_slots", obj, "active_material_index")
|
||||
|
||||
# The second one can usually be left as an empty string. It's an additional ID used to distinguish lists in case you
|
||||
# use the same list several times in a given area.
|
||||
# The second one can usually be left as an empty string.
|
||||
# It's an additional ID used to distinguish lists in case you use the same list several times in a given area.
|
||||
layout.template_list("MATERIAL_UL_matslots_example", "compact", obj, "material_slots",
|
||||
obj, "active_material_index", type='COMPACT')
|
||||
|
||||
|
@@ -0,0 +1,11 @@
|
||||
"""
|
||||
Only works for 'basic type' properties (bool, int and float)!
|
||||
Multi-dimensional arrays (like array of vectors) will be flattened into seq.
|
||||
"""
|
||||
|
||||
collection.foreach_get(attr, some_seq)
|
||||
|
||||
# Python equivalent
|
||||
for i in range(len(seq)):
|
||||
some_seq[i] = getattr(collection[i], attr)
|
||||
|
@@ -0,0 +1,11 @@
|
||||
"""
|
||||
Only works for 'basic type' properties (bool, int and float)!
|
||||
seq must be uni-dimensional, multi-dimensional arrays (like array of vectors) will be re-created from it.
|
||||
"""
|
||||
|
||||
collection.foreach_set(attr, some_seq)
|
||||
|
||||
# Python equivalent
|
||||
for i in range(len(some_seq)):
|
||||
setattr(collection[i], attr, some_seq[i])
|
||||
|
Reference in New Issue
Block a user