-
Notifications
You must be signed in to change notification settings - Fork 8
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
4 changed files
with
56 additions
and
6 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
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from . import rigid_body | ||
|
||
|
||
classes = ( | ||
rigid_body.OBJECT_OT_make_rigid_body, | ||
) | ||
|
||
|
||
def register(): | ||
from bpy.utils import register_class | ||
for cls in classes: | ||
register_class(cls) | ||
|
||
|
||
def unregister(): | ||
from bpy.utils import unregister_class | ||
for cls in reversed(classes): | ||
unregister_class(cls) | ||
|
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import bpy | ||
|
||
class OBJECT_OT_make_rigid_body(bpy.types.Operator): | ||
"""Tooltip""" | ||
bl_idname = "object.set_rigid_body" | ||
bl_label = "Make_rigid_body" | ||
bl_description = 'Convert object to be a rigid body' | ||
|
||
@classmethod | ||
def poll(cls, context): | ||
return len(context.selected_objects) > 0 | ||
|
||
def execute(self, context): | ||
prefs = context.preferences.addons[__package__.split('.')[0]].preferences | ||
|
||
for obj in bpy.context.selected_objects.copy(): | ||
new_name = obj.name | ||
|
||
if prefs.rigid_body_naming_position == 'SUFFIX': | ||
if not obj.name.endswith(prefs.rigid_body_extension): | ||
new_name = obj.name + prefs.rigid_body_separator + prefs.rigid_body_extension | ||
else: | ||
if not obj.name.startswith(prefs.rigid_body_extension): | ||
new_name = prefs.rigid_body_extension + prefs.rigid_body_separator + obj.name | ||
|
||
obj.name = new_name | ||
return {'FINISHED'} | ||
|
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