-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
11 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
def empty_at(pos, type='PLAIN_AXES', size=1): | ||
def empty_at(pos, name='Empty', type='PLAIN_AXES', size=1.0, link=True): | ||
''' | ||
Create an empty at given Vector3 position. | ||
Optional type (default 'PLAIN_AXES') in ,'ARROWS','SINGLE_ARROW','CIRCLE','CUBE','SPHERE','CONE','IMAGE' | ||
default size is 1.0 | ||
pos (Vector3): position | ||
name (str, default Empty): name of the empty object | ||
type (str, default 'PLAIN_AXES'): options in 'PLAIN_AXES','ARROWS','SINGLE_ARROW','CIRCLE','CUBE','SPHERE','CONE','IMAGE' | ||
size (int, default 1.0): Size of the empty | ||
link (Bool,default True): Link to active collection | ||
i.e : empty_at((0,0,1), 'ARROWS', 2) creates "Empty" at Z+1, of type gyzmo and size 2 | ||
''' | ||
|
||
mire = bpy.data.objects.new( "mire_empty", None ) | ||
bpy.context.collection.objects.link(mire) | ||
mire = bpy.data.objects.new(name, None) | ||
if link: | ||
bpy.context.collection.objects.link(mire) | ||
mire.empty_display_type = type | ||
mire.empty_display_size = size | ||
mire.location = pos | ||
return mire | ||
|
||
#exemple : create an empty at Z+1, of type gyzmo and size 2 | ||
empty_at((0,0,1), 'ARROWS', 2) | ||
return mire |