Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by StarWeaver · Jun 25, 2014 at 02:09 PM · importblenderfilter

Ignoring certain objects on blender import

Hi! My .blend files all have extra objects in them like scaling references and lights and cameras for blender's renderer and such, which I really don't need or want in unity. Heck, I don't need it to import the high-poly meshes when doing normal baking either, but I don't want to remvove those from the file.

I'd like to make the blender importer drop any imported item that starts with a "." or something like that, so I can basically in blender mark things to be ignored by unity.

I'm fairly sure this can be achieved with the post-import scripting option but I really don't know what a good way to go about doing it is as i've barely started learning unity's APIs.

Thanks!

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image meat5000 ♦ · Jun 25, 2014 at 09:32 AM 0
Share

Select $$anonymous$$esh And Armature on EXPORT, deselect the other 3 entries in BLU$$anonymous$$

Anything Unity doesn't use can be safely deleted after Import.

3 Replies

· Add your reply
  • Sort: 
avatar image
5
Best Answer

Answer by StarWeaver · Jul 30, 2014 at 08:48 PM

After discovering that the scirpt unity uses to tell blender what to do is laying around in unity/editor/data/tools, I made this little hack to it to implement my own solution:

 --- Unity-BlenderToFBX.py.orig    2014-05-13 01:03:46.000000000 -0700
 +++ Unity-BlenderToFBX.py    2014-07-30 13:25:00.913891600 -0700
 @@ -71,7 +71,12 @@
              BATCH_OWN_DIR=False)
      else:
          # 2.59 and later
 +        # WVR HACKUMS HERE
 +        for obj in bpy.data.objects:
 +            obj.select = False if obj.name[0] in '_.' else True
 +
          kwargs = io_scene_fbx.export_fbx.defaults_unity3d()
 +        kwargs["use_selection"] = True
          io_scene_fbx.export_fbx.save(FakeOp(), bpy.context, filepath=outfile, **kwargs)
      # HQ normals are not supported in the current exporter
  
 
Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image petersonj79 · Sep 02, 2019 at 12:10 AM 0
Share

For Blender 2.80 use this:

 for obj in bpy.data.objects:
         
     if obj.name[0] == '_' or obj.name[0] == '.':
         print("Ignoring: " + obj.name)
         obj.select_set(False)
     else:
         print("Selecting: " + obj.name)
         obj.select_set(True)
 
 ...
 use_selection=True,
 ...

avatar image
0

Answer by Xtro · Jun 25, 2014 at 04:22 PM

1) Never import blender (or maya, 3dsmax) files into Unity directly. Always import fbx files. Reasons : a) Unity actually can't import anything else than fbx b) Unity converts the blender file to fbx first, then imports it as fbx. c) Unity does this conversion via blender (or other apps). If you don't have blender installed on your pc, Unity can't import blender files anymore.

2) For Importing certain objects :

a) In Blender (or other apps) select the object you want to import into Unity. b) Export Selected Object as FBX via Blender File Menu. Actually I didn't use blender before but all 3D apps should have something called "Export Selected".

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image musaranya · Jun 25, 2014 at 04:53 PM 0
Share

(in Blender there's a checkbox "Selected objects" when exporting to fbx)

avatar image StarWeaver · Jul 30, 2014 at 08:40 PM 1
Share

Ok, I gave the 'import fbx files directly' a good try, and found it less than useful. The default exporter for blender can't put out a file with the right orientation despite having those axis options.

The other option, an exporter I found at http://blenderfbx.render.jp/home , handles the axises properly but lacks many features, including the ability to apply modifiers automatically on export.

avatar image
0

Answer by marcospgp · Jun 01 at 01:33 PM

In Blender, you can move the objects you want to hide from Unity into a separate collection and disable that collection by unticking its checkbox.

You can then import the .blend file directly and the hidden objects won't show up in Unity.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Loading Blender models through script? 1 Answer

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Why does this script make my camera upside down? 0 Answers

.blend files with multiple scenes 0 Answers

How to toggle a key for a car to go forward or backward? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges