1
Fork 0

Add preset material, pull more variables into the template #5

Merged
danreeves merged 1 commit from improved-material-support-1 into master 2021-04-22 18:05:15 +02:00
danreeves commented 2021-04-18 09:08:27 +02:00 (Migrated from gitlab.com)

The BitsquidPBR.blend file includes a preset material which is set up to mimic the "core/stingray_renderer/shader_import/standard" shader graph. This single material is loaded into the current project through Blenders "Append..." API when a file is loaded (or a new one created).

image

It also pulls the basic values into the material template. The map textures can be added later.

There is also a small fix for the MATERIAL_OT_bitsquid_export, because it didn't seem to work on my system (Blender 2.92.0).

The BitsquidPBR.blend file includes a preset material which is set up to mimic the "core/stingray_renderer/shader_import/standard" shader graph. This single material is loaded into the current project through Blenders "Append..." API when a file is loaded (or a new one created). ![image](/uploads/c7fd5d03ea221f23aa728f879a451aa5/image.png) It also pulls the basic values into the material template. The map textures can be added later. There is also a small fix for the `MATERIAL_OT_bitsquid_export`, because it didn't seem to work on my system (Blender 2.92.0).
lschwiderski commented 2021-04-18 12:13:43 +02:00 (Migrated from gitlab.com)

Current issues with this:

  • Every time scripts are reloaded during development an additional handler is added.
  • Handlers stay active when the add-on is disabled via preferences.

I think both issues can be fixed by moving this call into register and adding a respective load_post.remove to unregister.

Current issues with this: * Every time scripts are reloaded during development an additional handler is added. * Handlers stay active when the add-on is disabled via preferences. I think both issues can be fixed by moving this call into `register` and adding a respective `load_post.remove` to `unregister`.
lschwiderski commented 2021-04-18 12:13:44 +02:00 (Migrated from gitlab.com)

This only works on Windows, due to hardcoded path separators.
Please use os.path.join or bpy.path.native_pathsep to create paths with correct native separators.

    cwd = os.path.dirname(os.path.realpath(__file__))
    blendfile = "BitsquidPBR.blend"
    section   = "Material"
    object    = "Stingray Standard"

    filepath  = os.path.join(cwd, blendfile, section, object)
    directory = os.path.join(cwd, blendfile, section)
This only works on Windows, due to hardcoded path separators. Please use `os.path.join` or `bpy.path.native_pathsep` to create paths with correct native separators. ```suggestion:-6+0 cwd = os.path.dirname(os.path.realpath(__file__)) blendfile = "BitsquidPBR.blend" section = "Material" object = "Stingray Standard" filepath = os.path.join(cwd, blendfile, section, object) directory = os.path.join(cwd, blendfile, section) ```
lschwiderski commented 2021-04-18 12:13:44 +02:00 (Migrated from gitlab.com)

Please use self.report here. prints don't show up in the UI.

        self.report({'WARNING'}, "Couldn't find Stingray Standard nodes")
Please use `self.report` here. `print`s don't show up in the UI. ```suggestion:-0+0 self.report({'WARNING'}, "Couldn't find Stingray Standard nodes") ```
lschwiderski commented 2021-04-18 12:21:00 +02:00 (Migrated from gitlab.com)

As mentioned on Discord, it is possible to replicate the if nodes through math nodes: testing.blend.

The big difference is the fact that the input and output data types in Bitsquid are dynamic, whereas in Blender, we need separate implementations for each data type. The .blend above includes implementations for factor and color:

Color

image

Factor

image

As mentioned on Discord, it is possible to replicate the `if` nodes through math nodes: [testing.blend](/uploads/fce267e8a052b6efb9560a75c1d1fb22/testing.blend). The big difference is the fact that the input and output data types in Bitsquid are dynamic, whereas in Blender, we need separate implementations for each data type. The `.blend` above includes implementations for `factor` and `color`: **Color** ![image](/uploads/5acc94aaf418c84198d7cfd32380a979/image.png) **Factor** ![image](/uploads/b78ae7c81ec05a77edb14d4d9c675758/image.png)
danreeves commented 2021-04-18 21:10:42 +02:00 (Migrated from gitlab.com)

changed this line in version 2 of the diff

changed this line in [version 2 of the diff](/lschwiderski/bitsquid-blender-tools/-/merge_requests/1/diffs?diff_id=173260560&start_sha=d2c7fc781132684ebbd0f4f9d0b55e7faa77e7b3#2140f11ab9b04eba4aff42640aa4b694767ce6eb_224_223)
danreeves commented 2021-04-18 21:10:43 +02:00 (Migrated from gitlab.com)

changed this line in version 2 of the diff

changed this line in [version 2 of the diff](/lschwiderski/bitsquid-blender-tools/-/merge_requests/1/diffs?diff_id=173260560&start_sha=d2c7fc781132684ebbd0f4f9d0b55e7faa77e7b3#d1a637ff698a3978de92e25925c121f7e3f80d88_120_120)
danreeves commented 2021-04-18 21:10:43 +02:00 (Migrated from gitlab.com)

added 1 commit

  • 3f0c3f53 - Apply 2 suggestion(s) to 2 file(s)

Compare with previous version

added 1 commit <ul><li>3f0c3f53 - Apply 2 suggestion(s) to 2 file(s)</li></ul> [Compare with previous version](/lschwiderski/bitsquid-blender-tools/-/merge_requests/1/diffs?diff_id=173260560&start_sha=d2c7fc781132684ebbd0f4f9d0b55e7faa77e7b3)
danreeves commented 2021-04-18 21:12:57 +02:00 (Migrated from gitlab.com)

Yep, that worked!

Yep, that worked!
danreeves commented 2021-04-18 22:57:58 +02:00 (Migrated from gitlab.com)

changed this line in version 3 of the diff

changed this line in [version 3 of the diff](/lschwiderski/bitsquid-blender-tools/-/merge_requests/1/diffs?diff_id=173269589&start_sha=3f0c3f5370d76e7b0a5097bcb11a87bc71ef7f73#2140f11ab9b04eba4aff42640aa4b694767ce6eb_236_237)
danreeves commented 2021-04-18 22:57:59 +02:00 (Migrated from gitlab.com)

added 6 commits

  • c15cb053 - 1 commit from branch lschwiderski:master
  • 2a39e636 - And and remove post_load handler in register and unregister
  • f8f2a955 - Merge branch 'improved-material-support-1' of...
  • d2fc5c27 - use real logic nodes in material shader graph
  • e8bb82d2 - move blend file into a folder and export more variables
  • fafcc999 - Merge branch 'master' into improved-material-support-1

Compare with previous version

added 6 commits <ul><li>c15cb053 - 1 commit from branch <code>lschwiderski:master</code></li><li>2a39e636 - And and remove post_load handler in register and unregister</li><li>f8f2a955 - Merge branch &#39;improved-material-support-1&#39; of...</li><li>d2fc5c27 - use real logic nodes in material shader graph</li><li>e8bb82d2 - move blend file into a folder and export more variables</li><li>fafcc999 - Merge branch &#39;master&#39; into improved-material-support-1</li></ul> [Compare with previous version](/lschwiderski/bitsquid-blender-tools/-/merge_requests/1/diffs?diff_id=173269589&start_sha=3f0c3f5370d76e7b0a5097bcb11a87bc71ef7f73)
danreeves commented 2021-04-18 22:59:42 +02:00 (Migrated from gitlab.com)

Thanks for the review! Resolved all the issues and updated the blend file

Thanks for the review! Resolved all the issues and updated the blend file
danreeves commented 2021-04-18 23:05:52 +02:00 (Migrated from gitlab.com)

resolved all threads

resolved all threads
lschwiderski commented 2021-04-20 19:50:23 +02:00 (Migrated from gitlab.com)

Looks good to me, great work! 💯

I did notice that the .blend file uses a custom value for the material export path that - technically - contains personal info. Since that value is tied to the material that's going to be imported into other people's files, it should be your call to merge as-is or change it.

Looks good to me, great work! :100: I did notice that the `.blend` file uses a custom value for the material export path that - technically - contains personal info. Since that value is tied to the material that's going to be imported into other people's files, it should be your call to merge as-is or change it.
danreeves commented 2021-04-22 01:19:15 +02:00 (Migrated from gitlab.com)

added 1 commit

  • 47c44f6a - reset material export path to default

Compare with previous version

added 1 commit <ul><li>47c44f6a - reset material export path to default</li></ul> [Compare with previous version](/lschwiderski/bitsquid-blender-tools/-/merge_requests/1/diffs?diff_id=175202271&start_sha=fafcc999d20ee2b68a7ba20a9389dc940be9a079)
danreeves commented 2021-04-22 01:19:57 +02:00 (Migrated from gitlab.com)

Good spot. Not a big deal but I reset it back to // anyway 👍

Good spot. Not a big deal but I reset it back to `//` anyway :thumbsup:
lschwiderski commented 2021-04-22 18:05:16 +02:00 (Migrated from gitlab.com)

mentioned in commit e9c289cb7f

mentioned in commit e9c289cb7fbd85f58557be47adf1c8bb7a1223fb
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: bitsquid/bitsquid-blender-tools#5
No description provided.