X-Plane / XPlane2Blender

Scenery & Aircraft export addon for Blender and X-Plane
GNU General Public License v3.0
197 stars 67 forks source link

ATTR_light_level as custom property gets overriden by material property #343

Closed lehthanis closed 6 years ago

lehthanis commented 6 years ago

In my cockpit I have some knobs on the side console that are lit by a different dataref than the rest of the object, so I wanted to add a custom property for it.  I have the overall light level overriden in the material properties and it seems to place that periodically throughout the obj file...and everywhere I add a custom property (only 5 objects) I have to go in and delete the material property one that appears almost right after it.  It looks like this in the editor:

# 2 Object: btn_AirCondTemp001
ANIM_begin
# static translation
ANIM_trans  0.32345 -0.09976    3.38899994  0.32345 -0.09976    3.38899994
# rotation keyframes
ANIM_rotate_begin   1   0   0   cjs/texanii/manips/environ/temp_control
ANIM_rotate_key -1  7.87014865
ANIM_rotate_key 0   7.87014865
ANIM_rotate_key 1   7.87014865
ANIM_rotate_end
ANIM_rotate_begin   0   1   0   cjs/texanii/manips/environ/temp_control
ANIM_rotate_key -1  39.99990321
ANIM_rotate_key 0   -90.00020741
ANIM_rotate_key 1   -219.99975113
ANIM_rotate_end
# PRIMITIVE: btn_AirCondTemp001 weight: 0
ATTR_light_level    0 1 sim/cockpit2/electrical/instrument_brightness_ratio[3]
# MATERIAL: Cockpit_A
ATTR_light_level    0   1   sim/cockpit2/electrical/instrument_brightness_ratio[2]
ATTR_manip_command_knob rotate_large    cjs/texanii/commands/temp_control_knob_up   cjs/texanii/commands/temp_control_knob_down Temp Control
TRIS    33612 351
ANIM_end

the light level without the tabs, instrument_brightness_ratio[3] is the one I have in the custom property slot of the object.  The [2] one is the one that is part of the material properties.

airfightergr commented 6 years ago

Fast solution is to make the material single user and apply it to the specific meshes.

lehthanis commented 6 years ago

That's not fast at all if I have 412 objects and only 5 of them need a different light source...That means I'd have to select each circuit breaker and assign it the default light level for the material. Is there a better way?

Edit: I just realized you meant to apply a different material to the 5 meshes with the different light level dataref? I guess I'd use same texture, just different light level overrides? That could work, except for it may break my export to Substance Painter since it's based on material names. sigh

I'm wondering if there should be some kind of logic for light_level at the object level?

airfightergr commented 6 years ago

You are actually copying the material. You change the copy for the different dataref only. Same texture, same everything. This will have no effect on Substance.

lehthanis commented 6 years ago

Ohhh... How do I make that copy and have it use same name?

airfightergr commented 6 years ago

material By clicking this number, will copy the material and will give a name like "cockpit_obj.001", in this case. You change and assign that to those 5 objects. This is only for X-Plane export. In substance still you can use the original material or the 001, since both are the same.

lehthanis commented 6 years ago

Awesome, thanks! Is there a place jan xplane.org where airplane devs are hanging out these days? The org seems to be pretty dead most of the time.

tngreene commented 6 years ago

Thank you to @airfightergr for your awesome community response! Devs helping devs! Always a great thing to see.

lehthanis commented 6 years ago

@tngreene I wanted to mention, even though this is closed now...that this did fix my problem for exporting to x-plane but did not change the fact that it generates a new material in the eyes of substance painter. So technically it is a new material, and the .001 does not mean it's a reference...it's separate.

tngreene commented 6 years ago

If you can formulate that in the form of a bug report or feature request, please resubmit that!