MCPcopy Index your code
hub / github.com/BrendanParmer/NodeToPython / vec_to_py_str

Function vec_to_py_str

NodeToPython/export/utils.py:114–133  ·  view source on GitHub ↗

Converts a {dimensions}-D vector to a string usable aby the add-on Parameters: vec: a {dimensions}-D vector dimensions: number of dimensions Returns: (str): string version

(vec, dimensions: int)

Source from the content-addressed store, hash-verified

112 return f"({vec4[0]}, {vec4[1]}, {vec4[2]}, {vec4[3]})"
113
114def vec_to_py_str(vec, dimensions: int) -> str:
115 """
116 Converts a {dimensions}-D vector to a string usable aby the add-on
117
118 Parameters:
119 vec: a {dimensions}-D vector
120 dimensions: number of dimensions
121
122 Returns:
123 (str): string version
124 """
125 if dimensions == 1:
126 return vec1_to_py_str(vec)
127 elif dimensions == 2:
128 return vec2_to_py_str(vec)
129 elif dimensions == 3:
130 return vec3_to_py_str(vec)
131 elif dimensions == 4:
132 return vec4_to_py_str(vec)
133 return ""
134
135def array_to_py_str(array: bpy_prop_array) -> str:
136 """

Callers 1

Calls 4

vec1_to_py_strFunction · 0.85
vec2_to_py_strFunction · 0.85
vec3_to_py_strFunction · 0.85
vec4_to_py_strFunction · 0.85

Tested by

no test coverage detected