Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing material issue #156

Open
Mjamfan22 opened this issue Jan 30, 2023 · 16 comments
Open

Importing material issue #156

Mjamfan22 opened this issue Jan 30, 2023 · 16 comments

Comments

@Mjamfan22
Copy link

Mjamfan22 commented Jan 30, 2023

Trying to import a .mesh and materials don't import. The materials import with this on every .mesh i have tried to import except for this mod. Im not sure why it excludes this mod.

[ INFO] Target_path: C:\Users\hankj\Downloads\v5\Merged
[ INFO] Target_file_name: 4LinkBar.mesh
[ INFO] * Loading mesh from: C:\Users\hankj\Downloads\v5\Merged\4LinkBar.mesh
[ INFO] * Collecting mesh data...
[ INFO] * Parsing material file: C:\Users\hankj\Downloads\v5\Merged\crd_props.material
[WARNING] Script importing and material inheritance are not supported
[DEBUG] Material name: BackSponsorPlate
[WARNING] Material BackSponsorPlate is empty
[DEBUG] Material name: CRD32021
[WARNING] Material CRD32021 is empty
[DEBUG] Material name: CRDBadge
[WARNING] Material CRDBadge is empty
[DEBUG] Material name: CRDHardware
[WARNING] Material CRDHardware is empty
[DEBUG] Material name: CRDMetal
[WARNING] Material CRDMetal is empty
[DEBUG] Material name: FrontSponsorPlate
[WARNING] Material FrontSponsorPlate is empty
[ INFO] * Parsing material file: C:\Users\hankj\Downloads\v5\Merged\driver.material
[WARNING] Script importing and material inheritance are not supported
[DEBUG] Material name: HansDevice
[WARNING] Material HansDevice is empty
[DEBUG] Material name: HansMetalParts
[WARNING] Material HansMetalParts is empty
[ INFO] * Parsing material file: C:\Users\hankj\Downloads\v5\Merged\feld_fourlinks.material
[WARNING] Script importing and material inheritance are not supported
[DEBUG] Material name: 4LinkBar
[WARNING] Material 4LinkBar is empty
[DEBUG] Material name: 4LinkSilver
[WARNING] Material 4LinkSilver is empty
[ INFO] * Parsing material file: C:\Users\hankj\Downloads\v5\Merged\feld_sway_bar.material
[WARNING] Script importing and material inheritance are not supported
[DEBUG] Material name: CRDSwayBar
[WARNING] Material CRDSwayBar is empty
[DEBUG] Material name: FeldSBArm
[WARNING] Material FeldSBArm is empty
[DEBUG] Material name: FeldSBArmSilver
[WARNING] Material FeldSBArmSilver is empty
[DEBUG] Material name: SBarBlock
[WARNING] Material SBarBlock is empty
[DEBUG] Material name: SBarLink
[WARNING] Material SBarLink is empty
[ INFO] * Parsing material file: C:\Users\hankj\Downloads\v5\Merged\pei_axle.material
[WARNING] Script importing and material inheritance are not supported
[DEBUG] Material name: pei_axle_40_housing
[WARNING] Material pei_axle_40_housing is empty
[DEBUG] Material name: pei_axle_40_nuts_bolts
[WARNING] Material pei_axle_40_nuts_bolts is empty
[DEBUG] Material name: pei_driveline_nuts_bolts
[WARNING] Material pei_driveline_nuts_bolts is empty
[DEBUG] Material name: pei_axle_40_accessories
[WARNING] Material pei_axle_40_accessories is empty
[DEBUG] Material name: driveline
[WARNING] Material driveline is empty
[DEBUG] Material name: TieRodBlack
[WARNING] Material TieRodBlack is empty
[DEBUG] Material name: HydroBox
[WARNING] Material HydroBox is empty
[DEBUG] Material name: brake_caliper
[WARNING] Material brake_caliper is empty
[ INFO] * Parsing material file: C:\Users\hankj\Downloads\v5\Merged\pei_shocks.material
[WARNING] Script importing and material inheritance are not supported
[DEBUG] Material name: FeldPEI
[WARNING] Material FeldPEI is empty
[DEBUG] Material name: LimitStrap
[WARNING] Material LimitStrap is empty
[DEBUG] Material name: V5PEIShaft
[WARNING] Material V5PEIShaft is empty
[ INFO] * Parsing material file: C:\Users\hankj\Downloads\v5\Merged\rims.material
[WARNING] Script importing and material inheritance are not supported
[DEBUG] Material name: BeadlockRimBolts
[WARNING] Material BeadlockRimBolts is empty
[DEBUG] Material name: FeldBeadlockBlack
[WARNING] Material FeldBeadlockBlack is empty
[DEBUG] Material name: black_beadlock_black_rim
[WARNING] Material black_beadlock_black_rim is empty
[ INFO] * Parsing material file: C:\Users\hankj\Downloads\v5\Merged\sm_materials.material
[DEBUG] Material name: specular_shine_mat
[WARNING] Only one pass is supported
[WARNING] Material specular_shine_mat is empty
[DEBUG] Material name: specular_shine_alpha_mat
[WARNING] Only one pass is supported
[WARNING] Material specular_shine_alpha_mat is empty
[DEBUG] Material name: specular_shine_double_sided_mat
[WARNING] Only one pass is supported
[WARNING] Material specular_shine_double_sided_mat is empty
[DEBUG] Material name: specular_shine_two_sided_mat
[WARNING] Only one pass is supported
[WARNING] Only one pass is supported
[WARNING] Material specular_shine_two_sided_mat is empty
[DEBUG] Material name: specular_mat
[WARNING] Material specular_mat is empty
[DEBUG] Material name: shine_double_sided_mat
[WARNING] Material shine_double_sided_mat is empty
[DEBUG] Material name: shine_two_sided_mat
[WARNING] Only one pass is supported
[WARNING] Material shine_two_sided_mat is empty
[DEBUG] Material name: simple_alpha_mat
[ERROR] Texture name not found: line: 145, type: TID_WORD, lexeme: texture
[WARNING] Material simple_alpha_mat is empty
[DEBUG] Material name: simple_texture_mat
[ERROR] Texture name not found: line: 159, type: TID_WORD, lexeme: texture
[WARNING] Material simple_texture_mat is empty
[DEBUG] Material name: flare_binding_mat
[ INFO] * Parsing material file: C:\Users\hankj\Downloads\v5\Merged\sm_shared.material
[WARNING] Script importing and material inheritance are not supported
[DEBUG] Material name: AirFilter
[WARNING] Material AirFilter is empty
[DEBUG] Material name: BlackPlastic
[WARNING] Material BlackPlastic is empty
[DEBUG] Material name: BodyBolts
[WARNING] Material BodyBolts is empty
[DEBUG] Material name: BoltMountBolt
[WARNING] Material BoltMountBolt is empty
[DEBUG] Material name: BodyMountBolts
[WARNING] Material BodyMountBolts is empty
[DEBUG] Material name: BrakePedal
[WARNING] Material BrakePedal is empty
[DEBUG] Material name: BreatherFittings
[WARNING] Material BreatherFittings is empty
[DEBUG] Material name: CheetahV5
[WARNING] Material CheetahV5 is empty
[DEBUG] Material name: EngineExtras
[WARNING] Material EngineExtras is empty
[DEBUG] Material name: EngineFan
[WARNING] Material EngineFan is empty
[DEBUG] Material name: Fiberglass
[WARNING] Material Fiberglass is empty
[DEBUG] Material name: FireExtinguisher
[WARNING] Material FireExtinguisher is empty
[DEBUG] Material name: GaugeNeddle
[WARNING] Material GaugeNeddle is empty
[DEBUG] Material name: HeimJoint
[WARNING] Material HeimJoint is empty
[DEBUG] Material name: HolleyECU
[WARNING] Material HolleyECU is empty
[DEBUG] Material name: HotFootPedal
[WARNING] Material HotFootPedal is empty
[DEBUG] Material name: JAZFuelCell
[WARNING] Material JAZFuelCell is empty
[DEBUG] Material name: JazProCell
[WARNING] Material JazProCell is empty
[DEBUG] Material name: Lexan
[WARNING] Material Lexan is empty
[DEBUG] Material name: MetalHose
[WARNING] Material MetalHose is empty
[DEBUG] Material name: MufflerHeaders
[WARNING] Material MufflerHeaders is empty
[DEBUG] Material name: OilFilter
[WARNING] Material OilFilter is empty
[DEBUG] Material name: OilGauge
[WARNING] Material OilGauge is empty
[DEBUG] Material name: OptimaBatteryYellow
[WARNING] Material OptimaBatteryYellow is empty
[DEBUG] Material name: PelicanCase
[WARNING] Material PelicanCase is empty
[DEBUG] Material name: PinionShield
[WARNING] Material PinionShield is empty
[DEBUG] Material name: QCQuickRelease
[WARNING] Material QCQuickRelease is empty
[DEBUG] Material name: Radiator
[WARNING] Material Radiator is empty
[DEBUG] Material name: RadSeatMount
[WARNING] Material RadSeatMount is empty
[DEBUG] Material name: RearSteerPump
[WARNING] Material RearSteerPump is empty
[DEBUG] Material name: RearSteerSwitches
[WARNING] Material RearSteerSwitches is empty
[DEBUG] Material name: ReverseLight
[WARNING] Material ReverseLight is empty
[DEBUG] Material name: RIIBox
[WARNING] Material RIIBox is empty
[DEBUG] Material name: RIILEDStrip
[WARNING] Material RIILEDStrip is empty
[DEBUG] Material name: RubberCables
[WARNING] Material RubberCables is empty
[DEBUG] Material name: SCSTransferCase
[WARNING] Material SCSTransferCase is empty
[DEBUG] Material name: ShaftCover
[WARNING] Material ShaftCover is empty
[DEBUG] Material name: ShutOffSwitch
[WARNING] Material ShutOffSwitch is empty
[DEBUG] Material name: SMBolt
[WARNING] Material SMBolt is empty
[DEBUG] Material name: V5Lexan
[WARNING] Material V5Lexan is empty
[DEBUG] Material name: V5Windshield
[WARNING] Material V5Windshield is empty
[DEBUG] Material name: SteeringColumn
[WARNING] Material SteeringColumn is empty
[DEBUG] Material name: SteeringTank
[WARNING] Material SteeringTank is empty
[DEBUG] Material name: SteeringOrbital
[WARNING] Material SteeringOrbital is empty
[DEBUG] Material name: SteeringWheel
[WARNING] Material SteeringWheel is empty
[DEBUG] Material name: TransConnector
[WARNING] Material TransConnector is empty
[DEBUG] Material name: V5ButlerSeat
[WARNING] Material V5ButlerSeat is empty
[DEBUG] Material name: V5DiamondPlate
[WARNING] Material V5DiamondPlate is empty
[DEBUG] Material name: V5EngineBolts
[WARNING] Material V5EngineBolts is empty
[DEBUG] Material name: V5EngineComponents
[WARNING] Material V5EngineComponents is empty
[DEBUG] Material name: V5EngineMain
[WARNING] Material V5EngineMain is empty
[DEBUG] Material name: V5HolleyDash
[WARNING] Material V5HolleyDash is empty
[DEBUG] Material name: V5MSD
[WARNING] Material V5MSD is empty
[DEBUG] Material name: V5Pumps
[WARNING] Material V5Pumps is empty
[DEBUG] Material name: V5Switchbox
[WARNING] Material V5Switchbox is empty
[DEBUG] Material name: V5Tach
[WARNING] Material V5Tach is empty
[DEBUG] Material name: V5Transmission
[WARNING] Material V5Transmission is empty
[DEBUG] Material name: VoltsGauge
[WARNING] Material VoltsGauge is empty
[DEBUG] Material name: WaterGauge
[WARNING] Material WaterGauge is empty
[DEBUG] Material name: WaterPump
[WARNING] Material WaterPump is empty
[DEBUG] Material name: Accumulator
[WARNING] Material Accumulator is empty
[DEBUG] Material name: ReverseSpeaker
[WARNING] Material ReverseSpeaker is empty
[DEBUG] Material name: SteelRope
[WARNING] Material SteelRope is empty
[ INFO] * Parsing material file: C:\Users\hankj\Downloads\v5\Merged\tires.material
[WARNING] Script importing and material inheritance are not supported
[DEBUG] Material name: BKT2021
[WARNING] Material BKT2021 is empty
[ INFO] + Creating mesh: 4LinkBar
[WARNING] Definition of material: 4LinkBar not found!
Info: Removed 1270 vertice(s)
[WARNING] Definition of material: HeimJoint not found!
Info: Removed 1270 vertice(s)
[DEBUG] Removed 16.0 faces
________________________________________________________________________________
Report:
  WARNINGS:
    - Definition of material: 4LinkBar not found!
    - Definition of material: HeimJoint not found!
  Original Vertices: 2658
  Imported Vertices: 2776
  Original Faces: 2584
  Imported Triangles: 2568
  MESHES: 2

Extended Report:
  MESHES:
    . 4LinkBar
    . HeimJoint
________________________________________________________________________________
@sercero
Copy link
Collaborator

sercero commented Jan 30, 2023

Can you post the .mesh and the .material?

Also: what Blender version are you using?

Thanks!

@Mjamfan22
Copy link
Author

2.93

Tires.zip

@sercero
Copy link
Collaborator

sercero commented Jan 31, 2023

That material is inheriting from other material, that feature is not supported by the importers' material parser.

I understand this is annoying, but it is not implemented right now.

You can see it from all the warnings in the Log: [WARNING] Script importing and material inheritance are not supported

A possible workaround is for you to do the inheritance process by hand.

@Mjamfan22
Copy link
Author

I'm not familiar with an inheritance material in blender. Would it be assigned in code or in blender. because at the moment when it imports, i have to assign the .png to the object with the material editor tab for every part. Not the worst process because some objects import with textures assigned and some don't. It is weird.

@Mjamfan22
Copy link
Author

I just tried importing another .mesh and out of around 30 objects, 4 got assigned textures.

Some, all the textures are assigned. Some none are. It is like a random draw.

@sercero
Copy link
Collaborator

sercero commented Apr 15, 2023

The inheritance is in the OGRE materials, not Blender.

Example:

import * from "sm_materials.material"

material BKT2021: specular_shine_double_sided_mat
{
    set $texture "BKT2021.png"
    set $texture_spec "BKT2021-shine.png"
    set $texture_shine "BKT2021-shine.png"
}

The blender2ogre plugin does not know what to do about that material since the import keyword is not yet supported.

@Mjamfan22
Copy link
Author

Oh I get it now. Thanks!

Is that feature coming in the future?

@sercero
Copy link
Collaborator

sercero commented Apr 16, 2023

Yesterday I was thinking about it.

But it would be great if you could share all the materials that you are using, so I get a better picture because the Tires.zip only has 1 material that is derived.

Also the implementation would probably be suited for this case only because it would be extremely difficult to handle all the permutations of OGRE materials out there.

@Mjamfan22
Copy link
Author

This is the main thing, a lot of files from here do the same thing. But a lot also import materials just fine.

https://sim-monsters.com/files/file/4278-sm-v5/

If it is not a hard addition, I would greatly appreciate it!

@sercero
Copy link
Collaborator

sercero commented Apr 16, 2023

Probably the ones that are base materials are importing OK

@Mjamfan22
Copy link
Author

Mjamfan22 commented Apr 17, 2023 via email

@FeuerTiger86
Copy link
Contributor

FeuerTiger86 commented Apr 17, 2024

I also had issues importing Materials, however, if I just want to edit the model, I don't actually need the materials to import correctly. My problem was that after importing a model, it only had the materials it could import and all information about the other materials was apparently lost. Importing with separated sub meshes kind of worked, but I'd still have to create the materials so that they would be referenced in the exported model (which then could use its original materials as before).

Therefore, I edited the import script slightly to create the materials if they could not be found (ogre_import.py from line 1270):

else:
    logger.warning("Definition of material: \"%s\" not found!" % subMeshName)
    Report.warnings.append("Definition of material: \"%s\" not found!" % subMeshName)
    mat = bpy.data.materials.new(name=subMeshName)
    ob.data.materials.append(mat)

Maybe there could be an option in the import settings for this.

@sercero
Copy link
Collaborator

sercero commented Apr 17, 2024

@FeuerTiger86 can you create a pull-request regarding this change?

Thanks!

@Mjamfan22
Copy link
Author

So does this fix the issue?

@FeuerTiger86
Copy link
Contributor

If you only want to edit the mesh itself but none of the materials that could not be imported, yes. It will create new default (white) materials with the correct names, so that the information about which part of the mesh uses which material is preserved. Then don't export materials so that the edited mesh uses the existing materials.

@sercero
Copy link
Collaborator

sercero commented Apr 23, 2024

@Mjamfan22 as @FeuerTiger86 said, this does not fix the issue.

I tried to implement support for inheritance but found it too difficult for me, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants