Brush/Paint internal changes
- remove brush array for each Paint struct, just use a single brush pointer. - removed rna function based template filtering. - filter brushes using a flag on the brush and the pointer poll function. - set the brushes using a new operator WM_OT_context_set_id(). TODO - remake startup.blend, currently brush groupings are lost. - rewrite WM_OT_context_set_id() to use rna introspection.
This commit is contained in:
@@ -325,6 +325,39 @@ class WM_OT_context_cycle_enum(bpy.types.Operator):
|
||||
exec("context.%s=advance_enum" % self.properties.data_path)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class WM_OT_context_set_id(bpy.types.Operator):
|
||||
'''Toggle a context value.'''
|
||||
bl_idname = "wm.context_set_id"
|
||||
bl_label = "Set Library ID"
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = StringProperty(name="Value",
|
||||
description="Assign value", maxlen=1024, default="")
|
||||
|
||||
def execute(self, context):
|
||||
value = self.properties.value
|
||||
print(value)
|
||||
|
||||
# TODO! highly lazy, must rewrite
|
||||
for lib in dir(bpy.data):
|
||||
try:
|
||||
id_value = getattr(bpy.data, lib)[value] # bpy.data.brushes["Smooth"]
|
||||
except:
|
||||
id_value = None
|
||||
|
||||
if id_value:
|
||||
try:
|
||||
print("attempts", id_value)
|
||||
exec("context.%s=id_value" % self.properties.data_path)
|
||||
break # success
|
||||
except:
|
||||
pass
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
doc_id = StringProperty(name="Doc ID",
|
||||
description="", maxlen=1024, default="", options={'HIDDEN'})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user