naming changes
path -> filepath (for rna and operators, as agreed on with elubie) path -> data_path (for windowmanager context functions, this was alredy used in many places)
This commit is contained in:
@@ -614,7 +614,7 @@ class Menu(StructRNA, _GenericUI):
|
||||
|
||||
def path_menu(self, searchpaths, operator, props_default={}):
|
||||
layout = self.layout
|
||||
# hard coded to set the operators 'path' to the filename.
|
||||
# hard coded to set the operators 'filepath' to the filename.
|
||||
|
||||
import os
|
||||
import bpy.utils
|
||||
@@ -623,12 +623,12 @@ class Menu(StructRNA, _GenericUI):
|
||||
|
||||
# collect paths
|
||||
files = []
|
||||
for path in searchpaths:
|
||||
files.extend([(f, os.path.join(path, f)) for f in os.listdir(path)])
|
||||
for directory in searchpaths:
|
||||
files.extend([(f, os.path.join(directory, f)) for f in os.listdir(directory)])
|
||||
|
||||
files.sort()
|
||||
|
||||
for f, path in files:
|
||||
for f, filepath in files:
|
||||
|
||||
if f.startswith("."):
|
||||
continue
|
||||
@@ -639,7 +639,7 @@ class Menu(StructRNA, _GenericUI):
|
||||
for attr, value in props_default.items():
|
||||
setattr(props, attr, value)
|
||||
|
||||
props.path = path
|
||||
props.filepath = filepath
|
||||
if operator == "script.execute_preset":
|
||||
props.menu_idname = self.bl_idname
|
||||
props.preset_name = preset_name
|
||||
|
||||
@@ -51,10 +51,10 @@ def compat_str(text, line_length=0):
|
||||
return text
|
||||
|
||||
|
||||
def graph_armature(obj, path, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=True, XTRA_INFO=True):
|
||||
def graph_armature(obj, filepath, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=True, XTRA_INFO=True):
|
||||
CONSTRAINTS = DRIVERS = True
|
||||
|
||||
fileobject = open(path, "w")
|
||||
fileobject = open(filepath, "w")
|
||||
fw = fileobject.write
|
||||
fw(header)
|
||||
fw('label = "%s::%s" ;' % (bpy.data.filepath.split("/")[-1].split("\\")[-1], obj.name))
|
||||
@@ -178,7 +178,7 @@ def graph_armature(obj, path, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=True,
|
||||
import sys
|
||||
sys.stdout.flush()
|
||||
'''
|
||||
print("\nSaved:", path)
|
||||
print("\nSaved:", filepath)
|
||||
return True
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -61,7 +61,7 @@ def rna_idprop_ui_prop_clear(item, prop):
|
||||
def draw(layout, context, context_member, use_edit=True):
|
||||
|
||||
def assign_props(prop, val, key):
|
||||
prop.path = context_member
|
||||
prop.data_path = context_member
|
||||
prop.property = key
|
||||
|
||||
try:
|
||||
@@ -81,7 +81,7 @@ def draw(layout, context, context_member, use_edit=True):
|
||||
if use_edit:
|
||||
row = layout.row()
|
||||
props = row.operator("wm.properties_add", text="Add")
|
||||
props.path = context_member
|
||||
props.data_path = context_member
|
||||
del row
|
||||
|
||||
for key, val in items:
|
||||
@@ -140,7 +140,7 @@ from bpy.props import *
|
||||
|
||||
|
||||
rna_path = StringProperty(name="Property Edit",
|
||||
description="Property path edit", maxlen=1024, default="", options={'HIDDEN'})
|
||||
description="Property data_path edit", maxlen=1024, default="", options={'HIDDEN'})
|
||||
|
||||
rna_value = StringProperty(name="Property Value",
|
||||
description="Property value edit", maxlen=1024, default="")
|
||||
@@ -153,11 +153,11 @@ rna_max = FloatProperty(name="Max", default=1.0, precision=3)
|
||||
|
||||
|
||||
class WM_OT_properties_edit(bpy.types.Operator):
|
||||
'''Internal use (edit a property path)'''
|
||||
'''Internal use (edit a property data_path)'''
|
||||
bl_idname = "wm.properties_edit"
|
||||
bl_label = "Edit Property"
|
||||
|
||||
path = rna_path
|
||||
data_path = rna_path
|
||||
property = rna_property
|
||||
value = rna_value
|
||||
min = rna_min
|
||||
@@ -165,7 +165,7 @@ class WM_OT_properties_edit(bpy.types.Operator):
|
||||
description = StringProperty(name="Tip", default="")
|
||||
|
||||
def execute(self, context):
|
||||
path = self.properties.path
|
||||
data_path = self.properties.data_path
|
||||
value = self.properties.value
|
||||
prop = self.properties.property
|
||||
prop_old = self._last_prop[0]
|
||||
@@ -176,7 +176,7 @@ class WM_OT_properties_edit(bpy.types.Operator):
|
||||
value_eval = value
|
||||
|
||||
# First remove
|
||||
item = eval("context.%s" % path)
|
||||
item = eval("context.%s" % data_path)
|
||||
|
||||
rna_idprop_ui_prop_clear(item, prop_old)
|
||||
exec_str = "del item['%s']" % prop_old
|
||||
@@ -207,7 +207,7 @@ class WM_OT_properties_edit(bpy.types.Operator):
|
||||
|
||||
self._last_prop = [self.properties.property]
|
||||
|
||||
item = eval("context.%s" % self.properties.path)
|
||||
item = eval("context.%s" % self.properties.data_path)
|
||||
|
||||
# setup defaults
|
||||
prop_ui = rna_idprop_ui_prop_get(item, self.properties.property, False) # dont create
|
||||
@@ -225,14 +225,14 @@ class WM_OT_properties_edit(bpy.types.Operator):
|
||||
|
||||
|
||||
class WM_OT_properties_add(bpy.types.Operator):
|
||||
'''Internal use (edit a property path)'''
|
||||
'''Internal use (edit a property data_path)'''
|
||||
bl_idname = "wm.properties_add"
|
||||
bl_label = "Add Property"
|
||||
|
||||
path = rna_path
|
||||
data_path = rna_path
|
||||
|
||||
def execute(self, context):
|
||||
item = eval("context.%s" % self.properties.path)
|
||||
item = eval("context.%s" % self.properties.data_path)
|
||||
|
||||
def unique_name(names):
|
||||
prop = 'prop'
|
||||
@@ -251,14 +251,14 @@ class WM_OT_properties_add(bpy.types.Operator):
|
||||
|
||||
|
||||
class WM_OT_properties_remove(bpy.types.Operator):
|
||||
'''Internal use (edit a property path)'''
|
||||
'''Internal use (edit a property data_path)'''
|
||||
bl_idname = "wm.properties_remove"
|
||||
bl_label = "Remove Property"
|
||||
|
||||
path = rna_path
|
||||
data_path = rna_path
|
||||
property = rna_property
|
||||
|
||||
def execute(self, context):
|
||||
item = eval("context.%s" % self.properties.path)
|
||||
item = eval("context.%s" % self.properties.data_path)
|
||||
del item[self.properties.property]
|
||||
return {'FINISHED'}
|
||||
|
||||
Reference in New Issue
Block a user