Post #2531: I’m having some trouble converting some code to a single line, I keep getting “I
📋 Metadata
- Author: RaphaelBarros
- Date: 2019-07-22 13:32:17
- Type:
question - Quality Score: 5/10
- Replies (1): post_02533
🏷️ Tags
macro beginner python-scripting unsolved
⚙️ Related PME Features
- Macro Editor
- Python Scripting
💬 Content
I’m having some trouble converting some code to a single line, I keep getting “Invalid Syntax”. My whole code is this one:
import bpy
scene = bpy.context.scene
for ob in scene.objects:
if ob.type == 'MESH':
scene.objects.active = ob;
break;
bpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')
for ob in scene.objects:
if ob.type == 'EMPTY':
scene.objects.unlink(ob)
bpy.data.objects.remove(ob)
bpy.ops.object.join()
bpy.ops.mesh.customdata_custom_splitnormals_clear()
I guess the problem is the indentations, how can I convert “fors” and “ifs” to this single line codes?
I know I can call an external script from outside, but I’m making Blender simpler for some people from company I work on, so they can use it without much knowledge and for a really simple model conversion, so I’d rather not deal with external anything and a higher chance of them messing up the installation.